CombinatorialTrainer.hpp
Go to the documentation of this file.
1 
18 #pragma once
19 
20 #include <boost/shared_ptr.hpp>
21 #include <boost/filesystem.hpp>
22 
23 #include <utility/TableHelper.hpp>
26 #include <common_type/Tracks.hpp>
28 #include <common_type/Pattern.hpp>
29 #include <fstream>
30 #include <iostream>
31 #include <string>
32 
33 
35 #include "ObjectRelation.hpp"
36 #include "ImplicitShapeModel.hpp"
37 #include "TestSetGenerator.hpp"
38 
40 #include "Tester.hpp"
41 
43 #include "Topology.hpp"
44 #include "../typedef.hpp"
45 
46 namespace ISM
47 {
48  using boost::filesystem::path;
54 {
55  public:
57 
58  std::map<std::string, std::pair<double, TreePtr> > learn();
59  private:
61 
62  std::vector<std::string> patternNames;
63  //These are the Tracks of ALL patterns in the DB file
64  std::map<std::string, ISM::TracksPtr> objectTracksPerPattern;
65  //These are all objectRelations (a fully connected topology) of each Pattern in the DB file
66  std::map<std::string, ISM::ObjectRelations> allObjectRelationsPerPattern;
67  //contains all relations of objects to themselves
68  std::map<std::string, std::vector<ISM::ObjectRelationPtr> > allSelfRelationsPerPattern;
69  //filepath to the objects models for visualization
70  std::map<std::string, std::map<std::string, boost::filesystem::path> > objectModelsPerPattern;
72  path mDBPath;
73 
75 
76  std::map<std::string, IsmPtr> mFullyMeshedTopologyPerPattern;
77  std::map<std::string, std::vector<TopologyPtr>> mStartTopologiesPerPattern;
78 
79  std::pair<PatternNameToObjectSet, PatternNameToObjectSet> mTestSets;
80 
82 
83  //Get all Tracks of all pattern in the DB file
84  //I.e: Get a table where each entry marks all tracks of all objects in one distinct pattern
85  const std::map<std::string, ISM::TracksPtr> getRecordedObjectsTracks();
86  //Calculate all relations between all objects in the same pattern, for all patterns in the DB file
87  const std::map<std::string, ISM::ObjectRelations> calculateAllObjectRelations();
88  bool containsAllObjects(const ISM::ObjectRelations& topology, const std::string& patternName) const;
89  void drawISM(unsigned ismId, std::string patternName, std::map<std::string, std::vector<VoteSpecifierPtr> > voteSpecifiersPerObject);
91 
92  std::map<std::string, IsmPtr> learnFullyMeshedTopologyPerPattern(bool naive = false);
93  bool checkCorrectOrder(std::map<std::string, ISM::ObjectRelations> allObjectRelationsPerPattern);
94  void storePatternToDB(std::map<std::string, IsmPtr> bestISMPerPattern);
95 
97  const path dbFilePath,
98  const std::string & type);
99 
100  PatternNameToObjectSet loadTestSetsFromDB(std::string fileName);
101 
102  std::pair<PatternNameToObjectSet, PatternNameToObjectSet> createTestSets(double binSize, double maxAngleDeviation,
103  double confidenceThreshold, unsigned int testSetCount);
104 
105  void initTestSets(double binSize, double maxAngleDeviation, double confidenceThreshold,
106  std::string loadValidTestSetsFrom, std::string loadInvalidTestSetsFrom, unsigned int testSetCount);
107 
108  void initStartTopologiesPerPattern(std::string loadStartTopologiesFrom);
109  std::string genTimeString();
110 
111 }; typedef boost::shared_ptr<CombinatorialTrainer> CombinatorialTrainerPtr;
112 
113 }
boost::shared_ptr< TopologyValidationResults > TopologyValidationResultsPtr
void storePatternToDB(std::map< std::string, IsmPtr > bestISMPerPattern)
std::pair< PatternNameToObjectSet, PatternNameToObjectSet > mTestSets
CombinatorialTrainerParameters mParams
std::map< std::string, ISM::ObjectRelations > allObjectRelationsPerPattern
bool checkCorrectOrder(std::map< std::string, ISM::ObjectRelations > allObjectRelationsPerPattern)
std::string patternName
bool containsAllObjects(const ISM::ObjectRelations &topology, const std::string &patternName) const
boost::shared_ptr< TableHelper > TableHelperPtr
std::pair< PatternNameToObjectSet, PatternNameToObjectSet > createTestSets(double binSize, double maxAngleDeviation, double confidenceThreshold, unsigned int testSetCount)
void drawISM(unsigned ismId, std::string patternName, std::map< std::string, std::vector< VoteSpecifierPtr > > voteSpecifiersPerObject)
std::map< std::string, std::map< std::string, boost::filesystem::path > > objectModelsPerPattern
std::map< std::string, std::vector< ObjectSetPtr > > PatternNameToObjectSet
Definition: typedef.hpp:68
void initStartTopologiesPerPattern(std::string loadStartTopologiesFrom)
void storeTestSetsToDB(PatternNameToObjectSet testSet, const path dbFilePath, const std::string &type)
const std::map< std::string, ISM::TracksPtr > getRecordedObjectsTracks()
std::map< unsigned int, ISM::ObjectRelationPtr, std::less< unsigned > > ObjectRelations
std::map< std::string, std::vector< ISM::ObjectRelationPtr > > allSelfRelationsPerPattern
boost::shared_ptr< DocumentationHelper > DocumentationHelperPtr
CombinatorialTrainer(CombinatorialTrainerParameters params)
boost::shared_ptr< CombinatorialTrainer > CombinatorialTrainerPtr
TopologyValidationResultsPtr getValidationResultsForPattern(std::string patternName)
std::map< std::string, std::pair< double, TreePtr > > learn()
void initTestSets(double binSize, double maxAngleDeviation, double confidenceThreshold, std::string loadValidTestSetsFrom, std::string loadInvalidTestSetsFrom, unsigned int testSetCount)
std::map< std::string, std::vector< TopologyPtr > > mStartTopologiesPerPattern
DocumentationHelperPtr mDocumentationHelper
PatternNameToObjectSet loadTestSetsFromDB(std::string fileName)
const std::map< std::string, ISM::ObjectRelations > calculateAllObjectRelations()
std::map< std::string, IsmPtr > mFullyMeshedTopologyPerPattern
std::vector< std::string > patternNames
std::map< std::string, ISM::TracksPtr > objectTracksPerPattern
this namespace contains all generally usable classes.
std::map< std::string, IsmPtr > learnFullyMeshedTopologyPerPattern(bool naive=false)


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