Class LearnNodeWeights<Point>


public class LearnNodeWeights<Point> extends Object
Learns node weights in the HierarchicalVocabularyTree for use in RecognitionVocabularyTreeNister2006 by counting the number of unique images a specific node/word appears in then computes the weight using an entropy like cost function. Functions must be called in a specific order:
  1. reset(boofcv.alg.scene.vocabtree.HierarchicalVocabularyTree<Point>)
  2. addImage(java.util.List<Point>)
  3. fixate()
Each image used to train the tree should have it's descriptors passed in to addImage(java.util.List<Point>).
  • Field Details

    • tree

      Tree which has been learned already but with unspecified weights
    • maximumNumberImagesInNode

      public ConfigLength maximumNumberImagesInNode
      If a node has more than this number of images passing through it, it's weight is set to 0. The idea being that there is little information gained by considering this node, but it adds significantly to the cost of searching the tree as many images now need to be considered.
    • checkEveryNodeSeenOnce

      public boolean checkEveryNodeSeenOnce
      Sanity check. If true it will make sure every node is observed by an image. This is true when the training set and the set of images passed into this are the same. This is set to false by default because in rare situations floating point noise can cause a false positive.
  • Constructor Details

    • LearnNodeWeights

      public LearnNodeWeights()
  • Method Details

    • reset

      public void reset(HierarchicalVocabularyTree<Point> tree)
      Initializes and resets with a new tree. Reference to the passed in tree is saved.
    • addImage

      public void addImage(List<Point> descriptors)
      Adds a new image to the weight computation. It's highly recommended that the same images used to train the tree be added here. This will ensure that all nodes are filled in with a valid weight.
      descriptors - Set of all image feature descriptors for a single image
    • fixate

      public void fixate()
      Call when done. This will compute the weight using an entropy like function: weight[i] = log(N/N[i]) where N[i] is the number of times a specific node/work appears at least once in the images.