Abstract
Object categories are typically organized into a multi-granularity taxonomic hierarchy. When classifying categories at different hierarchy levels, traditional uni-modal approaches focus primarily on image features, revealing limitations in complex scenarios. Recent studies integrating Vision-Language Models (VLMs) with class hierarchies have shown promise, yet they fall short of fully exploiting the hierarchical relationships. These efforts are constrained by their inability to perform effectively across varied granularity of categories. To tackle this issue, we propose a novel framework (HGCLIP) that effectively combines CLIP with a deeper exploitation of the Hierarchical class structure via Graph representation learning. We explore constructing the class hierarchy into a graph, with its nodes representing the textual or image features of each category. After passing through a graph encoder, the textual features incorporate hierarchical structure information, while the image features emphasize class-aware features derived from prototypes through the attention mechanism. Our approach demonstrates significant improvements on 11 diverse visual recognition benchmarks.
Introduction
Hierarchical understanding is a cornerstone of human intelligence. Humans do not merely perceive a "Shiba Inu" as an isolated label; we recognize it as a "Dog," which belongs to the "Mammal" class, and ultimately the "Animal" kingdom. While Vision-Language Models (VLMs) like CLIP have revolutionized computer vision by aligning visual and textual representations, they typically treat labels as a flat list. This approach misses the rich, structured relationships inherent in multi-granularity taxonomies.
Traditional Hierarchical Image Classification (HIC) has often been uni-modal, focusing on image features alone. Recent VLM-based attempts have tried to use hierarchical labels as prompts, but they fail to deeply exploit structural connections, treating the hierarchy as a simple list of words. HGCLIP addresses these challenges by integrating Graph Representation Learning into the CLIP framework to master these complex taxonomies.
Methodology: The HGCLIP Framework
The core innovation of HGCLIP lies in its fusion of CLIP with Graph Neural Networks (GNNs) to ensure that internal representations communicate across the branches of a taxonomic tree.
Multi-modal Hierarchical Prompting
HGCLIP introduces learnable "prompt tokens" into the first nine layers of both the image and text encoders. This deep prompting allows the model to learn task-specific context at various levels of abstraction, which is crucial for capturing the complex features needed for hierarchical understanding.
Graph-Based Representation
The dataset's taxonomy is represented as a graph where nodes are classes and edges represent parent-child relationships.
- Textual Branch (Graph Encoding): Text features for each class are processed through a Graph Attention Network (GAT). This allows a specific node (e.g., "Shiba Inu") to incorporate semantic information from its parent (e.g., "Dog"), refining its meaning based on its position in the hierarchy.
- Visual Branch (Prototype Learning): To bridge the gap between pixels and class nodes, HGCLIP uses "prototypes"—average features of classes from the training set. These prototypes are also refined via a graph encoder.
- Cross-Modal Attention: The spatial feature map of the input image attends to these graph-refined prototypes, forcing the model to focus on visual features relevant to the specific hierarchical structure it is navigating.
Experimental Results
HGCLIP was evaluated on a battery of 11 hierarchical benchmarks, including general (CIFAR-100), fine-grained (FGVC-Aircraft, Food-101), and specialized datasets (EuroSAT).
Performance and Robustness
HGCLIP set new state-of-the-art (SoTA) records across the board. On CIFAR-100, it outperformed the previous best method, MaPLe, by 1.2% at the coarse level and 0.7% at the fine level. On FGVC-Aircraft, the improvement was a significant 8.45% at the coarsest level.
In domain generalization tasks, such as training on ImageNet and testing on shifted versions like ImageNet-Sketch or ImageNet-R, HGCLIP consistently outperformed standard CLIP and other prompt-tuning methods. It also showed remarkable robustness to subpopulation shifts in the BREEDS benchmarks, demonstrating its ability to generalize from specific subclasses to others under the same parent category.
Key Insights
- Hierarchies as Graphs: Treating taxonomy as a graph allows bidirectional feature flow. Coarse categories provide context to fine ones, while fine categories provide detail to coarse ones.
- LLMs as Architects: If a dataset lacks a ground-truth hierarchy, an LLM (like ChatGPT) can generate one. HGCLIP remains effective even with these AI-generated taxonomies.
- Efficiency: Despite the added complexity of graph encoders, HGCLIP is more training-efficient than many visual-only fine-grained classification methods, requiring fewer epochs to converge.
Conclusion and Future Work
HGCLIP demonstrates that explicitly modeling hierarchical relationships via graph representations significantly enhances VLM performance in multi-granularity classification. While highly effective, the authors note that future work could explore more sophisticated graph architectures specifically designed for trees and unified cross-modal graph encoders to further improve feature alignment and reduce computational overhead.
Codes are available at: https://github.com/richard-peng-xia/HGCLIP
Summary updated