Bag-of-words model in computer vision

来源:互联网 发布:php 网络爬虫抓取图片 编辑:程序博客网 时间:2024/05/17 01:20

Bag-of-words model in computer vision

From Wikipedia, the free encyclopedia
Jump to: navigation, search

In computer vision, the bag-of-words model (BoW model) can be applied toimage classification, by treating image features as words. In document classification, abag of words is a sparse vector of occurrence counts of words; that is, a sparsehistogram over the vocabulary. Incomputer vision, abag of visual words is a sparse vector of occurrence counts of a vocabulary of local image features.

Contents

[hide]
  • 1Representation based on the BoW model
    • 1.1Image representation based on the BoW model
      • 1.1.1Feature representation
      • 1.1.2Codebook generation
  • 2Learning and recognition based on the BoW model
    • 2.1Generative models
      • 2.1.1Naïve Bayes
      • 2.1.2Hierarchical Bayesian models
    • 2.2Discriminative models
      • 2.2.1Pyramid match kernel
  • 3Limitations and recent developments
  • 4See also
  • 5References
  • 6External links

[edit]Representation based on the BoW model

[edit]Image representation based on the BoW model

To represent an image using BoW model, an image can be treated as a document. Similarly, "words" in images need to be defined too. To achieve this, it usually includes following three steps:Feature detection (computer vision), feature description and codebook generation.[1] A definition of the BoW model can be the "histogram representation based on independent features".[2] Content based image indexing and retrieval (CBIR) appears to be the early adopter of this image representation technique.[3]

[edit]Feature representation

After feature detection, each image is abstracted by several local patches. Feature representation methods deal with how to represent the patches as numerical vectors. These vectors are called feature descriptors. A good descriptor should have the ability to handle intensity, rotation, scale and affine variations to some extent. One of the most famous descriptors isScale-invariant feature transform (SIFT).[4] SIFT converts each patch to 128-dimensional vector. After this step, each image is a collection of vectors of the same dimension (128 for SIFT), where the order of different vectors is of no importance.

[edit]Codebook generation

The final step for the BoW model is to convert vector represented patches to "codewords" (analogy to words in text documents), which also produces a "codebook" (analogy to a word dictionary). A codeword can be considered as a representative of several similar patches. One simple method is performing k-means clustering over all the vectors.[5] Codewords are then defined as the centers of the learned clusters. The number of the clusters is the codebook size (analogy to the size of the word dictionary).

Thus, each patch in an image is mapped to a certain codeword through the clustering process and the image can be represented by thehistogram of the codewords.

[edit]Learning and recognition based on the BoW model

Computer vision researchers have developed several learning methods to leverage the BoW model for image related task, such asobject categorization. These methods can roughly be divided into two categories, generative and discriminative models. For multiple label categorization problem, theconfusion matrix can be used as an evaluation metric.

[edit]Generative models

Here are some notations for this section. Suppose the size of codebook is V.

  • w: each patchw is a V-dimensional vector that has a single component that equals to one and all other components equal to zero (For k-means clustering setting, the single component equal one indicates the cluster that w belongs to). Thevth codeword in the codebook can be represented asw^v=1 andw^u = 0 foru\neq v.
  • \mathbf{w}: each image is represented by\mathbf{w}=[w_1, w_2, \cdots, w_N], all the patches in an image
  • d_j: thejth image in an image collection
  • c: category of the image
  • z: theme or topic of the patch
  • \pi: mixture proportion

Since the BoW model is an analogy to the BoW model in NLP, generative models developed in text domains can also be adapted in computer vision. Simple Naïve Bayes model and hierarchical Bayesian models are discussed.

[edit]Naïve Bayes

The simplest one is Naïve Bayes classifier.[6] Using the language of graphical models, the Naïve Bayes classifier is described by the equation below. The basic idea (or assumption) of this model is that each category has its own distribution over the codebooks, and that the distributions of each category are observably different. Take a face category and a car category for an example. The face category may emphasize the codewords which represent "nose", "eye" and "mouth", while the car category may emphasize the codewords which represent "wheel" and "window". Given a collection of training examples, the classifier learns different distributions for different categories. The categorization decision is made by

  • c^*=\arg \max_c p(c|\mathbf{w}) = \arg \max_c p(c)p(\mathbf{w}|c)=\arg \max_c p(c)\prod_{n=1}^Np(w_n|c)

Since the Naïve Bayes classifier is simple yet effective, it is usually used as a baseline method for comparison.

[edit]Hierarchical Bayesian models

The basic assumption of Naïve Bayes model does not hold sometimes. For example, a natural scene image (Figure 7) may contain several different themes.Probabilistic latent semantic analysis (pLSA)[7][8] and latent Dirichlet allocation (LDA)[9] are two popular topic models from text domains to tackle the similar multiple "theme" problem. Take LDA for an example. To model natural scene images using LDA, an analogy is made like this (Figure 9):

  • the image category is mapped to the document category;
  • the mixture proportion of themes maps the mixture proportion of topics;
  • the theme index is mapped to topic index;
  • the codeword is mapped to the word.

This method shows very promising results in natural scene categorization on 13 Natural Scene Categories.[1]

[edit]Discriminative models

Since images are represented based on the BoW model, any discriminative model suitable for text document categorization can be tried, such assupport vector machine (SVM)[6] and AdaBoost.[10]Kernel trick is also applicable when kernel based classifier is used, such as SVM. Pyramid match kernel is newly developed one based on the BoW model. The local feature approach of using BoW model representation learnt by machine learning classifiers with different kernels (e.g., EMD-kernel andX^2 kernel) has been vastly tested in the area of texture and object recognition.[11] Very promising results on a number of datasets have been reported. This approach[11] has achieved very impressive result in the the PASCAL Visual Object Classes Challenge

[edit]Pyramid match kernel

Pyramid match kernel[12] is a fast algorithm (linear complexity instead of classic one in quadratic complexity) kernel function (satisfyingMercer's condition) which maps the BoW features, or set of features in high dimension, to multi-dimensional multi-resolution histograms. One of the advantages of the multi-resolution histograms is the ability to capture the co-occurring features. The pyramid match kernel builds the multi-resolution histograms by binning data points into discrete regions of increasing larger size. Thus, points do not match at high resolutions have the chance to match at low resolutions (Figure 9). Pyramid match kernel performs approximate similarity match, without explicit search without explicit distance computing but do an histogram intersection instead to give an approximation of optimal matching, and the computation time is only linear in the number of features. Compared with other kernel approaches, pyramid match kernel is much faster, yet provides competitively accurate results. Pyramid match kernel was applied toETH-80 database and Caltech 101 database and showed promising results.[12][13]

[edit]Limitations and recent developments

One of notorious disadvantages of BoW is that it ignores the spatial relationships among the patches, which is very important in image representation. Researchers have proposed several methods to incorporate the spatial information. For feature level improvements, correlogram features can capture spatial co-occurrences of features.[14] For generative models, relative positions[15][16] of codewords are also taken into account. The hierarchical shape and appearance model for human action[17] introduces a new part layer (Constellation model) between the mixture proportion and the BoW features, which captures the spatial relationships among parts in the layer. For discriminative models, spatial pyramid match[18] performs pyramid matching by partitioning the image into increasingly fine sub-regions and compute histograms of local features inside each sub-region.

Furthermore, the BoW model has not been extensively tested yet for view point invariance and scale invariance, and the performance is unclear. Also the BoW model for object segmentation and localization is also lack of study.[2]

 

原创粉丝点击