00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include <iostream>
00056 #include "liatools.h"
00057 #include "TrainTarget.h"
00058
00059 int main(int argc, char* argv[]){
00060
00061 ConfigChecker cc;
00062 cc.addStringParam("config", false, true, "default config filename");
00063 cc.addIntegerParam("verboseLevel",false,true,"level of the berose information 0=no verbose, 1=normal, 2=more");
00064 cc.addStringParam("inputFeatureFilename",false, true,"feature filename or filename of a text file with the list of feature filenames");
00065 cc.addStringParam("targetIdList",true,true,"The file with the list of models to train. A line is composed by client_id file1 file2 ...");
00066 cc.addStringParam("inputWorldFilename",false,true,"if set, the init is based on a model get from this file, else frrom scratch");
00067 cc.addStringParam("mixtureServer",false,true,"If set save the complete mixture server in the filename (FUTURE USED, TODO)");
00068 cc.addBooleanParam("initByClient",false,true,"For by lael option. Modify the initial model for statistic estimation (EM), default world, if set client");
00069 cc.addBooleanParam("saveEmptyModel",false,true,"If no data is available for a model (or a lable model), save the not adapted model (world or global client)");
00070 cc.addBooleanParam("useIdForSelectedFrame",false,true,"If set, the segments with label ID are used for training the client model ID");
00071 cc.addStringParam("labelSelectedFrames",false,true,"The segments with this label are used for training the worldmodel (if UseIdForSelectedFrame is not used)");
00072 cc.addFloatParam("baggedFrameProbability",false,true,"Defines the % of frames taken for each iterations (default 1)");
00073 cc.addIntegerParam("nbTrainIt",false,true,"number of it (default=1)");
00074 cc.addBooleanParam("normalizeModel",false,true,"if set to true, normalize the world (at each iteration)");
00075 cc.addBooleanParam("normalizeModelMeanOnly",false,true,"Used only if normalizeModel is On, says if only mean parameters should be normalized");
00076 cc.addIntegerParam("normalizeModelNbIt",false,true,"Used only if noramlizeModelMeanOnly is set, nb of normalization it");
00077 cc.addBooleanParam("meanAdapt",false,true,"Mean adaptation (default false)");
00078 cc.addBooleanParam("varAdapt",false,true,"Variance adaptation (default false)");
00079 cc.addBooleanParam("weightAdapt",false,true,"Weight adaptation (default false)");
00080 cc.addStringParam("MAPAlgo",true,true,"Adaptation method (MAPConst,MAPConst2,MAPOccDep,MLLR)");
00081 cc.addFloatParam("MAPAlphaMean",false,true,"a priori proba for world");
00082 cc.addFloatParam("MAPAlphaVar",false,true,"a priori proba for world");
00083 cc.addFloatParam("MAPAlphaWeight",false,true,"a priori proba for world");
00084 cc.addFloatParam("MAPRegFactorMean",false,true,"Reg factor");
00085 cc.addFloatParam("MAPRegFactorVar",false,true,"Reg factor");
00086 cc.addFloatParam("MAPRegFactorWeight",false,true,"Reg factor");
00087 cc.addBooleanParam("info",false,false,"If info is requested, just info on the train set is outputed");
00088 cc.addBooleanParam("useModelData",false,true,"New MAP algo based on ML estimate of the training data");
00089 cc.addStringParam("initModel",false,true,"With model based, use a specific model for initialize the EM estimate (default=world");
00090 cc.addBooleanParam("outputAdaptParam",false,true,"Saving a vector (matrix if MLLR, weights if MAP) instead of a mixture");
00091
00092 try{
00093 CmdLine cmdLine(argc, argv);
00094 if (cmdLine.displayHelpRequired()){
00095 cout <<"TrainTarget.exe"<<endl<<"This program is used for Adapting a client model from a world model"
00096 <<endl<<cc.getParamList()<<endl;
00097 return 0;
00098 }
00099 if (cmdLine.displayVersionRequired()){
00100 cout <<"Version 2"<<endl;
00101 }
00102 Config tmp;
00103 cmdLine.copyIntoConfig(tmp);
00104 Config config;
00105 if (tmp.existsParam("config")) config.load(tmp.getParam("config"));
00106 cmdLine.copyIntoConfig(config);
00107 cc.check(config);
00108 debug=config.getParam_debug();
00109 if (config.existsParam("verbose"))verbose=config.getParam("verbose").toBool();else verbose=false;
00110 if (verbose) verboseLevel=1;else verboseLevel=0;
00111 if (config.existsParam("verboseLevel"))verboseLevel=config.getParam("verboseLevel").toLong();
00112 if (verboseLevel>0) verbose=true;
00113 bool train=true;
00114 if (config.existsParam("info"))
00115 train=false;
00116 if (train){
00117 if (config.existsParam("byLabelModel"))
00118 TrainTargetByLabel(config);
00119 if (config.existsParam("FactorAnalysis"))
00120 TrainTargetFA(config);
00121 bool JFA = false;
00122 bool LFA = false;
00123 if (config.existsParam("channelCompensation") && (config.getParam("channelCompensation") == "JFA"))
00124 JFA = true;
00125 else if (config.existsParam("channelCompensation") && (config.getParam("channelCompensation") == "LFA"))
00126 LFA=true;
00127 if (JFA) TrainTargetJFA(config);
00128 else if (LFA) TrainTargetLFA(config);
00129 else TrainTarget(config);
00130 }
00131 else InfoTarget(config);
00132
00133 return 0;
00134 }
00135 catch(alize::Exception & e){ cout <<"TrainTarget "<< e.toString() << endl << cc.getParamList()<<endl;}
00136 }
00137
00138