AppearanceTermLearner.cpp
Go to the documentation of this file.
1 
19 
21 
23  : TermLearner()
24  {
25  }
26 
28  {
29  }
30 
32  {
33  // Create the appearance table.
34  pModel->mAppearanceTable.reset(new MappedProbabilityTable());
35 
36  // Create an index of all object types. Use the secure way and iterate over the types of all observations,
37  // not the type information in the node.
38  learnMapping(pModel, pModel->mRoot);
39 
40  // Now initialize the probability table, based on the information gathered before.
41  pModel->mAppearanceTable->initializeTable(pModel->getNumberOfSlots());
42 
43  // Iterate over all the observations of all nodes again and build the table.
44  unsigned int slot = 0;
45  learnTable(pModel, pModel->mRoot, slot);
46 
47  // Normalize the table.
48  pModel->mAppearanceTable->normalize();
49  }
50 
52  {
53  // Iterate over all observations for the given node and create the mapping.
54  BOOST_FOREACH(boost::shared_ptr<ISM::Object> object, pNode->mObjectSet->objects)
55  pModel->mAppearanceTable->add(object->type);
56 
57  // Iterate over all child nodes and make them learn the mapping.
58  BOOST_FOREACH(boost::shared_ptr<OcmTree> child, pNode->mChildren)
59  learnMapping(pModel, child);
60  }
61 
63  {
64  if (pNode->mIsReference) return; // do not consider references for the appearance term, only important for shape
65 
66  // Iterate over all observations for the given node and count
67  BOOST_FOREACH(boost::shared_ptr<ISM::Object> object, pNode->mObjectSet->objects)
68  pModel->mAppearanceTable->add(pSlot, object->type);
69 
70  // Add no additional appearances of the default class (=class for unknown objects).
71  pModel->mAppearanceTable->setDefaultClassCounter(pSlot, 0);
72 
73  // Increment slot number
74  pSlot++;
75 
76  // Make the children do their homework.
77  BOOST_FOREACH(boost::shared_ptr<OcmTree> child, pNode->mChildren)
78  learnTable(pModel, child, pSlot);
79  }
80 
81 }
void learnTable(boost::shared_ptr< OcmModel > pModel, boost::shared_ptr< OcmTree > pNode, unsigned int &pSlot)
void learnMapping(boost::shared_ptr< OcmModel > pModel, boost::shared_ptr< OcmTree > pNode)
void learn(boost::shared_ptr< OcmModel > pModel)


asr_psm
Author(s): Braun Kai, Gehrung Joachim, Heizmann Heinrich, Meißner Pascal
autogenerated on Fri Nov 15 2019 03:57:54