Definition at line 115 of file mainTrainModel.cpp. References Impala::CmdOptions::AddOption(), Impala::Core::DataFactory::GetDistributedAccess(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetString(), ILOG_VAR, Impala::CmdOptions::Initialise(), main(), Impala::Core::ApplicationFactory::MakeClassifierProperties(), Impala::Core::ApplicationFactory::MakeDataFactory(), Impala::Core::ApplicationFactory::MakeTrainFactory(), Impala::CmdOptions::ParseArgs(), Impala::Core::DataFactory::ServeDistributedAccess(), and TrainModel(). Referenced by main(). 00116 { 00117 ILOG_VAR(main); 00118 Link::Mpi::Init(&argc, &argv); 00119 CmdOptions& options = CmdOptions::GetInstance(); 00120 options.Initialise(false, false, true); 00121 options.AddOption(0, "assume-shotid", "bool", "0"); 00122 options.AddOption('m', "cache", "megabytes", "500"); 00123 options.AddOption(0, "start", "index of concept to start with", "0"); 00124 options.AddOption(0, "number", "number of concepts", "-1"); 00125 options.AddOption(0, "concept", "name", ""); 00126 options.AddOption(0, "kernel", "string: [linear,poly,rbf,sigmoid,precomputed,hist,dist-precomputed]", "rbf"); 00127 options.AddOption(0, "maxVideoId", "index", "-1"); 00128 options.AddOption(0, "maxPosPerVideo", "number", "-1"); 00129 options.AddOption(0, "maxNegPerVideo", "number", "-1"); 00130 // prevent dataserver from keeping all ImageArchives open 00131 options.AddOption(0, "imCacheSize", "size", "1"); 00132 00133 if (! options.ParseArgs(argc, argv, "dataSet concepts model featureDef", 4)) 00134 { 00135 Link::Mpi::Finalize(); 00136 return 1; 00137 } 00138 00139 ApplicationFactory factory(&options); 00140 Util::PropertySet* properties = factory.MakeClassifierProperties(); 00141 Training::Factory* trainFactory = factory.MakeTrainFactory(properties); 00142 DataFactory* dataFactory = factory.MakeDataFactory(); 00143 /* when we use a distributed kernel matix we assume that node 0 does 00144 computation while other nodes load the distributed kernel matrix */ 00145 00146 int retval = 0; 00147 bool dist = (options.GetString("kernel") == "dist-precomputed"); 00148 if(dist && Link::Mpi::MyId() != 0) 00149 { 00150 dataFactory->ServeDistributedAccess(); 00151 } 00152 else 00153 { 00154 // make sure we subscribe, even if we are skipping all concepts; 00155 // otherwise the program will hang 00156 if(options.GetString("kernel") == "dist-precomputed") 00157 dataFactory->GetDistributedAccess(); 00158 retval = TrainModel(trainFactory, dataFactory, dist); 00159 } 00160 00161 ILOG_DEBUG_ONCE("deleting factories and props"); 00162 delete dataFactory; 00163 delete trainFactory; 00164 delete properties; 00165 Link::Mpi::Finalize(); 00166 return retval; 00167 }
Here is the call graph for this function:
|