int main(int argc, char* argv[]) {
	ConfigChecker cc;
	try {
		// Needed params
		cc.addStringParam("ndxFilename",true,true,"NDX of multiple GMM speaker recordings");
		cc.addStringParam("inputWorldFilename",true,true,"the world model file");
		cc.addStringParam("saveMatrixFormat",true,true,"matrix format: DB (binary) or DT (ascii)");
		cc.addStringParam("saveMatrixFilesExtension",true,true,"matrix file extension");
		
		

		// Optionnal
		cc.addStringParam("loadMatrixFormat",false,true,"matrix format: DB (binary) or DT (ascii)");
		cc.addStringParam("nullOrderStatSpeaker",false,true,"Name of the Null order speaker stat matrix to store");
		cc.addStringParam("nullOrderStatSession",false,true,"Name of the Null order session stat matrix to store");
		cc.addStringParam("firstOrderStatSpeaker",false,true,"Name of the First order speaker stat matrix to store");
		cc.addStringParam("firstOrderStatSession",false,true,"Name of the First order session stat matrix to store");
		


		// Insertion of config compatibility rules
		CmdLine cmdLine(argc, argv);
		if (cmdLine.displayHelpRequired()){
			cout << "****************************************" << endl;
			cout << "********** ComputeJFAStats.exe ************" << endl;
			cout << "****************************************" << endl;
			cout << endl;
			cout << "Compute sufficient statisitc for Joint Factor Analysis" << endl;
			cout <<endl<<cc.getParamList()<<endl;
			return 0;  
		}
      	if (cmdLine.displayVersionRequired()){
      	  cout <<"Version 2.0 Mistral Package"<<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;		
		if (cmdLine.displayHelpRequired()) {cout << cc.getParamList() << endl;}	
		ComputeJFAStats(config);	
		}
	catch (Exception& e) {cout << e.toString() << cc.getParamList() << endl;}
if (debug) {
}
return 0;
}
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;     
}
Esempio n. 4
0
int main(int argc, char* argv[]){

    ConfigChecker cc;
    cc.addStringParam("config", false, true, "default config filename");
    cc.addIntegerParam("verboseLevel",false,true,"level of the berose 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("targetIdList",true,true,"The file with the list of models to train. A line is composed by client_id file1 file2 ...");
    cc.addStringParam("inputWorldFilename",false,true,"if set, the init is based on a model get from this file, else from scratch");
    cc.addStringParam("labelSelectedFrames",false,true,"The segments with this label are used for training the worldmodel (if UseIdForSelectedFrame is not used)"); 
    cc.addBooleanParam("info",false,false,"If info is requested, just info on the train set is outputed");
    cc.addStringParam("saveVectorFilesPath",true,true,"Directory to store i-vectors after extraction");
	cc.addStringParam("mode",false,true,"Mode of i-vector extraction, classic (default) | ubmWeight | eigenDecomposition");
	cc.addBooleanParam("loadUbmWeightParam",false,true,"If true, load pre-computed parameters for ubmWeight approximation");
	

try{
    CmdLine cmdLine(argc, argv);
    if (cmdLine.displayHelpRequired()){
      cout <<"IvExtractor.exe"<<endl<<"This program is used for extracting i-vectors"
	   <<endl<<cc.getParamList()<<endl;
      return 0;  
    }
    if (cmdLine.displayVersionRequired()){
    cout <<"Version 1.0"<<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;
    bool train=true;                                 				// Training the target models
    if (config.existsParam("info"))                  				// Information on the data available for the targets and output a file with good amount of data
      train=false;

	String mode = "classic";
	if(config.existsParam("mode"))
		mode = config.getParam("mode");
    if (train){
//		if (config.existsParam("byLabelModel"))    					// if the paramter is present, for each client, we train one model for each cluster 
//			TrainTargetByLabel(config);                  			// (a cluster is a set of segments with the same label)
		if(mode == "classic")
			IvExtractor(config); 
		else if(mode == "ubmWeight")
			IvExtractorUbmWeigth(config);
		else if(mode == "eigenDecomposition")
			IvExtractorEigenDecomposition(config);
		else{
			InfoTarget(config);
		}
    }
    else   InfoTarget(config);   
    
    return 0;
  }
  catch(alize::Exception & e){ cout <<"IvExtractor "<< e.toString() << endl << cc.getParamList()<<endl;}
}
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;     
}
Esempio n. 6
0
int main(int argc, char* argv[]) {
	ConfigChecker cc;
	try{
		// Needed params
		cc.addStringParam("ndxFilename",true,true,"NDX of multiple GMM speaker recordings");
		cc.addStringParam("inputWorldFilename",true,true,"the world model file");
		cc.addIntegerParam("nbIt",true,true,"number of ml it");	
		cc.addStringParam("eigenVoiceMatrix",true,true,"filename to save EigenVoice Matrix ");					
		cc.addIntegerParam("eigenVoiceNumber",true,true,"final rank of EigenVoice matrix");	
		cc.addStringParam("saveMatrixFormat",true,true,"matrix format: DB (binary) or DT (ascii)");		  
		cc.addStringParam("loadMatrixFormat",true,true,"matrix format: DB (binary) or DT (ascii)");	
		cc.addStringParam("channelCompensation",true,true,"JFA or IV for memory allocation specificity");	
		

		// Optionnal
		cc.addStringParam("initEigenVoiceMatrix",false,true,"name of the EigenVoice Matrix used for initialisation");
		cc.addBooleanParam("loadInitEigenVoiceMatrix",true,true,"if true load an EigenVoiceMatrix for initialisation");
		cc.addBooleanParam("loadAccs",false,true,"if true do not compute UBM stats, load matrices");
		cc.addBooleanParam("checkLLK",false,true,"if true do compute the likelihood of training data after each iteration");
		cc.addBooleanParam("saveInitEigenVoiceMatrix",false,true,"if true save the matrix used for initialisation");
		cc.addBooleanParam("saveAllEVMatrices",false,true,"if true save the matrices after each iteration");
		cc.addIntegerParam("computeLLK",false,true,"optional: nb of files where LLK is computed");	

		// Insertion of config compatibility rules
		CmdLine cmdLine(argc, argv);

		if (cmdLine.displayHelpRequired()){
			cout << "****************************************" << endl;
			cout << "********** EigenVoice.exe ************" << endl;
			cout << "****************************************" << endl;
			cout << endl;
			cout << "Evaluate EigenVoice Matrix from speakers data" << endl;
			cout <<endl<<cc.getParamList()<<endl;
			return 0;  
		}
		if (cmdLine.displayVersionRequired()){
			cout <<"Version 2.0 Mistral Package"<<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;		
		if (cmdLine.displayHelpRequired()) {cout << cc.getParamList() << endl;}	
		
		
		if(config.getParam("channelCompensation") == "JFA" ){
			EigenVoice(config);
		}
		else{}
	}
	catch (Exception& e) {cout << e.toString() << cc.getParamList() << endl;}
if (debug) {
}
return 0;
}