Scene_model.cpp
Go to the documentation of this file.
1 
18 #include "Scene_model.hpp"
19 
20 //public
21 Scene_model::Scene_model(std::string database)
22 {
23  this->trainer = new ISM::Trainer(database);
24  ISM::DataCollector::setCollect(true);
25  this->trainer->staticBreakRatio = 0.01;
26  this->trainer->togetherRatio = 0.90;
27  this->trainer->maxAngleDeviation = 45;
28  std::cout<<"Begin with training"<<std::endl;
29  this->trainer->trainPattern();
30  std::cout<<"Fetching data"<<std::endl;
31  this->data = ISM::DataCollector::getData();
32  std::cout<<"Converting data to vector representation"<<std::endl;
33  this->dataVector = dataToVector();
34 }
35 
36 std::vector<std::map<std::string, std::string> > Scene_model::dataToVector()
37 {
38  std::vector<std::map<std::string, std::string> > dataVector;
39  std::map<std::string, std::string> topLevelReference;
40  topLevelReference.insert(std::pair<std::string, std::string> ("objectType",
41  data->tracksWithRef.at(0).refTrack->type));
42  topLevelReference.insert(std::pair<std::string, std::string> ("objectId",
43  data->tracksWithRef.at(0).refTrack->observedId));
44  topLevelReference.insert(std::pair<std::string, std::string> ("reference", "None"));
45 
46  std::string referencesReference = "None";
47  for (ISM::TracksWithRef referenceIt : data->tracksWithRef)
48  {
49  std::string reference = referenceIt.refTrack->type;
50  for (ISM::TrackPtr object : referenceIt.tracks->tracks)
51  {
52  std::map<std::string, std::string> dataMap;
53  std::string objectType = object->type;
54  std::string objectId = object->observedId;
55  dataMap.insert(std::pair<std::string, std::string> ("reference", reference));
56  dataMap.insert(std::pair<std::string, std::string> ("objectType", objectType));
57  dataMap.insert(std::pair<std::string, std::string> ("objectId", objectId));
58  dataVector.push_back(dataMap);
59  }
60  }
61  return dataVector;
62 }
63 
65 {
66  //std::vector<TracksWithReference> referenceIt = data->tracksWithReference.begin();
67  for (ISM::TracksWithRef referenceIt : data->tracksWithRef )
68  {
69  std::cout<<"Reference is: "<<referenceIt.refTrack->type<<std::endl;
70  for (ISM::TrackPtr track : referenceIt.tracks->tracks)
71  {
72  std::cout<<"Object's type is: "<<track->type<<" Observed Id is: "<<track->observedId<<std::endl;
73  }
74  }
75 }
76 
78 {
79  for (std::map<std::string, std::string> refIt : dataVector)
80  {
81  std::cout<<"Reference is: "<<refIt.find("reference")->second<<std::endl;
82  std::cout<<"Object's type is: "<<refIt.find("objectType")->second<<" Observed Id is: "
83  <<refIt.find("objectId")->second<<std::endl;
84  }
85 }
86 
87 ISM::CollectedDataPtr Scene_model::getDataCollector()
88 {
89  return data;
90 }
91 
92 std::vector<std::map<std::string, std::string> > Scene_model::getDataVector()
93  {
94  return dataVector;
95  }
96 
97 
98 
ISM::CollectedDataPtr data
Definition: Scene_model.hpp:40
std::vector< std::map< std::string, std::string > > dataVector
Definition: Scene_model.hpp:41
void printData()
Definition: Scene_model.cpp:64
ISM::CollectedDataPtr getDataCollector()
Definition: Scene_model.cpp:87
ISM::Trainer * trainer
Definition: Scene_model.hpp:39
std::vector< std::map< std::string, std::string > > getDataVector()
Definition: Scene_model.cpp:92
Scene_model(std::string database)
Definition: Scene_model.cpp:21
void printDataVector()
Definition: Scene_model.cpp:77
std::vector< std::map< std::string, std::string > > dataToVector()
Definition: Scene_model.cpp:36


asr_relation_graph_generator
Author(s): Meißner Pascal
autogenerated on Fri Nov 15 2019 03:39:19