# Bilinear CNNs for Fine-grained Visual Recognition

Bilinear CNNs pair two networks' features to recognize fine-grained categories end-to-end

Lin, Tsung-Yu, RoyChowdhury, Aruni, Maji, Subhransu · arXiv · 2015-4-29

- **Problem** Fine-grained recognition depends on small, localized cues. Part-based models capture them but need part annotations, and orderless texture encoders skip annotations but learn features outside end-to-end training.
- **Method** B-CNNs take the outer product of features from two CNN streams at every image location and sum them. They apply signed square root and L2 normalization, then train the whole network end-to-end.
- **Results** B-CNNs reached 84.1% per-image accuracy on CUB-200-2011 and 91.3% on Stanford cars, using VGG-M and VGG-D streams.

## Why fine-grained recognition needs localized cues

Fine-grained recognition separates items inside one subordinate category, such as bird species, car models or dog breeds. The distinguishing cues are often small and localized, such as bill patterns or subtle feather colour, and a useful model has to ignore where the object sits and how it is posed.

Part-based models handle this by locating parts and reading features at those locations, which makes later reasoning about appearance easier. Their cost is supervision: they need part annotations during training, which are hard to obtain for textures and scenes. Holistic approaches skip parts and describe the whole image, and classical examples such as Bag-of-Visual-Words rely on orderless aggregation.

The authors argue that part-based reasoning works because it is invariant to the position and pose of the object, and that texture-style pooling is invariant to translation by design. The gap they point to is that the features under texture encoders were not learned end-to-end, which may leave them suboptimal for recognition.

## Bilinear pooling of two feature streams

A B-CNN has two feature functions, \\(f\_A\\) and \\(f\_B\\), each mapping an image and a location to a feature, followed by a pooling function that aggregates them over the image. At each location the two features are combined by a matrix outer product, \\(f\_A(l,I)^{T} f\_B(l,I)\\), and both features must share the same dimension K. The pooled descriptor is the sum of these products over all locations: \\\[ \\Phi(I)=\\sum\_{l\\in L} f\_A(l,I)^{T} f\_B(l,I) \\\]

Summing over locations discards where each product came from, so the descriptor is orderless. If the two features have M and N channels, the descriptor is an M×N matrix, which for the main models is 512×512. The authors compare the effect to a quadratic kernel expansion, since each entry is a product of one channel from each stream.

Each stream is an ImageNet-pretrained CNN cut at an intermediate layer, which can process images of arbitrary size and returns outputs indexed by location and channel. Starting from pretrained weights helps when labelled domain data is scarce. The two streams can be independent, partly shared or fully shared, and the paper studies each arrangement.

When both streams are the same network, the layer is an extension of Second-Order Pooling with deep features, without the log-Euclidean step.

## From the pooled descriptor to a prediction

The bilinear descriptor is passed through a signed square root and then L2 normalization. Written out, the signed square root is \\( y = \\operatorname{sign}(x)\\sqrt{\|x\|} \\) and the normalization is \\( z = y/\\\|y\\\|\_2 \\). The authors report that this step improves accuracy in practice and refer to their earlier work for its evaluation.

The classifier is either logistic regression or a linear SVM, since linear models were found effective on top of bilinear features. The SVMs are one-vs-all, trained on training and validation data combined with \\(C\_{svm}=1\\), and the training set is doubled by flipping images. The SVM gives a 1-3% gain over logistic regression with VGG-M and negligible gain with VGG-D.

## Gradients that let both streams train

The model is a directed acyclic graph, so the classification loss can be back-propagated through the classifier, the normalization and the bilinear layer into both streams. The bilinear layer itself has no parameters, which keeps the gradient computation simple.

