Ejemplo n.º 1
0
void Emulator::execute()
{
	while (!resourcesStream.empty())
	{
		LOG("timestamp: " << timestamp);
		executeStep();
		collectStatistics();
		++ timestamp;
	}
}
Ejemplo n.º 2
0
double ClassifierTester::StartTest(const LandmarkCollectionDataPtr& collection,
                                 const std::string& savedTrainedDataFilePath,
                                 const int numberOfIterations,
                                 bool showSteps)
{
  BOOST_ASSERT(savedTrainedDataFilePath.size() != 0);
  BOOST_ASSERT(collection->CollectionSize() != 0);
  
  m_collection = collection;
  m_savedTrainedDataFilePath = savedTrainedDataFilePath;
  m_showSteps = showSteps;
  m_numberOfIterations = numberOfIterations;
  
  m_detector = DetectorPtr(new Detector(m_savedTrainedDataFilePath));
  
  int i = 0;
  collection->EnumerateConstColectionWithCallback([&] (const ImageLandmarkDataPtr& landmarkData, const int index, bool* stop) {
    
//    std::cout<<index<<std::endl;
    
    const cv::Mat image = landmarkData->ImageSource();
    const cv::Mat landmarks = processImage(image, landmarkData->LandmarksMat());
    if (landmarks.empty())
    {
      i++;
//      std::cout<<"Fail image "<<landmarkData->ImagePath()<<std::endl;
    }
    else
    {
      collectStatistics(landmarks, landmarkData->LandmarksMat());
    }
  });
  
  std::cout<<"Numeber of fail images: "<<i<<std::endl;
  return calculateStatistics();
}