Vision Transformer-based Feature Extraction for Generalized Zero-Shot Learning

Jiseob Kim, Kyuhong Shim, Junhan Kim, Byonghyo Shim · DOI

Abstract

Generalized Zero-Shot Learning (GZSL) aims to recognize objects from both seen and unseen classes by leveraging semantic attributes. While traditional approaches rely on Convolutional Neural Networks (CNNs) for feature extraction, these architectures often suffer from spatial information loss due to pooling and strided convolutions. This paper introduces ViT-GZSL, a novel framework that utilizes Vision Transformers (ViT) to preserve high-resolution spatial details. By incorporating an Attribute Attention Module (AAM), the model effectively maps visual patches to semantic descriptions, achieving state-of-the-art performance across multiple benchmarks.

Introduction

In Generalized Zero-Shot Learning (GZSL), a model must classify images belonging to classes it has never encountered during training. To bridge the gap between seen and unseen categories, models utilize auxiliary information—typically semantic attributes like "has wings" or "striped pattern."

For years, the standard pipeline for GZSL has relied on pre-trained CNN backbones (such as ResNet) to extract visual features. However, CNNs are inherently limited by their downsampling operations, which discard the fine-grained spatial information necessary to identify subtle attributes. For instance, distinguishing between two bird species might require focusing on a specific eye color or a small patch of feathers—details often lost in the deep layers of a CNN. This paper proposes a shift toward Vision Transformers (ViT) to overcome these structural limitations.

Methodology: The ViT-GZSL Architecture

The ViT-GZSL framework consists of three primary components designed to extract and refine features for zero-shot classification.

1. Vision Transformer Backbone

The model employs a pre-trained Vision Transformer (specifically DeiT-Base) as its feature extractor. Unlike CNNs, ViTs treat an image as a sequence of patches, maintaining the spatial relationships and resolution of these patches throughout the network. The backbone outputs a global CLS token and a set of local patch features.

2. Feature-to-Attribute (F2A) Module

In a real-world inference scenario, the semantic attributes of an image are unknown. The F2A module is designed to predict a "synthetic attribute" vector directly from the global CLS feature. This synthetic attribute serves as a bridge, representing the model's best guess of the semantic properties present in the image.

3. Attribute Attention Module (AAM)

The AAM is the core innovation of this research. It uses the synthetic attribute generated by the F2A module as a "query" to scan the local patch features. By calculating the relevance of each patch to the predicted attributes, the AAM aggregates the most important local details into a single "attribute-aware" feature. The final representation of the image is a concatenation of the global CLS feature and this refined local feature.

Feature Generation and Classification

To handle the zero-shot aspect, the authors utilize a Conditional Variational Autoencoder (CVAE). The CVAE is trained to synthesize visual features for unseen classes based on their known semantic attributes. Once the CVAE can generate realistic features, a standard softmax classifier is trained on a combination of real features (from seen classes) and synthetic features (for unseen classes).

Experimental Results

The ViT-GZSL model was evaluated on three standard GZSL benchmarks: Caltech-UCSD Birds (CUB), Animals with Attributes 2 (AWA2), and Scene UNderstanding (SUN). The performance was measured using the harmonic mean (H) of seen and unseen class accuracies.

Dataset ViT-GZSL (H-Mean) Previous SOTA (H-Mean) Improvement
CUB 67.9% 54.6% (Composer) +13.3%
AWA2 72.5% 67.5% +5.0%
SUN 48.8% 35.8% +13.0%

These results demonstrate that ViT-based features are significantly more robust for GZSL than CNN-based features, even when paired with a relatively simple generative model like a CVAE.

Key Insights

The "11th Layer" Phenomenon

One of the most intriguing findings of the study is that the 11th layer of the ViT often outperforms the final (12th) layer for feature extraction. The authors suggest that the final layer of a pre-trained ViT becomes too specialized toward the specific classes in its pre-training dataset (e.g., ImageNet). By extracting features from the penultimate layer, the model retains more generalized information that is vital for identifying the novel characteristics of unseen classes.

Global vs. Local Synergy

The success of ViT-GZSL stems from its dual-stream approach. While the CLS token provides a holistic view of the scene, the AAM allows the model to "zoom in" on specific regions—such as a horn, a wing, or a specific texture—that correspond directly to the semantic attributes used to define unseen categories.

Conclusion and Future Work

ViT-GZSL represents a significant step forward in Generalized Zero-Shot Learning by demonstrating the superiority of Transformer architectures over traditional CNNs for attribute-based recognition. By preserving spatial resolution and employing an attribute-driven attention mechanism, the model sets new performance benchmarks.

Future research directions include fine-tuning the ViT backbone during the GZSL training phase and integrating the ViT-GZSL feature extractor with more sophisticated generative frameworks, such as GANs or VAEGANs, to further enhance the quality of synthesized features for unseen classes.

Summary updated

BibTeX
@inproceedings{kim2023vision,
  author = {Jiseob Kim and Kyuhong Shim and Junhan Kim and Byonghyo Shim},
  title = {{Vision Transformer-based Feature Extraction for Generalized Zero-Shot Learning}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2023},
  url = {https://openreview.net/forum?id=hlLoZhZyak},
}
Figure