ObjectSetValidator.cpp
Go to the documentation of this file.
1 
18 #include "ObjectSetValidator.hpp"
19 #include "utility/LogHelper.hpp"
20 #include "boost/functional/hash.hpp"
21 
22 #include <ctime>
23 #include <sys/time.h>
24 #include <chrono>
25 
26 namespace ISM {
27 
28  std::pair<bool, double> ObjectSetValidator::isSetValid(const ObjectSetPtr &testSet,
29  const std::string &patternName)
30  {
31  struct timeval start;
32  struct timeval end;
33 
34  gettimeofday(&start, NULL);
35  std::vector<RecognitionResultPtr> results = mRecognizer->recognizePattern(testSet);
36  gettimeofday(&end, NULL);
37 
38  double recognitionRuntime, seconds, useconds;
39  seconds = end.tv_sec - start.tv_sec;
40  useconds = end.tv_usec - start.tv_usec;
41  recognitionRuntime = seconds + useconds / 1000000;
42 
43  for (size_t i = 0; i < results.size(); ++i)
44  {
45  if (results[i]->patternName == patternName)
46  {
47  bool isValid = results[i]->confidence >= mConfidenceThreshold;
48  return std::make_pair(isValid, recognitionRuntime);
49  }
50  }
51 
52  return std::make_pair(false, recognitionRuntime);
53  }
54 
56  {
57  this->mRecognizer->clearData();
58  this->mRecognizer->setVoteSpecifiersPerObject(ism->voteSpecifiersPerObject);
59  this->mRecognizer->setObjectTypes(ism->objectTypes);
60  this->mRecognizer->setPatternDefinitions(ism->patternDefinitions);
61  this->mRecognizer->arrangePatternsAccordingToTreeHeight();
62  }
63 }
ISM::RecognizerPtr mRecognizer
std::string patternName
boost::shared_ptr< ImplicitShapeModel > IsmPtr
std::pair< bool, double > isSetValid(const ObjectSetPtr &testSet, const std::string &patternName)
boost::shared_ptr< ObjectSet > ObjectSetPtr
Definition: ObjectSet.hpp:53
this namespace contains all generally usable classes.
void setISM(const IsmPtr ism)


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:40