int main(int argc, char* argv[]) { using namespace std; using namespace alize; ConfigChecker cc; cc.addStringParam("config",false, true,"default config file"); cc.addStringParam("saveLabelFileExtension",true, true,"produced labelFiles extension"); cc.addStringParam("labelOutputPath",false,true,"path where to store produced labelFiles"); cc.addStringParam("labelInputPath",false,true,"path where to load original labelFiles"); cc.addIntegerParam("winLength",false,true,"window of the morphological filter in frames"); cc.addFloatParam("selectThreshold",false,true,"applying filter when selected/unselected matches this threshold"); cc.addStringParam("mode",false,true,"decide the mode: fusion(2 files) or morphing (one file) default=fusion"); cc.addStringParam("labelOneFilename",false,true,"if fusion is selected, name of the first feature file"); cc.addStringParam("labelTwoFilename",false,true,"if fusion is selected, name of the second feature file"); cc.addStringParam("labelFilename",false,true,"if morphing is selected, name of the feature file"); try { CmdLine cmdLine(argc, argv); if (cmdLine.displayHelpRequired()){ cout <<"LabelFusion.exe"<<endl<<"This program is used to merge labelFiles and to apply a morphological window" <<endl<<cc.getParamList()<<endl; return 0; } if (cmdLine.displayVersionRequired()){ cout <<"Version 2-beta"<<endl; } Config tmp; cmdLine.copyIntoConfig(tmp); Config config; if (tmp.existsParam("config")) config.load(tmp.getParam("config")); cmdLine.copyIntoConfig(config); cc.check(config); debug=config.getParam_debug(); if (config.existsParam("verbose"))verbose=config.getParam("verbose").toBool();else verbose=false; bool fusion=true; if (config.existsParam("mode")) fusion=(config.getParam("mode")=="fusion"); if (fusion) labelFusion(config); else labelMorphing(config); } catch (alize::Exception & e) {cout << e.toString () << endl << cc.getParamList() << endl;} return 0; }
int main(int argc, char* argv[]){ using namespace std; using namespace alize; ConfigChecker cc; cc.addStringParam("config",true,true,"defines the default config filename"); cc.addFloatParam("frameLength",true,true,"defines length of a frame (default=10ms)"); cc.addIntegerParam("nbTrainIt",false,true,"defines the number of it, the ceiling and flooring are moved and the baggedFrameProbability is used"); cc.addFloatParam("baggedFrameProbabilityInit",false,true,"defines the % of frames taken by component for the initializing of the mixture - mandatory if init from scratch"); cc.addFloatParam("baggedFrameProbability",true,true,"defines the % of frames taken for each iterations"); cc.addFloatParam("initVarianceFlooring",true,true,"defines the variance control parameters - relative to global data variance - initial value (moved during the it)"); cc.addFloatParam("initVarianceCeiling",true,true,"defines the variance control parameters - relative to global data variance - initial value (moved during the it)"); cc.addFloatParam("finalVarianceFlooring",true,true,"defines the variance control parameters - relative to global data variance - final value"); cc.addFloatParam("finalVarianceCeiling",true,true,"defines the variance control parameters - relative to global data variance - final value"); // For the MAP Algorithm cc.addStringParam("MAPAlgo",true,true,"defines the adaptation method (MAPConst,MAPConst2,MAPOccDep,MLLR)"); cc.addBooleanParam("meanAdapt",false,true,"if set to true, the gaussians means are adapted"); cc.addBooleanParam("varAdapt",false,true,"if set to true, the gaussians variances are adapted"); cc.addBooleanParam("weightAdapt",false,true,"if set to true, the gaussians weights are adapted"); cc.addFloatParam("MAPAlphaMean",false,true,"defines the value alpha for the adaptation of the means for MAP (MAPConst, MAPConst2)"); cc.addFloatParam("MAPAlphaVar",false,true,"defines the value alpha for the adaptation of the variances for MAP (MAPConst, MAPConst2)"); cc.addFloatParam("MAPAlphaWeight",false,true,"defines the value alpha for the adaptation of the weights for MAP (MAPConst, MAPConst2)"); cc.addFloatParam("MAPRegFactorMean",false,true,"defines the value alpha for the adaptation of the means for MAP (MAPOccDep, MAPModelBased, MLLR)"); cc.addFloatParam("MAPRegFactorVar",false,true,"defines the value alpha for the adaptation of the variances for MAP (MAPOccDep, MAPModelBased, MLLR)"); cc.addFloatParam("MAPRegFactorWeight",false,true,"defines the value alpha for the adaptation of the weights for MAP (MAPOccDep, MAPModelBased, MLLR)"); cc.addBooleanParam("normalizeModel",false,true,"if set to true, normalize the model (at each iteration)"); cc.addBooleanParam("normalizeModelMeanOnly",false,true,"if set to true, normalize only the means of the model"); cc.addIntegerParam("normalizeModelNbIt",false,true,"defines the number of it (only if normalizeModelMeanOnly is set to true)"); // cc.addBooleanParam("normalizeClient",false,true,"if set to true, normalize the client (at each iteration)"); cc.addStringParam("labelFilesPath",false,true,"defines the path where to load original labelFiles"); cc.addStringParam("labelFilesExtension",false,true,"defines the extension to load original labelFiles"); // cc.addStringParam("labelSelectedFrames",false,true,"only the frames from segments with this label will be used"); // For the Segmentation Algorithm cc.addStringParam("listFileToSegment",true,true,"defines the list of the files to segment"); cc.addStringParam("outputFilesPath",true,true,"defines the path where will be to store the produced files"); cc.addStringParam("fileRefPath",false,true,"defines the path of the reference files"); cc.addFloatParam("decodingEpsilon",false,true,"defines the value epsilon for the decoding"); // cc.addStringParam("musicLabel",false,true,"label for the segments of music (default=M)"); // cc.addBooleanParam("aggregateSegment",false,false,"if set to true, aggregate segments after each class"); cc.addIntegerParam("iterationNb",false,true,"number of iterations for decoding adaptation pass (default=10)"); cc.addStringParam("transitionMethod",true,true,"defines the method used to calculate the transitions (Equiprob,RapConst,Unity,SpeakerTime)"); cc.addFloatParam("gammaTransition",true,true,"defines the value gamma for the transitions method"); cc.addFloatParam("fudge",false,true,"defines the value fudge for the Viterbi algorithm"); cc.addIntegerParam("viterbiBufferLength",true,true,"defines the size of the buffer for the Viterbi algorithm"); // cc.addIntegerParam("classNb",true,true,"number of classes"); // cc.addIntegerParam("selectionLength",true,true,"defines the length of selection"); // Only for Segmentation // cc.addStringParam("saveSegServerFileFormat",true,true,"defines the save format of the SegServer file"); cc.addStringParam("selectionMethod",false,true,"defines a selection mathod : firstSegmentFound (default), firstLimitedLengthSegmentFound, longestSegmentFound, longestLimitedLengthSegmentFound"); cc.addIntegerParam("selectionLength",true,true,"defines the minimum size of the segment selected according to the selectionMethod"); cc.addIntegerParam("limitedLength",true,true,"defines the maximum size of the segment selected according to the selectionMethod. This parameter is necessary for both firstLimitedLengthSegmentFound and longestLimitedLengthSegmentFound selection methods"); cc.addIntegerParam("speakerMinTime",true,true,"defines a minimal length of speech to fix the relevancy of a new speaker"); cc.addIntegerParam("limitSpeaker",false,true,"defines the maximal number of segments by file (default=99999)"); cc.addStringParam("trainAlgo",false,true,"defines the method of training of the models : MAP or EM (default)"); cc.addStringParam("testAlgo",false,true,"defines the method of decoding : Viterbi (default)"); // cc.addBooleanParam("loadWorldFromExternalFile",false,true,"if set to true, load the model defined by the parameter worldModel, otherwise, compute a world model directly from the targeted signal"); // cc.addStringParam("worldModel",false,true,"defines the filename of the world model)"); try { CmdLine cmdLine(argc, argv); if (cmdLine.displayHelpRequired()){ cout << "******************************" << endl; cout << "********* Segmentation *******" << endl; cout << "******************************" << endl; cout << endl; cout << "This program is used to perform spreakers segmentation and clustering" << endl; cout << "" << endl; cout << cc.getParamList()<<endl; return 0; } if (cmdLine.displayVersionRequired()){ cout << "Segmentation - Version 2" << endl; return 0; } Config tmp; cmdLine.copyIntoConfig(tmp); Config config; if (tmp.existsParam("config")) config.load(tmp.getParam("config")); cmdLine.copyIntoConfig(config); cc.check(config); debug=config.getParam_debug(); if (config.existsParam("verbose")) verbose=config.getParam("verbose").toBool(); else verbose=false; if (verbose) verboseLevel=1; else verboseLevel=0; if (config.existsParam("verboseLevel")) verboseLevel=config.getParam("verboseLevel").toLong(); if (verboseLevel>0) verbose=true; launchSegmentationProcess(config); } catch (alize::Exception& e) { cout << e.toString() << endl << cc.getParamList() << endl; } return 0; }
int main(int argc, char *argv[]) { try { ConfigChecker cc; cc.addIntegerParam("verboseLevel", false, true, "level of the verbose information 0=no verbose, 1=normal, 2=more"); cc.addStringParam("config", OPTIONAL, ARG_REQUIRED, "Train config file name "); cc.addStringParam("configTest", OPTIONAL, ARG_REQUIRED, "Unsupervised adaptation config file name "); cc.addStringParam("targetIdList", MANDATORY, ARG_REQUIRED, "targets list"); cc.addStringParam("inputWorldFilename", MANDATORY, ARG_REQUIRED, "world model"); cc.addStringParam("testsIdList", MANDATORY, ARG_REQUIRED, "tests list"); cc.addBooleanParam("NISTprotocol", MANDATORY, ARG_REQUIRED, "true to follow unsupervised NIST protocol, false to follow BATCH protocol"); cc.addBooleanParam("WMAP", false, false, "NO MORE USED, Choice of WMAP (one Gaussian) to compute trial feature server weights, need other param : MUtarget,MUimp,SIGMAtarget and SIGMAIMP;TAR weight and IMPweight, thrMin and thrMax"); cc.addBooleanParam("WMAPGMM", false, false, "Choice of WMAP GMM to compute trial feature server weights, param needed : two gmm of scores, TARScoresModel and NONScoresModel. Need also a value for Priors update, initPriorImp (10) and initPriorTar(1) "); cc.addBooleanParam("TNORM", false, false, " TNORM scores before computing WMAP, need gmm of Tnormed scores and a param : impScoreFile, score file for TNORM and testsNames, the list of trial segments "); cc.addBooleanParam("FAST", false, false, "FAST MODE : For computing LLR use top ten info files AND FOR FUSING EM MODELS WHEN UPDATING"); cc.addBooleanParam("FromResFile", false, false, " Avoid to compute LLR for WMAP computing, search LLR in a score file, param needed: InputResFilename"); cc.addBooleanParam("CrossValid", false, false, " compute LLR of a percentage of train data on a model learnt on a percentage of train data AverageIt times and return the best ML (one iter) model, need AverageIt, SelectedTrain."); cc.addBooleanParam("Oracle", false, false, " For Oracle (supervised) experiments, need targetTests to perform adaptation on target tests only"); cc.addBooleanParam("REGRESS", false, false, "Use logistic regression for adaptation weights computing, need BETA and THETA"); cc.addIntegerParam("MaxMixturesCount", false, true, "max mixtures stored in the mixture server (in memory)"); cc.addIntegerParam("LLKthreshold", false, true, "thresholds the results of LLR in order to avoid problem in WMAP computing"); cc.addStringParam("computeLLKWithTopDistribs", true, true, "PARTIAL/COMPLETE: will compute LLK with topdistribs. COMPLETE: add world LLK to client LLK, PARTIAL: just keeps the topDistrib LLK"); cc.addIntegerParam("topDistribsCount ", false, true, "Number of distrib to approximate complete LLK"); cc.addStringParam("InfoExtension", false, true, "Extension for top ten info files"); cc.addStringParam("InfoPath", false, true, "Path for top ten info files"); cc.addFloatParam("OptimalScore", false, true, "Used for updating priors (fixedPriors == false), if LLR is superior add one for target count, else add one for impostors count "); cc.addBooleanParam("SegMode", MANDATORY, ARG_REQUIRED, "For adaptation by segments (for the moment support only 3 frame segments)"); cc.addIntegerParam("mixtureDistribCountForGMMScores", false, true, "NUMBER OF GAUSSIAN IN SCORES GMM"); cc.addBooleanParam("ScoresByTarget", MANDATORY, ARG_REQUIRED," IF SET TO TRUE TWO GMM (TAR AND NON) ARE NEEDED BY CLIENT (idcinet.tar and idclient.non)"); cc.addStringParam("TARListFilename", false, true, "List of the TAR model id (used when ScoresByTarget is set to true)"); cc.addIntegerParam("ResetNbAdapt ", false, true, "Max number of tests used for adaptation"); Config tmp; CmdLine cmdLine(argc, argv); if (cmdLine.displayHelpRequired()) { // --help cout << "************************************" << endl; cout << "********** SpkAdapt.exe *********" << endl; cout << "************************************" << endl; cout << endl; cout << "Unsupervised adaptation process, update model using test trial information following NIST protocol" << endl; cout << "" << endl; cout << endl; cout << "Command Line example: " << endl; cout << "SpkAdapt.exe --config cfg/TrainTarget.cfg --configTest cfg/TrainTest.cfg --inputWorldFilename world --targetIdList ./lst/id.lst --testsIdList ./lst/tests.list --outputLLRFilename file --NISTprotocol true" << endl; cout << cc.getParamList() << endl; } else { cmdLine.copyIntoConfig(tmp); Config config(tmp.getParam("config")); cmdLine.copyIntoConfig(config); Config configTest(tmp.getParam("configTest")); if (config.existsParam("verbose")) verbose = config.getParam("verbose").toBool(); else verbose = false; bool segmode=false; if (config.existsParam("SegMode")) segmode = config.getParam("SegMode").toBool(); if (verbose) verboseLevel = 1; else verboseLevel = 0; if (config.existsParam("verboseLevel")) verboseLevel = config.getParam("verboseLevel").toLong(); if (verboseLevel > 0) verbose = true; TrainTargetAdapt(config, configTest); // Launch process } } catch(alize::Exception & e) { cout << e.toString() << endl; } return 0; }
jint Java_com_example_VoiceRecognize_VoiceRecognize_TrainWorld1(JNIEnv* env, jobject thiz, jstring jfilename) { const char *nativefilename = env->GetStringUTFChars(jfilename,0); ConfigChecker cc; cc.addIntegerParam("verboseLevel",false,true,"level of the verbose information 0=no verbose, 1=normal, 2=more"); cc.addStringParam("inputFeatureFilename",false, true,"feature filename or filename of a text file with the list of feature filenames"); cc.addStringParam("inputStreamList",false, true,"filename of a text file with the filename of input streams"); cc.addStringParam("weightStreamList",false,true,"filename of a text file with the weight of each input stream - default=equal weights"); cc.addStringParam("outputWorldFilename",true,true,"output worldmodel filename"); cc.addStringParam("inputWorldFilename",false,true,"if set, the init is based on a model get from this file, else frrom scratch"); cc.addStringParam("saveInitModel",false,true,"if set (default), save the initial model"); cc.addStringParam("labelSelectedFrames",true,true,"the segments with this label are used for training the worldmodel"); cc.addFloatParam("baggedFrameProbability",true,true,"defines the % of frames taken for each iterations"); 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)"); cc.addIntegerParam("nbFrameToSelect",false,true,"Defines the number of frames selected to initialise one component, default=50 "); cc.addIntegerParam("baggedMinimalLength",false,true,"minimum length for selected segments in bagged (default=3)"); cc.addIntegerParam("baggedMaximalLength",false,true,"maximal length for selected segments in bagged (default=7)"); cc.addFloatParam("initVarianceFlooring",true,true,"variance control parameters - relative to global data variance - initial value (moved during the it)"); cc.addFloatParam("initVarianceCeiling",true,true,"variance control parameters - relative to global data variance - initial value (moved during the it)"); cc.addFloatParam("finalVarianceFlooring",true,true,"variance control parameters - relative to global data variance - final value"); cc.addFloatParam("finalVarianceCeiling",true,true,"variance control parameters - relative to global data variance - final value"); cc.addIntegerParam("nbTrainIt",true,true,"number of it, the ceiling and flooring are moved and the baggedFrameProbability is used"); cc.addBooleanParam("normalizeModel",false,true,"if set to true, normalize the world (at each iteration)"); cc.addBooleanParam("normalizeModelMeanOnly",false,true,"used only if normalizeModel is On, says if only mean parameters should be normalized"); cc.addIntegerParam("normalizeModelNbIt",false,true,"used only if noramlizeModelMeanOnly is set, nb of normalization it"); cc.addBooleanParam("use01",false,true,"if set at true, don't compute the global mean and cov but uses 0 mean and 1 cov"); cc.addBooleanParam("componentReduction",false,true,"if set reduce the number of components at each it, selecting the best weights until targetDistribCount (default false)"); cc.addIntegerParam("targetMixtureDistribCount",false,true,"final number of components if componentReduction is selected"); cc.addIntegerParam("initRand",false,true,"initialisation of the random generator for bagged set of data (default=0)"); cout << "++++++++++++++++++++++++++++++++++++++++" << endl; int argc=3; char* argv[3]; argv[0]=new char[3]; strcpy(argv[0],"TW"); argv[1]=new char[9]; strcpy(argv[1],"--config"); argv[2]=new char[strlen(nativefilename)+1]; strcpy(argv[2], nativefilename); try { CmdLine cmdLine(argc, argv); //Now free the array int i; for(i=0;i<argc;i++) delete [] argv[i]; env->ReleaseStringUTFChars(jfilename, nativefilename); cout << "+++++++++++++++++++++++++++++++++++++++++" << endl; if (cmdLine.displayHelpRequired()){ cout <<"TrainWorld.exe"<<endl<<"This program is used for training a world model from scratch or from a model" <<endl<<cc.getParamList()<<endl; return 0; } if (cmdLine.displayVersionRequired()){ cout <<"Version 2-beta"<<endl; } Config tmp; cmdLine.copyIntoConfig(tmp); Config config; if (tmp.existsParam("config")) config.load(tmp.getParam("config")); cmdLine.copyIntoConfig(config); cc.check(config); debug=config.getParam_debug(); if (config.existsParam("verbose"))verbose=config.getParam("verbose").toBool();else verbose=false; if (verbose) verboseLevel=1;else verboseLevel=0; if (config.existsParam("verboseLevel"))verboseLevel=config.getParam("verboseLevel").toLong(); if (verboseLevel>0) verbose=true; trainWorld(config); } catch (alize::Exception& e) {cout << e.toString() << endl << cc.getParamList()<< endl;} return 0; }