Zero-Shot Visual Classification with Guided Cropping

Piyapat Saranrittichai, Mauricio Munoz, Volker Fischer, Chaithanya Kumar Mummadi · DOI

Abstract

Pretrained vision-language models like CLIP have established a new paradigm for zero-shot visual classification. However, these models often falter when the target object is small or surrounded by complex backgrounds, as the global image embedding can be dominated by irrelevant contextual features. This paper introduces GC-CLIP (Guided Cropping CLIP), a simple yet effective training-free approach that utilizes an off-the-shelf open-vocabulary detector to "zoom in" on candidate regions. By refining the input to the image encoder, GC-CLIP significantly enhances classification performance, particularly for small objects, across multiple benchmarks.

Introduction

Standard vision-language models process images globally, which can lead to "contextual interference." When an object of interest occupies only a small fraction of the image, the surrounding environment may "drown out" the object's unique features. For example, as illustrated in Figure 1, a large expanse of water can cause CLIP to misclassify a "canoe" as a "sandbar." This sensitivity to background clutter limits the robustness of zero-shot models in real-world, unconstrained scenes.

Figure 1: Comparison between conventional CLIP inference and GC-CLIP. Conventional CLIP is often distracted by large background regions, whereas guided cropping focuses the model on the object of interest to improve accuracy.

Methodology: GC-CLIP

The proposed GC-CLIP pipeline operates in three distinct stages to mitigate contextual interference without requiring additional training or fine-tuning:

  1. Preliminary Filtering: The full image is processed by a standard CLIP model to generate a set of top-$k$ candidate classes (typically $k=5$).
  2. Guided Cropping: An off-the-shelf open-vocabulary object detector, such as OWL-ViT, is prompted with these candidate classes to identify potential bounding boxes. The box with the highest confidence score is selected as the primary region of interest.
  3. Refined Classification: The image is cropped according to the detected box and re-evaluated by CLIP.

To enhance robustness, the authors implement Multi-Margin Box Augmentation (MAug). Rather than relying on a single tight crop, the system averages predictions from multiple crops of varying scales. This technique ensures the model captures both fine-grained object details and essential surrounding context, which can often aid in recognition.

Figure 2: Architectural comparison of (a) conventional CLIP inference and (b) the GC-CLIP pipeline incorporating guided cropping.

Experimental Evaluation

The effectiveness of GC-CLIP was evaluated on several benchmarks, with a specific focus on small-object detection. These include ImageNetS919-SM and CUB-SM, subsets where the target object occupies less than 20% of the total image area.

Key Insights

  • Localization vs. Identification: The study highlights that while open-vocabulary detectors are excellent at locating objects, their internal classification capabilities are often inferior to CLIP. GC-CLIP leverages the detector's localization strength while relying on CLIP for final identification.
  • Contextual Sensitivity: CLIP exhibits significant sensitivity to non-semantic changes, such as minor shifts in cropping. The MAug approach addresses this by smoothing predictions across multiple spatial scales.
  • Performance Gains: GC-CLIP consistently outperforms standard CLIP. On the ImageNetS919-SM dataset, top-1 accuracy improved from 52.83% to 56.00% using a ViT-B/32 backbone. The benefits are most pronounced as object size decreases relative to the full image.
  • Synergy with Textual Descriptions: Performance can be further boosted by using GPT-3 generated descriptions instead of simple class labels, reaching 69.88% accuracy on ImageNetS919-SM with a ViT-L/14 backbone.

Conclusion

GC-CLIP demonstrates that "zooming in" is a powerful, training-free strategy for improving zero-shot classification. By decoupling localization and identification, the method overcomes the limitations of global image embeddings in complex scenes. While the approach introduces some computational overhead and depends on the quality of the initial detector, it provides a robust framework for deploying vision-language models in challenging real-world environments.

Summary updated

BibTeX
@misc{saranrittichai2023zero,
  author = {Piyapat Saranrittichai and Mauricio Munoz and Volker Fischer and Chaithanya Kumar Mummadi},
  title = {{Zero-Shot Visual Classification with Guided Cropping}},
  year = {2023},
  eprint = {2309.06581},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.06581},
}
Figure