Transformer Based Multi-Grained Features for Unsupervised Person Re-Identification

Jiachen Li, Menglin Wang, Xiaojin GongarXiv 2022

In the world of computer vision, Person Re-Identification (Re-ID)—the task of identifying the same person across different camera views—is moving away from labor-intensive manual labeling. While Vision Transformers (ViTs) have recently taken the supervised Re-ID world by storm, their potential in the "wild" (unsupervised settings) is still being mapped out.

A new paper, Transformer Based Multi-Grained Features for Unsupervised Person Re-Identification, introduces a dual-branch transformer architecture that bridges the gap between unsupervised learning and high-performance supervised counterparts.

TL;DR

The authors propose TMGF, a pure transformer-based framework that extracts both global and fine-grained part-level features for unsupervised person Re-ID. By duplicating the final transformer layer into two branches and applying a sophisticated offline-online contrastive learning strategy, they achieve state-of-the-art results, particularly on the challenging MSMT17 dataset.

What Problem Does This Paper Address?

Most successful person Re-ID models rely on multi-grained features—looking at both the "big picture" (global features) and specific details like a person's shoes or backpack (part-level features). While this is a mature technique for Convolutional Neural Networks (CNNs), doing it with a pure Transformer in an unsupervised setting is difficult.

Without labels, the model must learn to group similar images (clustering) and distinguish between different identities using only visual cues. Previous transformer-based unsupervised methods often ignored fine-grained part features, leaving a significant performance gap compared to supervised models.

Methods

The authors build their method, TMGF (Transformer-based Multi-Grained Feature), on a modified Vision Transformer (ViT) backbone.

Figure 1. An overview of the proposed method. It constructs a dual-branch architecture appended to a pure transformer backbone to extract features at multiple granularities. Besides, offline and online contrastive learning losses defined with respect to both global and part-level features are employed for unsupervised learning.

1. The Backbone

They start with a modified ViT that includes an IBN-based convolution stem (to improve generalization across different camera styles) and camera embeddings to help the model account for viewpoint variations.

2. Dual-Branch Architecture

Instead of a single output, the model splits into two branches at the very last layer.

  • Branch 1: Reshapes local tokens and splits them into 2 horizontal stripes.
  • Branch 2: Reshapes local tokens and splits them into 3 horizontal stripes.
  • Global Feature: The "class tokens" from both branches are averaged to create a robust global representation.

3. Unsupervised Learning via O2CAP

The model is trained using the Offline-Online Associated Camera-Aware Proxies (O2CAP) framework.

  • Offline: The model clusters images to create "pseudo-labels" and calculates a contrastive loss against these cluster centroids (proxies).
  • Online: To handle noisy clusters, it uses an online association strategy to select positive and negative samples on the fly during training. Crucially, TMGF applies these losses to every single part-level feature as well as the global feature, forcing the model to learn discriminative details.

Datasets

The researchers evaluated TMGF on three standard Re-ID benchmarks:

  • Market1501: 1,501 identities across 6 cameras.
  • DukeMTMC-reID: 1,404 identities across 8 cameras.
  • MSMT17: The largest and most difficult, featuring 4,101 identities across 15 cameras (both indoor and outdoor).

Key Insights and Ideas

  • Duplication is Key: The authors found that simply splitting the output of the last layer wasn't enough. By duplicating the last transformer layer (Layer $L$), each branch can independently learn to focus on different granularities without mixing up local cues.
  • Averaging for Balance: Averaging the global tokens from both branches outperformed using just one, as it encourages a more balanced learning process across the dual-branch structure.
  • Better Attention: Visualization shows that multi-grained features help the transformer attend to the person's body more completely and ignore distracting backgrounds or occlusions (like a pole blocking the view).
Figure 3. Visualization of attention maps. (a) color images, (b) attention maps obtained by the baseline model (TMGF1), and (c) attention maps obtained by our full model (TMGF).

Key Results

TMGF sets a new high bar for unsupervised Re-ID:

  • MSMT17: Achieved 58.2% mAP, a massive 7.6% improvement over the previous transformer-based state-of-the-art (TransReID-SSL).
  • Market1501: Reached 89.5% mAP, rivaling some supervised methods.
  • DukeMTMC-reID: Reached 76.8% mAP.

When trained with ground-truth labels (as an upper-bound test), the multi-grained approach even outperformed the standard supervised TransReID, proving that the architecture itself is highly effective at capturing identity-defining details.

Limitations and Future Work

While the paper demonstrates impressive gains, a few areas remain for exploration:

  • Computational Overhead: Duplicating layers and calculating losses for multiple parts increases training time and memory usage.
  • Inference Simplicity: During testing, the authors only use the global feature for inference to keep it efficient. While this works well, exploring how to use part-level features during testing without a massive speed penalty could be a future direction.
  • Clustering Sensitivity: Like all clustering-based unsupervised methods, the performance is still tethered to the quality of the initial pseudo-labels generated by DBSCAN.

For those interested in the implementation, the authors have pledged to release their code at https://github.com/RikoLi/WACV23-workshop-TMGF.

Summary updated

BibTeX
@misc{li2022transformer,
  author = {Jiachen Li and Menglin Wang and Xiaojin Gong},
  title = {{Transformer Based Multi-Grained Features for Unsupervised Person Re-Identification}},
  year = {2022},
  eprint = {2211.12280},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2211.12280},
}
Figure