Ultra-Fine-Grained Fish Recognition with a Pruned Lightweight Transformer Based on Few-Shot Learning
Abstract
Reliable identification and behavioural tracking of individual fish are increasingly required in aquaculture monitoring and ecological conservation, yet such tasks often rely on extremely limited image samples. Individual-level fish recognition remains challenging because subtle inter-individual variations in stripe patterns, spots and body markings are difficult to distinguish, while annotated datasets are scarce and costly to construct. To address these challenges, this study proposes Squeeze-and-Excitation Feature-Fusion Window Transformer (SEFFwin), a lightweight vision Transformer derived from Swin Transformer V2 for ultra-fine-grained fish recognition under extreme few-shot conditions. Through structured pruning, the SEFFwin backbone contains approximately 11.30 million parameters, excluding the task-specific classification layer. To support evaluation, we construct Koi-fish-3, a dedicated few-shot benchmark consisting of three individual koi categories, with only two training images and 100 validation images per class. Transfer learning, data augmentation and knowledge distillation are further incorporated to improve model optimisation under severely limited supervision. Experimental results show that SEFFwin achieves 92.0% top-1 accuracy on Koi-fish-3, outperforming representative lightweight baselines while maintaining high computational efficiency. Post-hoc interpretability analysis indicates that SEFFwin consistently attends to biologically meaningful stripe and spot patterns and can weakly localise class-specific regions. These findings demonstrate that SEFFwin provides an accurate and efficient solution for individual fish recognition under extreme data scarcity, offering practical value for intelligent aquaculture and ecological monitoring, while also providing insights into compact Transformer design for low-resource fine-grained recognition.