NormFeatMain.cpp

Go to the documentation of this file.
00001 /*
00002 This file is part of LIA_RAL which is a set of software based on ALIZE
00003 toolkit for speaker recognition. ALIZE toolkit is required to use LIA_RAL.
00004 
00005 LIA_RAL project is a development project was initiated by the computer
00006 science laboratory of Avignon / France (Laboratoire Informatique d'Avignon -
00007 LIA) [http://lia.univ-avignon.fr <http://lia.univ-avignon.fr/>]. Then it
00008 was supported by two national projects of the French Research Ministry:
00009         - TECHNOLANGUE program [http://www.technolangue.net]
00010         - MISTRAL program [http://mistral.univ-avignon.fr]
00011 
00012 LIA_RAL is free software: you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation, either version 3 of
00015 the License, or any later version.
00016 
00017 LIA_RAL is distributed in the hope that it will be useful,
00018 but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 GNU Lesser General Public License for more details.
00021 
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with LIA_RAL.
00024 If not, see [http://www.gnu.org/licenses/].
00025 
00026 The LIA team as well as the LIA_RAL project team wants to highlight the
00027 limits of voice authentication in a forensic context.
00028 The "Person Authentification by Voice: A Need of Caution" paper
00029 proposes a good overview of this point (cf. "Person
00030 Authentification by Voice: A Need of Caution", Bonastre J.F.,
00031 Bimbot F., Boe L.J., Campbell J.P., Douglas D.A., Magrin-
00032 chagnolleau I., Eurospeech 2003, Genova].
00033 The conclusion of the paper of the paper is proposed bellow:
00034 [Currently, it is not possible to completely determine whether the
00035 similarity between two recordings is due to the speaker or to other
00036 factors, especially when: (a) the speaker does not cooperate, (b) there
00037 is no control over recording equipment, (c) recording conditions are not
00038 known, (d) one does not know whether the voice was disguised and, to a
00039 lesser extent, (e) the linguistic content of the message is not
00040 controlled. Caution and judgment must be exercised when applying speaker
00041 recognition techniques, whether human or automatic, to account for these
00042 uncontrolled factors. Under more constrained or calibrated situations,
00043 or as an aid for investigative purposes, judicious application of these
00044 techniques may be suitable, provided they are not considered as infallible.
00045 At the present time, there is no scientific process that enables one to
00046 uniquely characterize a persones voice or to identify with absolute
00047 certainty an individual from his or her voice.]
00048 
00049 Copyright (C) 2004-2010
00050 Laboratoire d'informatique d'Avignon [http://lia.univ-avignon.fr]
00051 LIA_RAL admin [alize@univ-avignon.fr]
00052 Jean-Francois Bonastre [jean-francois.bonastre@univ-avignon.fr]
00053 */
00054 
00055 #include <iostream>
00056 #include "NormFeat.h"
00057 #include <alize.h>
00058 #include <liatools.h>
00059 
00060 int main (int argc, char *argv[])
00061 {
00062   using namespace std; 
00063   using namespace alize;
00064 
00065     ConfigChecker cc;
00066     cc.addStringParam("config", false, true, "default config filename");
00067     cc.addStringParam("mode", true, true, "<norm: mean, var, warp normalization | info: save stats of file | featmap: feature mapping | FA EigenChannel Compensation >");
00068     cc.addStringParam("inputFeatureFilename",true,true,"input feature - could be a simple feature file or a list of filename");
00069     cc.addStringParam("labelSelectedFrames",true,true,"Only the frames from segments with this label  will be used");
00070     cc.addBooleanParam("fileMode",false,true,"One normalisation for all the selected data, could be applied after segmental/window modes if both are selected");  
00071     cc.addBooleanParam("segmentalMode",false,true,"if set to true, one normalisation by segment is computed");  
00072     cc.addBooleanParam("windowMode",false,true,"if set to true, the normalisation is computed by windows");  
00073     cc.addFloatParam("windowDuration",false,true,"Length of the window (for window mode) in seconds (default=5)");
00074     cc.addFloatParam("windowComp",false,true,"compensation factor for window mode (default =1.0 - no compensation");
00075     cc.addBooleanParam("writeAllFeatures",false,true,"if set to true,values for all the input frames are outputed (default true)");  
00076     cc.addStringParam("featureServerMode",true,true,"FEATURE_WRITABLE to write normalized features");  
00077     cc.addStringParam("outputInfoFilename",false,true,"The complete output filename for the info file");
00078     cc.addBooleanParam("cmsOnly",false,true,"If cmsOnly is set, only remove means from features (default false)");
00079     cc.addBooleanParam("varOnly",false,true,"If cmsOnly is set, reduce only variance from features (default false)");
00080     cc.addBooleanParam("warp",false,true,"If warp is set, uses featureWarping (default false)");
00081     cc.addIntegerParam("warpBinCount",false,true,"If warp is set, this parameter fixes the number of bins in the data histo (default=40)");
00082     cc.addStringParam("warpGaussHistoFilename",false,true,"for warping, if this parameter is set, it loads the destination histo, default it creates it (N(0,1))");
00083     cc.addBooleanParam("warpAdd01Norm",false,true,"for warping, add a global N(0,1) normalisation after warping (default false)");  
00084     cc.addStringParam("externalStatsFilename",false,true,"filename containing external stats to apply for normalization, usually obtained with info mode (opt.)");
00085     cc.addFloatParam("frameLength",false,true,"length of a frame, by default 10ms");
00086   try
00087   {
00088     CmdLine cmdLine (argc, argv);
00089     if (cmdLine.displayHelpRequired ()){        // --help
00090       cout << "NormFeat" << endl;
00091       cout << "NormFeat.exe --config <foo.cfg> --inputFeatureFileName <foo.prm> --mode <norm|info|featMap>"<< endl;
00092       cout<<cc.getParamList()<<endl;
00093       }
00094     else if (cmdLine.displayVersionRequired ()) // --version
00095       cout << "Version 2.0" << endl;
00096     else{
00097       Config tmp;
00098       cmdLine.copyIntoConfig (tmp);
00099       Config config;
00100       if (tmp.existsParam("config")) config.load(tmp.getParam("config"));
00101       cmdLine.copyIntoConfig(config);
00102       cc.check(config);
00103       debug=config.getParam_debug();
00104       if (config.existsParam("verbose")) verbose=config.getParam("verbose").toBool();
00105       else verbose=false;
00106       if (verbose) verboseLevel=1;else verboseLevel=0;
00107       if (config.existsParam("verboseLevel"))verboseLevel=config.getParam("verboseLevel").toLong();
00108       if (verboseLevel>0) verbose=true;
00109       String mode=config.getParam("mode");
00110       if ( mode == "norm"){normFeat(config);}
00111       else if ( mode == "info"){infoFeat(config);}
00112       else if (mode == "featMap"){featMap(config);}
00113       else if (mode == "NAP"){normFeatNAP(config);}      
00114       else if (mode == "FA"){normFeatFA(config);}      
00115       else if (mode == "LFA"){normFeatLFA(config);}      
00116       else throw Exception("Error: Mode unknown!",__FILE__,__LINE__);
00117     }
00118   }
00119   catch (alize::Exception & e) {cout << e.toString () << endl << cc.getParamList() << endl;}
00120   #ifdef NDEBUG 
00121   cout<<"*** Objects created and destroyed **"<<Object::getCreationCounter()<<"-"<<Object::getDestructionCounter()<<endl;    
00122   #endif
00123   return 0;
00124 }