Let \\(A\\) be the L×M output of one stream and \\(B\\) the L×N output of the other, so that \\(x = A^{T}B\\) is M×N. With \\( \\partial \\ell / \\partial x \\) the gradient of the loss with respect to \\(x\\), the gradients for the two streams are: \\\[ \\frac{\\partial \\ell}{\\partial A}=B\\left(\\frac{\\partial \\ell}{\\partial x}\\right)^{T},\\qquad \\frac{\\partial \\ell}{\\partial B}=A\\,\\frac{\\partial \\ell}{\\partial x} \\\] The gradient for each stream is therefore formed from the activations of the other stream, which couples the two streams during training.

The model can be trained end-to-end whenever the gradients of the two features can be computed efficiently. Exact VLAD, FV and BoVW models cannot be fine-tuned directly, so the authors fine-tune the networks beneath them through FC layers. For fine-tuning, a k-way linear and softmax layer is added, where k is the number of classes, with randomly initialized weights.

The linear layer is first fitted with logistic regression, a convex problem, and the whole model is then back-propagated for about 45 to 100 epochs at learning rate 0.001.

## Texture encoders written in bilinear form

The paper writes several texture encoders as products \\(g\_A^{T} g\_B\\) of two per-location functions, which places them in the same framework as the B-CNN. Each local feature is encoded, optionally passed through a non-linearity, aggregated by pooling, and then normalized.

Bag-of-Visual-Words assigns each feature to its closest of k centers with a one-hot vector \\(\\eta(x)\\), so the image gets a histogram of assignments. In the bilinear view this corresponds to \\(g\_A(x)=1\\) and \\(g\_B(x)=\\eta(x)\\). VLAD instead accumulates residuals to the nearest center, with \\(g\_A(x)=\[x-\\mu\_1; x-\\mu\_2; \\ldots; x-\\mu\_k\]\\) and \\(g\_B(x)=\\operatorname{diag}(\\eta(x))\\).

Because \\(g\_A\\) has one row per center, the VLAD feature has k rows at each location.

FV uses first-order statistics \\(\\alpha\_i\\) and second-order statistics \\(\\beta\_i\\), weighted by Gaussian mixture posteriors \\(\\theta(x)\\). In the bilinear view, \\(g\_A\\) stacks the \\(\\alpha\\) and \\(\\beta\\) statistics and \\(g\_B\\) is the diagonal matrix of posteriors. O2P computes covariance statistics of SIFT features, then a log-Euclidean mapping and power normalization, and with identical feature functions the bilinear layer matches its pooling step.

