GCA-SUN: A Gated Context-Aware Swin-UNet for Exemplar-Free Counting

Yuzhe Wu, Yipeng Xu, Tianyu Xu, Jialu Zhang, Jianfeng Ren, Xudong Jiang · DOI

Abstract

Exemplar-Free Counting (EFC) represents a significant advancement in computer vision, enabling models to count objects in an image without external guidance or visual examples. We introduce GCA-SUNet, a novel architecture that integrates specialized gating mechanisms into a Swin-UNet framework. By utilizing Gated Context-Aware Modulation (GCAM), a Gated Enhanced Feature Selector (GEFS), and a Gated Adaptive Fusion Unit (GAFU), the model effectively identifies repeating salient patterns while suppressing background noise. GCA-SUNet achieves state-of-the-art performance on the FSC-147 benchmark with a Mean Absolute Error (MAE) of 14.08 and demonstrates robust generalization on the CARPK dataset.

Introduction

Object counting has evolved through several paradigms, from class-specific models (e.g., counting cars) to class-agnostic models requiring visual exemplars or text prompts. The ultimate goal is Exemplar-Free Counting (EFC), where a system autonomously identifies and counts repeating objects of interest. The primary challenges in EFC are differentiating "countable" objects from complex backgrounds and managing feature interference, where low-level textures are shared between foreground and background.

Methodology

The GCA-SUNet architecture addresses these challenges by augmenting the Swin-UNet framework with three hierarchical gating modules designed to prune noise and enhance object saliency.

The GCA-SUNet architecture featuring the Gated Context-Aware Modulation (GCAM), Gated Enhanced Feature Selector (GEFS), and Gated Adaptive Fusion Unit (GAFU) modules.

Gated Context-Aware Modulation (GCAM)

Located in the encoder, GCAM identifies objects by evaluating both saliency (how a token stands out) and self-similarity (how a token relates to others in the image). A gating mechanism is employed to suppress tokens that do not contribute to the repeating pattern of interest.

Gated Enhanced Feature Selector (GEFS)

Positioned at the network's bottleneck, GEFS acts as a semantic filter. It ensures that only the most relevant features—those corresponding to countable objects—are passed from the encoder's compression stage to the decoder's reconstruction stage.

Gated Adaptive Fusion Unit (GAFU)

Standard UNet skip connections often carry background noise into the decoder. GAFU uses a gate to selectively weigh these features, prioritizing information necessary for density map reconstruction while filtering out interference.

Key Insights: The Power of Suppression

A central theme of GCA-SUNet is that effective counting is as much about ignoring the background as it is about finding the objects. By treating the image as its own reference, the model uses self-similarity as a proxy for supervision. If a pattern repeats frequently and is salient, the GCAM module prioritizes it.

Visualization of the GCAM module's impact. The module effectively suppresses background noise (b) to highlight the objects of interest (c).

Experimental Results

The model was evaluated on two major benchmarks: FSC-147, a large-scale class-agnostic dataset, and CARPK, used for cross-domain evaluation.

  • FSC-147 Performance: GCA-SUNet achieved a Mean Absolute Error (MAE) of 14.08 and a Root Mean Squared Error (RMSE) of 84.77, significantly outperforming the previous best EFC method, RCC (MAE 17.12).
  • Generalization: In cross-domain tests on the CARPK dataset, the model achieved an MAE of 10.96, surpassing the previous state-of-the-art, CounTR (MAE 11.52).
  • Ablation Studies: Results indicated that all three gated modules are essential, with GCAM being the most critical for error reduction.

Conclusion and Future Work

GCA-SUNet sets a new standard for exemplar-free counting by systematically suppressing background noise across the network hierarchy. While the model is highly robust, its performance can degrade in extremely high-density scenes where individual objects are difficult to distinguish. Future research will focus on optimizing the architecture for small-object density and improving computational efficiency, as the current model has a relatively high parameter count (192M).

Summary updated

BibTeX
@inproceedings{wu2025gca,
  author = {Yuzhe Wu and Yipeng Xu and Tianyu Xu and Jialu Zhang and Jianfeng Ren and Xudong Jiang},
  title = {{GCA-SUN: A Gated Context-Aware Swin-UNet for Exemplar-Free Counting}},
  booktitle = {ICME},
  year = {2025},
  doi = {10.1109/icme59968.2025.11208906},
}
Figure