当前位置: 首页>>代码示例>>C++>>正文


C++ ModelManager::getExtraArg方法代码示例

本文整理汇总了C++中ModelManager::getExtraArg方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelManager::getExtraArg方法的具体用法?C++ ModelManager::getExtraArg怎么用?C++ ModelManager::getExtraArg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ModelManager的用法示例。


在下文中一共展示了ModelManager::getExtraArg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(const int argc, const char **argv)
{

  MYLOGVERB = LOG_INFO;
  ModelManager *mgr = new ModelManager("Extract Patches for Hmax with Feature Learning");

  mgr->exportOptions(MC_RECURSE);

  // required arguments
  // <c1patchesDir> <trainPosDir>

  if (mgr->parseCommandLine(
                            (const int)argc, (const char**)argv, "<c1patchesDir> <trainPosDir>", 2, 2) == false)
    return 1;

  // Create a temp HmaxFL object to extract C1Patches
  std::vector<int> c1ScaleSS(2);
  c1ScaleSS[0] = 1; c1ScaleSS[1] = 3;
  std::vector<int> c1SpaceSS(2);
  c1SpaceSS[0] = 10; c1SpaceSS[1] = 11;
  // desired frame sizes [11 and 13]
  HmaxFL hmax(NORI,c1SpaceSS,c1ScaleSS,2,true,1.0F,1.0F,0.3F,4.05F,-0.05F,11,2);

  std::string c1PatchesBaseDir;
  std::string trainPosName; // Directory where positive images are

  c1PatchesBaseDir = mgr->getExtraArg(0);
  trainPosName = mgr->getExtraArg(1);

  // Extract random patches from a set of images in a positive training directory
  std::vector<std::string> trainPos = hmax.readDir(trainPosName);
  int posTrainSize = trainPos.size();

  //Image<byte> inputb;

  Image<float> trainPosImage;

  std::cout << "Scanned training and testing images" << std::endl;

  std::vector<int> pS(4);
  pS[0] = 4; pS[1] = 8, pS[2] = 12; pS[3] = 16;

  std::srand(time(0));
  for(int i=0;i<NUM_PATCHES_PER_SIZE;i++){
    // Randomly select an image from the list
    unsigned int imInd = static_cast<unsigned int>(floor((rand()-1.0F)/RAND_MAX*posTrainSize));
    trainPosImage = Raster::ReadFloat(trainPos[imInd]);
    // Learn the appropriate simple S2 patches from the C1 results
    hmax.extractRandC1Patch(c1PatchesBaseDir,trainPosImage,i,pS);
  }

  std::cout << "Completed extraction of C1 Patches" << std::endl;

  return 0;
}
开发者ID:ulyssesrr,项目名称:carmen_lcad,代码行数:55,代码来源:extractpatches.C


注:本文中的ModelManager::getExtraArg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。