NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Fast-BoW: Scaling Bag-of-Visual-Words Generation

Dinesh Singh, Abhijeet Bhure, Sumit Mamtani, C. Krishna Mohan

Abstract

Fast-BoW is a scalable method that drastically speeds up Bag-of-Visual-Words (BoW) generation by replacing expensive nearest-neighbor searches with a quantized softmax classifier and a clever hashing trick. It achieves up to a 4000x speedup over sequential methods and is 12x faster than traditional tree-based approaches, all while maintaining significantly higher classification accuracy.

Introduction

In computer vision, the Bag-of-Visual-Words (BoW) model is a classic unsupervised method for turning local image features into a global descriptor. However, it suffers from a massive scaling problem. To generate a BoW histogram, you must compare every local feature in an image against a "vocabulary" of $k$ visual words (cluster centers).

As the vocabulary size $k$ grows to improve accuracy, the computational cost explodes. Standard sequential search is $O(dk)$, where $d$ is the feature dimension. While hierarchical trees (Tree-BoW) can reduce this to $O(d \\log_2 k)$, they often suffer from a "hard splitting" problem where features near a boundary are assigned to the wrong branch, leading to a significant drop in classification accuracy (up to 5%). The authors aim to make BoW generation fast enough for real-time use without this accuracy penalty.

Methodology

The authors introduce Fast-BoW, which reimagines the cluster-assignment problem as a classification task. Their approach involves three main innovations:

  1. Softmax Classifier Replacement: Instead of calculating Euclidean distances to $k$ centroids (k-means), they train a softmax classifier where the "classes" are the cluster indices. This allows for "softer" boundaries and better probability distribution modeling.
  2. Weight Quantization: Real-valued weights in the softmax layer (usually 32 or 64 bits) are quantized into small integers (typically 2–8 bits). This reduces the memory footprint and simplifies the underlying math.
  3. Hashing for Multiplication Reduction: This is the core "speed hack." By using a hash table to group similar quantized weights, the algorithm avoids redundant floating-point multiplications. Instead of multiplying every feature value by a weight, it sums the features associated with the same weight first, then performs a single multiplication.
The Fast-BoW pipeline: from real weights to quantized binarized weights and reduced multiplications via hashing.

This shifts the complexity for soft BoW from $O(dk)$ to $O(|h|k)$, where $|h|$ is the size of the hash table (much smaller than $d$). For hard BoW, using a hierarchical tree of these classifiers brings the complexity down to $O(|h| \\log_2 k)$.

Experimental Setup

The researchers evaluated Fast-BoW on three standard human action recognition benchmarks: KTH (6 action classes), HMDB51 (51 action classes), and UCF101 (101 action classes). They used Space-Time Interest Points (STIP) as the local feature descriptors for all experiments.

Results

Fast-BoW demonstrates exceptional performance across both speed and accuracy metrics:

  • Massive Speedups: On the KTH dataset with a large vocabulary ($k = 65,536$), Fast-BoW was 4000x faster than the sequential baseline and 12x faster than the hierarchical tree approach.
  • High Fidelity: While traditional tree-based methods saw accuracy drops of up to 5%, Fast-BoW limited the loss to less than 0.5% compared to the full sequential search.
  • Real-Time Performance: The proposed method took less than 2 milliseconds to process a video clip, making it highly practical for real-time applications where traditional BoW would be a bottleneck.
Classification accuracy and generation time as a function of the number of clusters.

Discussion

Several key insights drive the success of Fast-BoW. First, finding the "nearest neighbor" in a feature space is functionally equivalent to a classification problem. By treating it as such, the authors leverage optimization techniques like softmax that k-means lacks. Second, large weight matrices in neural layers are often highly redundant; quantization creates "buckets" of identical values that can be exploited via hashing to skip thousands of unnecessary multiplications. Finally, unlike hierarchical trees that force a "hard" choice at every branch, the softmax approach learns the probability distribution of the clusters, preserving feature effectiveness even under heavy compression.

Conclusion

While Fast-BoW offers significant improvements, some limitations remain. The paper focuses on STIP descriptors; while the mathematical logic should hold for modern deep-learning embeddings, explicit testing on high-dimensional vectors is needed. Additionally, performance depends on choosing the right hash table size $|h|$. The authors suggest $|h| = \\sqrt{d}$ is a good balance. Future work could involve integrating Fast-BoW directly into end-to-end deep learning pipelines for even more efficient feature extraction.

Summary updated

BibTeX
@inproceedings{singh2018fast,
  author = {Dinesh Singh and Abhijeet Bhure and Sumit Mamtani and C. Krishna Mohan},
  title = {{Fast-BoW: Scaling Bag-of-Visual-Words Generation}},
  booktitle = {BMVC},
  year = {2018},
}
Figure