Abstract
Text-based person search aims to retrieve specific pedestrian images from a large gallery based on natural language descriptions. This task is challenging due to the modality gap between visual and textual data, as well as the low inter-class variance among pedestrians. We present NAFS (Non-local Alignment over Full-Scale representations), a framework that adaptively aligns image regions and text snippets across multiple scales. By utilizing a staircase backbone and locality-constrained BERT, NAFS achieves state-of-the-art performance on the CUHK-PEDES benchmark.
Introduction
Searching for a specific person using only a sentence—such as "a woman wearing a red coat and carrying a black purse"—is a complex task for computer vision systems. Traditional methods often struggle with two major hurdles: the modality gap (comparing pixels to words) and low inter-class variance (the inherent similarity in pedestrian appearance).
Existing models typically rely on rigid matching, either at a global level (whole sentence to whole image) or a fixed local level (horizontal image stripes to specific phrases). However, human descriptions are naturally multi-scale. A word like "woman" refers to the global silhouette, while "striped shirt" refers to a regional torso, and "silver buckle" refers to a fine-grained patch. To address this, we propose looking at everything from global silhouettes to tiny patches simultaneously through a multi-scale alignment strategy.
Methodology: The NAFS Framework
The NAFS framework introduces three major components to facilitate fluid, cross-scale alignment:
1. Staircase Backbone Network
To extract full-scale image features, we utilize a modified ResNet-50 architecture with three distinct branches: Global, Region, and Patch. A key innovation here is the Split & Shuffle operation. During training, image stripes are randomly reordered to prevent the model from relying solely on spatial priors (e.g., heads are always at the top). This forces the network to learn the actual visual content of specific attributes regardless of their global position.
2. Locality-Constrained BERT
On the textual side, we employ BERT to extract features at three hierarchical levels: the entire sentence, sub-sentences (delimited by punctuation), and individual words. We implement a locality constraint within the transformer layers, ensuring that tokens primarily attend to others within their specific scale, thereby preserving the granularity of the information.
3. Contextual Non-Local Attention
This module acts as the core alignment engine. Rather than forcing Scale 1 text to match only Scale 1 images, the Contextual Non-Local Attention mechanism allows every textual representation to "look" at every visual representation across all scales. This adaptive process determines which image parts—at any level of detail—best correspond to specific text segments.
Experimental Results
Performance on CUHK-PEDES
We evaluated NAFS on the CUHK-PEDES dataset, the primary large-scale benchmark for text-based person search, containing over 40,000 images and 13,000 unique identities. NAFS set a new state-of-the-art benchmark:
- Top-1 Accuracy: 59.94% (increasing to 61.50% with Re-ranking by Visual Neighbors, or RVN).
- Comparison: This represents a 5.53% improvement over the previous leading method (ViTAA).
- Top-10 Accuracy: Reached 87.51%, demonstrating robust retrieval capabilities.
Key Insights
- Fluid Alignment: Visualization of the attention maps confirms that the model correctly maps coarse words (e.g., "girl") to global features and fine-grained phrases (e.g., "white shoes") to specific patches.
- Joint vs. Separate Alignment: Our ablation studies proved that "Joint Alignment" (allowing all scales to interact simultaneously) significantly outperforms "Separate Alignment" (matching scale-by-scale and summing results).
- Structural Importance: Removing the staircase structure or the non-local attention module resulted in performance drops of 2-4%, validating the necessity of each component.
Conclusion and Future Work
NAFS demonstrates that breaking away from rigid, single-scale matching is essential for effective text-based person search. By allowing for fluid, cross-scale interactions, the model better captures the nuances of human descriptions. Future research will focus on reducing the computational complexity of the dual-backbone (ResNet + BERT) approach to improve inference latency for real-time applications and testing the framework's robustness on more diverse, "in-the-wild" datasets.
Summary updated