A density difference-aware transformer for accurate underwater fish counting in aquaculture
摘要
Fish counting is essential for assessing aquatic ecosystem health, enhancing aquaculture profitability, supporting biodiversity conservation, and improving fishery management. However, current research in this field still faces significant challenges, including frequent occlusion in high-density environment, uneven fish distribution within images, and inconsistent density across images. To overcome these issues, this study introduces a density difference-aware fish counting network. The proposed approach consists of three key components. First, a Density-Aware Structural Alignment Module is designed to improve the clarity and focus of image features by modeling the structural continuity and consistency among neighboring fish. This helps reduce ambiguity in regions where fish overlap in dense populations. Second, a Density-Guided Hierarchical Attention is developed, which uses learnable tokens to represent regional density information. This mechanism employs a parallel attention strategy to dynamically allocate computational resources between dense and sparse areas, thereby addressing the imbalance of fish distribution within an image. Finally, a Density-Anchor Context Fusion Mechanism is introduced. It uses semantic tokens as anchors to maintain consistency across different density scales and employs cross-attention to enable adaptive multi-scale feature fusion. This enhances the model’s ability to generalize across various real-world scenarios. On the Underwater Grass Carp Counting Dataset, with an average of 36.96 fish per test image, the network’s mean absolute error was 3.36 fish per image, and its root mean squared error was 4.76 fish per image. The proposed method also achieved improvements on the Carp Count Dataset and the Dense Grass Carp Counting Dataset. These results confirm that the proposed model offers a robust tool to support intelligent aquaculture and sustainable fishery management.