The hard assignment \\(\\eta\\) is not differentiable, so NetVLAD replaces it with a soft assignment. The soft assignment is given by: \\\[ \\bar\\eta\_k(x)=\\frac{e^{-\\gamma\\\|x-\\mu\_k\\\|^2}}{\\sum\_{k'}e^{-\\gamma\\\|x-\\mu\_{k'}\\\|^2}}=\\frac{e^{w\_k^{T}x+b\_k}}{\\sum\_{k'}e^{w\_{k'}^{T}x+b\_{k'}}} \\\] Here \\(w\_k=2\\gamma\\mu\_k\\), \\(b\_k=-\\gamma\\\|\\mu\_k\\\|^2\\), and \\(\\gamma\\) is a parameter of the model.

This is a softmax after a convolution with a bias term, so standard CNN layers can implement it, and during training \\(w\_k\\), \\(b\_k\\) and \\(\\mu\_k\\) become independent parameters.

NetFV appends element-wise squared residuals to the first-order features and keeps the NetVLAD assignment, which drops the covariances and GMM priors of the exact FV. NetBoVW replaces hard assignments with soft ones and uses a 4096-way softmax as its approximation. The B-CNN version of O2P skips the matrix logarithm, because it needs an eigenvalue decomposition without an efficient GPU implementation, which would slow forward and gradient computation.

## Fine-grained accuracy on birds, aircraft and cars

Only image labels were used for training, with no part or bounding-box annotation. On CUB-200-2011 the B-CNN with VGG-M and VGG-D streams reached 84.1% per-image accuracy, the highest figure in Table 2, while NetVLAD reached 81.9%.

The end-to-end approximations NetBoVW, NetVLAD and NetFV gained a great deal from fine-tuning, while exact models fine-tuned indirectly through FC layers gained less. Fine-tuned single-scale FV models reached 49.9% with VGG-M and 66.7% with VGG-D, above the multi-scale results that Cimpoi et al. reported.

On FGVC-aircraft the B-CNN reached 86.9% when the central 448×448 region of images resized to 512×512 was used as input. NetVLAD reached 81.4% on the same dataset. The authors note that fine-tuning helped the VGG-D models more on aircraft than on birds, which they link to a larger domain shift from ImageNet.

On Stanford cars the B-CNN with VGG-D and VGG-M reached 91.3%, while NetVLAD reached 88.6%. Fine-tuning mattered more for cars than for birds or aircraft.

On NABirds, which has 48,562 images of 555 species, the VGG-M and VGG-D B-CNN reached 79.4% with softmax predictions and no SVM step. A fine-tuned VGG-D network reached 63.7% on the same dataset.

Table 2 also lists methods that use boxes or parts during training or test, and their figures come from their own protocols. Spatial Transformer Networks reach 84.1% on birds without annotations, using a batch-normalized Inception network. The best car figure listed is 92.6% from Krause et al., which uses bounding boxes.

## Shrinking the 512×512 feature

A 512×512 bilinear feature has 262K entries, which is the size of the B-CNN models in Table 2.

Three strategies are considered: project the outer product, project both features before the product, or project only one feature and keep the other unchanged. Projecting both features with PCA reduced accuracy in earlier work and in later work, which the authors link to the PCA rotation leaving the features less correlated across dimensions.

Projecting only one feature with PCA works well in practice, and the projection can be trained jointly with the classification layers.

With one stream projected to k×512, the bilinear feature shrinks in proportion to k, and k is varied over 8, 16, 32 and 64. On birds and aircraft, reducing to 32×512 cuts the dimension by 16× with less than 1% accuracy loss relative to the full 512×512 model. At the same feature size, NetVLAD with 32 components is about 3-4% less accurate, according to the authors.

NetVLAD and NetFV do not improve when more cluster centers are added beyond 32.

Compact bilinear pooling, which approximates the outer product with tensor sketching, is slightly more accurate than the PCA projection in the authors' comparison. The PCA version runs as a dense matrix multiplication and is empirically 1.5× faster than compact bilinear pooling, which needs Fourier transforms.

## Texture and scene results against FV pooling

The texture experiments use DTD, FMD and KTH-T2b, and the scene experiment uses the MIT indoor dataset. DTD has 5640 images labelled with 47 attributes, FMD has 10 material categories of 100 images each, and KTH-T2b has 4752 images of 11 materials. Scores are mean per-class accuracy, and the MIT indoor dataset has 67 categories with a defined split.

Table 3 compares B-CNN and FV pooling built on VGG-D relu5 3 features at input scales of 224×224, 448×448 and multiple sizes. Across these scales the two approaches perform comparably.

For both methods, multiple-scale input gave the highest mean per-class accuracy on all four datasets, above both single-scale settings. Fine-tuning B-CNN on MIT indoor at scale s=1 with relu5 3 features raised accuracy from 72.8% to 73.8%. On the other datasets the fine-tuning gain was small, which the authors attribute to the small size of those datasets.

The authors attribute these differences to the CNN choice and the scale range, and conclude that B-CNNs are comparable to FV pooling for texture recognition.

## Training from scratch on ImageNet

The VGG-M relu5 bilinear model is trained from random initialization on ImageNet and compared with the same network using FC pooling, so the rest of the architecture is identical. Augmentation is f1 (flip), f5 (flip plus 5 translations) or f25 (flip plus 25 translations), and one jittered copy is sampled per example during training. Training uses stochastic gradient descent with momentum, and the learning rate is divided by 10 when validation error stops decreasing.

Networks are trained without PCA colour jittering or batch normalization, and the baseline is within 2% of the top1 errors reported for VGG-M.

VGG-M with f1 augmentation reached 46.4% top1 error, and with f25 it reached 39.6%. B-CNN with f1 augmentation reached 38.7% top1 error, below the f25 VGG-M result.

The authors read this as B-CNN being robust to translation, and as showing that explicit translation invariance from orderless pooling works better than spatial jittering. These comparisons cover one VGG-M relu5 configuration and the augmentation schemes listed.

## Inspecting units and inverted images

The units respond to localized features such as tufted heads and red-yellow stripes on birds, window and logo types on aircraft, and head and tail lights on cars.

For inversion the authors follow Mahendran and Vedaldi, optimizing an image so that the bilinear classifier gives a high score for a target class. The objective is: \\\[ \\min\_x \\sum\_{i=1}^{m} L\\left(C\_{r\_i},\\hat C\\right)+\\gamma\\,\\Gamma(x) \\\]

The prior \\(\\Gamma(x)\\) is a total-variation style smoothness term with \\(\\beta=2\\), which the authors chose to reduce spike artifacts. Classifiers are trained on bilinear features at relu2 2, relu3 3, relu4 3 and relu5 3.

Inverted images for DTD, FMD, MIT indoor and CUB categories show textures and colours tied to each class, such as water and wood from FMD. The MIT indoor inverses show that a bookstore has racks of books and a laundromat has machines at several scales. Adding layers one at a time shows that relu5 3 alone gives good recognition but poor inverses, because the colour information is missing.

## Speed and memory cost

The most accurate model runs at 30 frames per second on an NVIDIA Titan X GPU in MatConvNet. The authors report 30 to 100 frames per second across the architectures, measured with cudnn-v5 on the same GPU. These are throughput figures, reported separately from the accuracy results.

Symmetric B-CNNs share all parameters, so their memory and speed match a single network evaluation. The authors state that part-based fine-grained models with Faster R-CNN or SSD detectors are 2-10× slower.

## Limitations

The CUB dataset has an estimated 4.4% label noise, which the authors say may explain some of the confusions. Among the confused pairs are similar gulls, terns and shrikes, and the most confused pair is American crow and common raven.

Exact VLAD, FV and BoVW models are fine-tuned only indirectly, through FC layers. The B-CNN omits the log-Euclidean mapping of O2P, so it is not the exact O2P descriptor. The FV baseline uses single-scale 448×448 input, which the authors note slightly lowers accuracy relative to multi-scale. NetVLAD and NetFV do not gain from more than 32 cluster centers.

The NABirds result uses softmax predictions without SVM training, so its protocol differs from the SVM-based bird results. Other methods in Table 2 use different annotation levels and protocols, so the comparison is not controlled. The ImageNet from-scratch study covers one VGG-M configuration under one set of training choices. The texture and scene comparison is without fine-tuning except for one MIT indoor result.

## Paper info

- **Authors**: Lin, Tsung-Yu, RoyChowdhury, Aruni, Maji, Subhransu
- **Venue**: arXiv · Preprint
- **First published**: 2015-4-29
- **Added**: 2026-11-12
- **Updated**: 2017-6-1
- **Version**: v6
- **arXiv**: 1504.07889
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1504.07889v6) · [PDF ↗](https://arxiv.org/pdf/1504.07889v6)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Lin, Tsung-Yu, RoyChowdhury, Aruni, Maji, Subhransu (2015). Bilinear CNNs for Fine-grained Visual Recognition. arXiv:1504.07889v6. https://arxiv.org/abs/1504.07889v6

**BibTeX**

```
@misc{tsungyu2015bilinear,
  title = {{Bilinear CNNs for Fine-grained Visual Recognition}},
  author = {Lin, Tsung-Yu and RoyChowdhury, Aruni and Maji, Subhransu},
  year = {2015},
  eprint = {1504.07889},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1504.07889v6}
}
```

## Other paper commentary

- [Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://refivu.com/en/papers/fe9f3871-e0e0-4933-a807-febf612d4db8-scaling-up-visual-and-vision-language-representation.md)
- [Visual Prompt Tuning](https://refivu.com/en/papers/4a26cca4-3c81-4721-817d-3a94b5d6b0f5-visual-prompt-tuning.md)
- [ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness](https://refivu.com/en/papers/57e803cb-75a6-462c-b1bd-4b3c2848753b-imagenet-trained-cnns-are-biased-towards-texture-increasing.md)
- [DualGAN: Unsupervised Dual Learning for Image-to-Image Translation](https://refivu.com/en/papers/d55f8c4a-20b7-4a6d-b036-ba23c6b476bc-dualgan-unsupervised-dual-learning-for-image-to-image.md)
- [BLIP: Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation](https://refivu.com/en/papers/072fcecb-6c6d-400e-ac1c-93885521831b-blip-bootstrapping-language-image-pre-training-for-unified.md)
- [Deep Retinex Decomposition for Low-Light Enhancement](https://refivu.com/en/papers/f4201ae3-b544-42f6-81cc-c789d2e0e575-deep-retinex-decomposition-for-low-light-enhancement.md)
- [Time Series Forecasting With Deep Learning: A Survey](https://refivu.com/en/papers/780d7359-7e46-4268-a1a4-b0f1171c7abd-time-series-forecasting-with-deep-learning-a-survey.md)
- [EuroSAT: A Novel Dataset and Deep Learning Benchmark for Land Use and Land Cover Classification](https://refivu.com/en/papers/6d2c7153-052d-419e-be70-b7562167c83a-eurosat-a-novel-dataset-and-deep-learning-benchmark.md)
- [Deep Networks with Stochastic Depth](https://refivu.com/en/papers/a740a8af-8c09-4c4a-92ca-ab98a84c56cf-deep-networks-with-stochastic-depth.md)
- [Deep Transfer Learning with Joint Adaptation Networks](https://refivu.com/en/papers/a47a8c83-de4b-469b-a9c2-9df2e72bbd27-deep-transfer-learning-with-joint-adaptation-networks.md)
- [Tacotron: Towards End-to-End Speech Synthesis](https://refivu.com/en/papers/6c1ac20e-aefe-488b-af41-213ae484f317-tacotron-towards-end-to-end-speech-synthesis.md)
- [LaMDA: Language Models for Dialog Applications](https://refivu.com/en/papers/9474e307-9624-4203-a346-57d881b1a5d9-lamda-language-models-for-dialog-applications.md)

## Terms in this paper

- [ImageNet](https://refivu.com/en/terms/5eadad128667-imagenet)
- [linear SVM](https://refivu.com/en/terms/19bedf093550-linear-svm)
- [Bag-of-Visual-Words](https://refivu.com/en/terms/628c6c7bfcc2-bag-of-visual-words)
- [CUB-200-2011](https://refivu.com/en/terms/e4d1963c51b6-cub-200-2011)
- [frames per second](https://refivu.com/en/terms/c227fff74a78-frames-per-second)
- [scene recognition](https://refivu.com/en/terms/2491a7f9a499-scene-recognition)
- [soft assignment](https://refivu.com/en/terms/8d5a52b1b5e5-soft-assignment)
- [Stanford Cars](https://refivu.com/en/terms/077b976a1009-stanford-cars)
- [VGG-M](https://refivu.com/en/terms/e07191c51c76-vgg-m)
- [FGVC-Aircraft](https://refivu.com/en/terms/9be2f54f41c1-fgvc-aircraft)
- [Fisher Vector](https://refivu.com/en/terms/83eba9f5f899-fisher-vector)
- [NetVLAD](https://refivu.com/en/terms/5d619b906490-netvlad)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/6ca2f2f1-4711-4b74-898b-dcb3662ffa1f-bilinear-cnns-for-fine-grained-visual-recognition)
