Documentation of 'boofcv.alg.scene.ClassifierKNearestNeighborsBow' Java class
ClassifierKNearestNeighborsBow
boofcv.alg.scene

Class ClassifierKNearestNeighborsBow<T extends ImageBase,Desc extends TupleDesc>



  • public class ClassifierKNearestNeighborsBow<T extends ImageBase,Desc extends TupleDesc>
    extends java.lang.Object

    Scene classification which uses bag-of-word model and K-Nearest Neighbors. Classification data consists of a labeled set of word histograms. Each word histogram was created by 1) extracting all the features inside an image which was known to belong to a specific scene, 2) the word which best matches each feature is found and added to the histogram, and 3) the histogram is then normalized so that it adds up to one.

    When classifying an image its word histogram is computed the same way. Using the just computed histogram the K-nearest neighbors to its word histogram are found in the classification data. The most frequent scene (the mode) of the k-neighbors is the selected scene type of the image being considered.

    • Constructor Detail

      • ClassifierKNearestNeighborsBow

        public ClassifierKNearestNeighborsBow(NearestNeighbor<HistogramScene> nn,
                                              DescribeImageDense<T,Desc> describe,
                                              FeatureToWordHistogram<Desc> featureToHistogram)
        Configures internal algorithms.
        Parameters:
        nn - Used to perform nearest-neighbor search
        describe - Computes the dense image features
        featureToHistogram - Converts a set of features into a word histogram
    • Method Detail

      • setNumNeighbors

        public void setNumNeighbors(int numNeighbors)
        Specifies the number of neighbors it should search for when classifying\
      • setClassificationData

        public void setClassificationData(java.util.List<HistogramScene> memory,
                                          int numScenes)
        Provides a set of labeled word histograms to use to classify a new image
        Parameters:
        memory - labeled histograms
      • classify

        public int classify(T image)
        Finds the scene which most resembles the provided image
        Parameters:
        image - Image that's to be classified
        Returns:
        The index of the scene it most resembles

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.