Definition at line 54 of file mainImSet.cpp. References Impala::Core::ImageSet::InterestPointProc::AddCmdOptions(), Impala::Core::ImageSet::Walker::AddListener(), Impala::CmdOptions::AddOption(), Impala::Core::ImageSet::Walker::DoWalk(), Impala::Core::ImageSet::Walker::DoWalkBookmarks(), Impala::FileNameExt(), Impala::CmdOptions::GetArg(), Impala::CmdOptions::GetBool(), Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetInt(), Impala::CmdOptions::GetNrArg(), ILOG_ERROR, ILOG_ERROR_COUNT, ILOG_INFO, ILOG_VAR, Impala::CmdOptions::Initialise(), Impala::Core::ImageSet::Walker::LoadBookmarks(), Impala::Core::ImageSet::MakeImageSet(), Impala::Core::Database::RawDataSet::NrDirs(), Impala::Core::ImageSet::Walker::NrListeners(), Impala::CmdOptions::ParseArgs(), and Impala::Core::ImageSet::ImageSet::SetImageSrc(). Referenced by main(). 00055 { 00056 Link::Mpi::Init(&argc, &argv); 00057 00058 CmdOptions& options = CmdOptions::GetInstance(); 00059 options.Initialise(false, false, true); 00060 options.AddOption(0, "report", "perNr", "0"); 00061 options.AddOption(0, "startDir", "idx", "0"); 00062 options.AddOption(0, "numberDirs", "nr", "-1"); 00063 options.AddOption(0, "startFile", "idx", "0"); 00064 options.AddOption(0, "numberFiles", "nr", "-1"); 00065 options.AddOption(0, "virtualWalk", "", "0"); 00066 options.AddOption(0, "imArchive", "", "0"); 00067 options.AddOption(0, "imFileArchive", "", "0"); 00068 options.AddOption(0, "imSplitArchive", "", "0"); 00069 options.AddOption(0, "imCacheSize", "size", "128"); 00070 options.AddOption(0, "precomputed", "[applyconcepts only] boolean: if 1 modelfiles must be for precomputed kernel", "0"); 00071 options.AddOption(0, "storeKernelData", "[applyconcepts only] boolean: if 1 kernel data will be written to disk", "0"); 00072 options.AddOption(0, "addToName", "[fixsizes only] string: add this to the standard filename of archive", ""); 00073 00074 // initialization of options 00075 #ifndef REPOSITORY_TODO 00076 Impala::Core::ImageSet::InterestPointProc::AddCmdOptions(); 00077 #endif 00078 00079 String usageStr = String("cmd imageSet|ixs\n") + 00080 "cmd == fixsizes --> imset fixsizes imageSet [max-width max-height [split]]\n" + 00081 "other commands are undocumented..." + 00082 "\n\n"; 00083 if (! options.ParseArgs(argc, argv, usageStr, 2)) 00084 { 00085 Link::Mpi::Finalize(); 00086 return 1; 00087 } 00088 00089 ILOG_VAR(Impala.Application.ImSet.mainImSet); 00090 00091 String cmd = options.GetArg(0); 00092 String fileName = options.GetArg(1); 00093 ImageSet* imageSet = MakeImageSet(fileName); 00094 imageSet->SetImageSrc(options.GetBool("imArchive"), 00095 options.GetBool("imFileArchive"), 00096 options.GetBool("imSplitArchive")); 00097 00098 Walker walker(imageSet); 00099 Reporter* reporter = new Reporter(0); 00100 walker.AddListener(reporter); 00101 00102 ILOG_INFO("imset command : " << cmd); 00103 00104 #ifndef REPOSITORY_TODO 00105 if (cmd == "computekerneldata") 00106 walker.AddListener(new ComputeKernelData(reporter, options, imageSet)); 00107 if (cmd == "applyconcepts") 00108 walker.AddListener(new ApplyConcepts(reporter, options, imageSet)); 00109 if (cmd == "indexconcepts") 00110 walker.AddListener(new IndexConcepts(reporter, options)); 00111 if (cmd == "combineconcepts") 00112 walker.AddListener(new CombineConcepts(reporter, options)); 00113 #endif 00114 if (cmd == "archive") 00115 walker.AddListener(new Archive(reporter, options)); 00116 if (cmd == "fixsizes") 00117 walker.AddListener(new FixSizes(reporter, options)); 00118 if (cmd == "checksizes") 00119 walker.AddListener(new CheckSizes(reporter, options)); 00120 if (cmd == "concatfeatures") 00121 walker.AddListener(new ConcatFeatures(reporter, options)); 00122 if (cmd == "indexfeatures") 00123 walker.AddListener(new IndexFeatures(reporter, options)); 00124 #ifndef REPOSITORY_TODO 00125 if (cmd == "interestpointproc") 00126 walker.AddListener(new InterestPointProc(reporter, options)); 00127 if (cmd == "makequidlookup") 00128 walker.AddListener(new MakeQuidLookup(reporter, options)); 00129 #endif 00130 if (cmd == "thumbnails") 00131 walker.AddListener(new Thumbnails(reporter, options)); 00132 if (cmd == "clusterfeatures") 00133 { 00134 if (options.GetNrArg() < 4) 00135 ILOG_ERROR("cluster: missing argument"); 00136 String feature = options.GetArg(2); 00137 Computor* c = 0; 00138 if (feature == "weibull") 00139 c = new VisSem("vissem", options); 00140 if (feature == "gabor") 00141 c = new Core::Feature::VisSem("vissemgabor", options); 00142 String clusteror = options.GetArg(3); 00143 walker.AddListener(new ClusterFeatures(c, clusteror, reporter, options)); 00144 } 00145 00146 if (cmd == "viseval") 00147 { 00148 Computor* c = new Core::Feature::VisSem("vissem", options); 00149 walker.AddListener(new ProtoSimilarityEval(c, reporter, options)); 00150 } 00151 if (cmd == "visgaboreval") 00152 { 00153 Computor* c = new Core::Feature::VisSem("vissemgabor", options); 00154 walker.AddListener(new ProtoSimilarityEval(c, reporter,options)); 00155 } 00156 00157 if ((walker.NrListeners() == 1) && (cmd != "nop")) 00158 { 00159 ILOG_ERROR("Unknow command : " << cmd); 00160 Link::Mpi::Finalize(); 00161 return 1; 00162 } 00163 00164 walker.AddListener(new Reporter(reporter)); 00165 if (FileNameExt(fileName) == "ixs") 00166 { 00167 walker.LoadBookmarks(fileName); 00168 walker.DoWalkBookmarks(); 00169 } 00170 else 00171 { 00172 int startDir = options.GetInt("startDir"); 00173 int numberDirs = options.GetInt("numberDirs"); 00174 #ifdef MPI_USED 00175 int numProcs = Link::Mpi::NrProcs(); 00176 int myId = Link::Mpi::MyId(); 00177 if (numberDirs == -1) 00178 numberDirs = imageSet->NrDirs(); 00179 if (startDir + numberDirs >= imageSet->NrDirs()) 00180 numberDirs = imageSet->NrDirs() - startDir; 00181 int lastDir = startDir + numberDirs; 00182 int taskSize = numberDirs / numProcs; 00183 int restSize = numberDirs % numProcs; 00184 int curDir = startDir; 00185 for (int i=0 ; i<=myId ; i++) 00186 { 00187 startDir = curDir; 00188 numberDirs = taskSize; 00189 if (--restSize >= 0) 00190 numberDirs++; 00191 if (startDir + numberDirs > lastDir) 00192 numberDirs = lastDir - startDir; 00193 curDir += numberDirs; 00194 } 00195 ILOG_INFO("Process " << myId << " of " << numProcs 00196 << " is doing dirs " << startDir << " till " 00197 << startDir + numberDirs); 00198 #endif 00199 walker.DoWalk(startDir, numberDirs); 00200 } 00201 reporter->FinalReport(); 00202 int nrOfErrors = ILOG_ERROR_COUNT; 00203 00204 nrOfErrors = Link::Mpi::ReduceSum(nrOfErrors); 00205 ILOG_INFO_ONCE("Root: total nr error = " << nrOfErrors); 00206 Link::Mpi::Finalize(); 00207 00208 return nrOfErrors; 00209 }
Here is the call graph for this function:
|