Good Practice in CNN Feature Transfer

Liang Zheng, Yali Zhao, Shengjin Wang, Jingdong Wang, Qi TianarXiv 2016

Abstract

Transfer learning with pre-trained Convolutional Neural Networks (CNNs) has become a standard paradigm in computer vision. However, the common practice of resizing images to small, fixed-size squares and relying solely on final fully connected layers is often suboptimal. This paper identifies three "good practices" to significantly boost performance: using larger input images that preserve aspect ratio, leveraging pooled intermediate convolutional features, and fusing features across multiple layers. These simple yet effective strategies achieve state-of-the-art results across 10 major image search and classification benchmarks.

Introduction

In 2016, the standard recipe for transfer learning involved resizing images to a fixed 227x227 or 224x224 square and extracting features from the final fully connected (FC) layers. This approach has two major drawbacks. First, aggressive down-sampling and aspect-ratio warping destroy fine-grained details and distort objects. Second, FC layers are highly semantic and "global," making them less effective at capturing the local patterns needed for tasks like instance retrieval or fine-grained classification, especially when objects are occluded or truncated.

Methodology

The authors systematically evaluate three modifications to the standard transfer learning pipeline:

  1. Proper Image Resizing: Instead of the standard square crop, they propose "Scale 1.0." They calculate the average long-side length of the target dataset and resize all images to that length while preserving the aspect ratio. This prevents distortion and retains more information.
  2. Pooled Convolutional Features: They move away from relying solely on FC layers. By applying average or max pooling to the feature maps of convolutional layers (like Conv5), they create compact descriptors that are more invariant to translation and occlusion while retaining local spatial cues.
  3. Multi-Layer Fusion: Features from different depths are complementary. They combine features from all seven major layers (Conv1 through FC7). For classification, they use simple concatenation; for image search, they employ a "Query Adaptive Fusion" strategy to weight different features dynamically.
CNN feature extraction and pooling across layers.

As illustrated in Figure 1, the framework extracts features from multiple convolutional and fully connected layers. By pooling intermediate feature maps, the model captures a range of information from local textures to global semantic concepts.

Experimental Setup

The study is impressively comprehensive, testing across 10 diverse benchmarks:

  • Image Search: Holidays, Ukbench, and Oxford5k.
  • Fine-Grained Classification: Oxford Flower-102 and Caltech-UCSD Bird-200-2011.
  • Scene Classification: Indoor-67 and SUN-397.
  • Generic Object Classification: Caltech-101, Caltech-256, and PASCAL VOC’07.
  • Validation: ILSVRC’12 (ImageNet) was used to validate the impact of image scale.

Key Results and Discussion

The "Good Practices" led to significant jumps over the then-current state-of-the-art (SOTA):

  • Fine-Grained Accuracy: On the Bird-200 dataset, their VGG-based system reached 76.4%, a substantial increase over the previous SOTA of 69.7%. On Flower-102, they achieved 95.6%.
  • Image Search: On the Oxford5k benchmark, their method achieved a mean Average Precision (mAP) of 71.3%, outperforming standard CNN baselines.
  • Scale Impact: On ImageNet validation, simply increasing the input scale from 0.45 (standard 224 size) to 1.0 reduced the top-1 error from 34.12% to 25.45%.
Qualitative results showing improved image retrieval ranking and activation maps.

Qualitative improvements in image retrieval are shown in Figure 3. The proposed feature fusion and scaling significantly improve the ranking of relevant images (e.g., from rank 102 to 1 in the chameleon example), with activation maps highlighting the discriminative local regions used for matching.

Key Insights

  • The "Conv5" Sweet Spot: Pooled Conv5 features often outperform FC6 and FC7. Conv5 has enough semantic abstraction to recognize parts of objects but hasn't yet discarded the spatial information lost in the transition to fully connected layers.
  • 224x224 is a Bottleneck: Increasing the scale consistently improves accuracy until a point of diminishing returns (Scale 1.0), after which no new information is gained.
  • Pooling as a Regularizer: Simple pooling (max or average) makes features robust to small shifts or rotations, which is critical for matching objects in the wild.

Conclusion

While the proposed fusion method is effective, the authors acknowledge that bottom-level features (Conv1-2) remain relatively weak due to a lack of discriminative power. Future work may involve more sophisticated encoding methods like VLAD or Fisher Vectors for these lower layers. Additionally, while larger image scales improve performance, they increase GPU memory consumption, a factor to consider for high-resolution datasets or real-time applications.

Summary updated

BibTeX
@misc{zheng2016good,
  author = {Liang Zheng and Yali Zhao and Shengjin Wang and Jingdong Wang and Qi Tian},
  title = {{Good Practice in CNN Feature Transfer}},
  year = {2016},
  eprint = {1604.00133},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1604.00133},
}
Figure