SparseFormer: Detecting Objects in HRW Shots via Sparse Vision Transformer

Wenxi Li, Yuchen Guo, Jilai Zheng, Haozhe Lin, Chao Ma, Lu Fang, Xiaokang Yang · DOI · OpenReview

Abstract

SparseFormer is a novel, model-agnostic sparse vision transformer designed specifically for object detection in gigapixel-level, High-Resolution Wide (HRW) shots. By selectively applying fine-grained attention only to "important" image regions while using efficient aggregated features for global context, it achieves state-of-the-art accuracy (up to 5.8% AP gain) and significant speedups (up to 3x) over existing detectors.

Introduction

Standard object detectors, such as YOLO or DINO, are typically optimized for datasets like MS COCO, where objects are relatively large and centrally located. However, High-Resolution Wide (HRW) shots—common in UAV (drone) surveillance and gigapixel-level photography—present two massive hurdles:

  1. Extreme Sparsity: Objects often occupy less than 5% of the total image area. Standard detectors waste immense computational power processing "empty" background noise.
  2. Huge Scale Variation: Within a single gigapixel shot, object sizes can vary by a factor of 100x (e.g., a distant pedestrian vs. a nearby bus). Fixed receptive fields in standard models struggle to capture both extremes simultaneously.

Furthermore, because these images are too large for GPU memory, they must be "sliced" into patches. This often leads to "cut-off" objects at the boundaries, which standard Non-Maximum Suppression (NMS) fails to merge correctly.

Methodology

SparseFormer bridges the gap between global context and local detail through several novel components designed to handle the unique constraints of HRW imagery.

The SparseFormer pipeline: from multi-scale slicing to cross-slice NMS.

Core Components

  • Global Attention on Aggregated Features: To capture long-range dependencies without the $O(N^2)$ cost of full-resolution attention, SparseFormer aggregates tokens within a window into a single representative feature. It performs global attention on these "coarse" tokens to understand the overall scene.
  • Local Attention on Sparse Windows (ScoreNet): This is the core "sparse" mechanism. An MLP-based ScoreNet calculates the variance of features within each window. Windows with high variance (indicating complex details or potential objects) are prioritized for fine-grained local attention, while background windows are processed only at a coarse level.
  • Cross-slice NMS (C-NMS): Standard NMS relies on confidence scores to pick the best bounding box. In HRW slicing, a high-confidence box might only cover half an object. C-NMS modifies this logic to prioritize the area of the bounding box, ensuring that complete boxes are favored over high-scoring fragments.
  • End-to-End Optimization: To make the discrete "keep/drop" window selection differentiable, the authors employ the Gumbel-Softmax trick, allowing the ScoreNet to be trained alongside the rest of the transformer.

Key Results and Discussion

The model was evaluated on two primary HRW benchmarks: PANDA (human-centric gigapixel-level) and DOTA-v1.0 (aerial images).

Accuracy vs. Object Area: SparseFormer consistently outperforms YOLOv8 and DINO across all scales.
  • Accuracy: On the PANDA dataset, SparseFormer outperformed state-of-the-art (SotA) models like DINO and PAN by up to 5.8% AP. As shown in the performance analysis across object areas, SparseFormer maintains a significant accuracy lead regardless of object size.
  • Speed and Efficiency: The model achieved a 3x speedup compared to PAN. By discarding or down-processing up to 70-90% of the image background, SparseFormer reduced GFLOPs by up to 50%, making it viable for deployment on power-constrained UAVs like the NVIDIA AGX Orin.

Conclusion

SparseFormer demonstrates that variance can serve as an effective proxy for information density in HRW shots. By focusing computational resources on complex regions, it achieves superior performance and efficiency. Future work will address hyperparameter sensitivity regarding the window "keeping ratio" and explore truly slice-less approaches for gigapixel imagery.

Summary updated

BibTeX
@inproceedings{li2024sparseformer,
  author = {Wenxi Li and Yuchen Guo and Jilai Zheng and Haozhe Lin and Chao Ma and Lu Fang and Xiaokang Yang},
  title = {{SparseFormer: Detecting Objects in HRW Shots via Sparse Vision Transformer}},
  booktitle = {ACM Multimedia},
  year = {2024},
  doi = {10.1145/3664647.3681043},
}
Figure