extractcudacbclpatches.C

00001 #include "CUDA/CudaHmaxCBCL.H"
00002 #include "CUDA/CudaDevices.H"
00003 #include "Component/ModelManager.H"
00004 #include "Util/log.H"
00005 
00006 int main(const int argc, const char **argv)
00007 {
00008   MYLOGVERB = LOG_INFO;
00009   ModelManager *mgr = new ModelManager("Extract Patches for Hmax with Feature Learning");
00010 
00011   mgr->exportOptions(MC_RECURSE);
00012 
00013   // required arguments
00014   // <c1patchesDir> <trainPosDir>
00015 
00016   if (mgr->parseCommandLine(
00017                             (const int)argc, (const char**)argv, "<cudadev> <c0patchesFile> <c1patchesFile> <trainPosDir>", 4, 4) == false)
00018     return 1;
00019   int dev = strtol(mgr->getExtraArg(0).c_str(),NULL,0);
00020   CudaDevices::setCurrentDevice(dev);
00021 
00022   std::string c0PatchesFile;
00023   std::string c1PatchesFile;
00024   std::string trainPosName; // Directory where positive images are
00025   c0PatchesFile = mgr->getExtraArg(1);
00026   c1PatchesFile = mgr->getExtraArg(2);
00027   trainPosName = mgr->getExtraArg(3);
00028 
00029   CudaHmaxCBCL hmax;
00030   hmax.loadC0(c0PatchesFile);
00031 
00032   // Extract random patches from a set of images in a positive training directory
00033   std::vector<std::string> trainPos = hmax.readDir(trainPosName);
00034 
00035   hmax.extractC1Patches(trainPos,250,4,4);
00036   hmax.writeOutC1Patches(c1PatchesFile);
00037   return 0;
00038 
00039 
00040 }
Generated on Sun May 8 08:04:44 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3