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 "TrainWorld.h"
00058
00059 int main(int argc, char* argv[])
00060 {
00061 ConfigChecker cc;
00062 cc.addIntegerParam("verboseLevel",false,true,"level of the verbose information 0=no verbose, 1=normal, 2=more");
00063 cc.addStringParam("inputFeatureFilename",false, true,"feature filename or filename of a text file with the list of feature filenames");
00064 cc.addStringParam("inputStreamList",false, true,"filename of a text file with the filename of input streams");
00065 cc.addStringParam("weightStreamList",false,true,"filename of a text file with the weight of each input stream - default=equal weights");
00066 cc.addStringParam("outputWorldFilename",true,true,"output worldmodel filename");
00067 cc.addStringParam("inputWorldFilename",false,true,"if set, the init is based on a model get from this file, else frrom scratch");
00068 cc.addStringParam("saveInitModel",false,true,"if set (default), save the initial model");
00069 cc.addStringParam("labelSelectedFrames",true,true,"the segments with this label are used for training the worldmodel");
00070 cc.addFloatParam("baggedFrameProbability",true,true,"defines the % of frames taken for each iterations");
00071 cc.addFloatParam("baggedFrameProbabilityInit",false,true,"NOT LONGER USED IN TRAINWORLD !! deprecated and remplaced by nbFrameToSelect (defines the % of frames taken BY COMPONENT for the initializing of the mixture- mandatory if init from scratch)");
00072 cc.addIntegerParam("nbFrameToSelect",false,true,"Defines the number of frames selected to initialise one component, default=50 ");
00073 cc.addIntegerParam("baggedMinimalLength",false,true,"minimum length for selected segments in bagged (default=3)");
00074 cc.addIntegerParam("baggedMaximalLength",false,true,"maximal length for selected segments in bagged (default=7)");
00075 cc.addFloatParam("initVarianceFlooring",true,true,"variance control parameters - relative to global data variance - initial value (moved during the it)");
00076 cc.addFloatParam("initVarianceCeiling",true,true,"variance control parameters - relative to global data variance - initial value (moved during the it)");
00077 cc.addFloatParam("finalVarianceFlooring",true,true,"variance control parameters - relative to global data variance - final value");
00078 cc.addFloatParam("finalVarianceCeiling",true,true,"variance control parameters - relative to global data variance - final value");
00079 cc.addIntegerParam("nbTrainIt",true,true,"number of it, the ceiling and flooring are moved and the baggedFrameProbability is used");
00080 cc.addBooleanParam("normalizeModel",false,true,"if set to true, normalize the world (at each iteration)");
00081 cc.addBooleanParam("normalizeModelMeanOnly",false,true,"used only if normalizeModel is On, says if only mean parameters should be normalized");
00082 cc.addIntegerParam("normalizeModelNbIt",false,true,"used only if noramlizeModelMeanOnly is set, nb of normalization it");
00083 cc.addBooleanParam("use01",false,true,"if set at true, don't compute the global mean and cov but uses 0 mean and 1 cov");
00084 cc.addBooleanParam("componentReduction",false,true,"if set reduce the number of components at each it, selecting the best weights until targetDistribCount (default false)");
00085 cc.addIntegerParam("targetMixtureDistribCount",false,true,"final number of components if componentReduction is selected");
00086 cc.addIntegerParam("initRand",false,true,"initialisation of the random generator for bagged set of data (default=0)");
00087
00088
00089 try {
00090 CmdLine cmdLine(argc, argv);
00091 if (cmdLine.displayHelpRequired()){
00092 cout <<"TrainWorld.exe"<<endl<<"This program is used for training a world model from scratch or from a model"
00093 <<endl<<cc.getParamList()<<endl;
00094 return 0;
00095 }
00096 if (cmdLine.displayVersionRequired()){
00097 cout <<"Version 2-beta"<<endl;
00098 }
00099 Config tmp;
00100 cmdLine.copyIntoConfig(tmp);
00101 Config config;
00102 if (tmp.existsParam("config")) config.load(tmp.getParam("config"));
00103 cmdLine.copyIntoConfig(config);
00104 cc.check(config);
00105 debug=config.getParam_debug();
00106 if (config.existsParam("verbose"))verbose=config.getParam("verbose").toBool();else verbose=false;
00107 if (verbose) verboseLevel=1;else verboseLevel=0;
00108 if (config.existsParam("verboseLevel"))verboseLevel=config.getParam("verboseLevel").toLong();
00109 if (verboseLevel>0) verbose=true;
00110 trainWorld(config);
00111 }
00112 catch (alize::Exception& e) {cout << e.toString() << endl << cc.getParamList()<< endl;}
00113 return 0;
00114 }