Research Article

Optimizing Token Fusion Mechanisms in Swin Transformer for Improved Feature Representation and Fine-Grained Insect Classification

Qiming Li*
Faculty of Engineering, The University of New South Wales, Sydney, Australia

* Corresponding author: [email protected]

Abstract

Effective pest monitoring is critical for ensuring global food security, as insect pests pose significant threats to crop yields and agricultural sustainability. Traditional pest identification methods rely on manual inspection, which is time-consuming, labor-intensive, and susceptible to human error. Deep learning, particularly Convolutional Neural Networks (CNNs), has been widely applied to automate insect classification; however, these models exhibit limitations in capturing long-range dependencies and hierarchical feature representations. Transformer-based architectures, such as Swin Transformer, have demonstrated improved performance in vision tasks, yet their effectiveness in fine-grained insect classification remains constrained by cross-window communication inefficiencies and suboptimal hierarchical feature aggregation. This study proposes an enhanced Swin Transformer model incorporating a Token Fusion mechanism to address these limitations. The proposed Cross-Window Token Fusion (CWTF) facilitates feature propagation across non-overlapping windows, while Hierarchical Token Fusion (HTF) enhances multi-scale representation learning. Experimental evaluations on the IP102 dataset, a large-scale benchmark for insect classification, demonstrate that the proposed model outperforms CNN-based and standard Transformer-based models in classification accuracy while maintaining computational efficiency. The findings highlight Token Fusion’s effectiveness in strengthening feature interactions, thereby advancing the development of highly accurate and computationally efficient automated pest monitoring systems. This research contributes to the broader adoption of Transformer-based architectures in precision agriculture, enhancing real-time pest surveillance and sustainable crop management.

Keywords: IP102; Token Fusion; Swin Transformer; Long-Range Dependencies
Published: April 24, 2025
DOI: 10.54254/2755-2721/2025.KL22294
Volume: ACE Vol.142
pp. 151-160
Download PDF

References

  1. Wu, X., Zhan, C., Lai, Y.K., Cheng, M.M. and Yang, J. (2019) IP102: A large-scale benchmark dataset for insect pest recognition. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8787-8796. Available at: https://openaccess.thecvf.com/content_CVPR_2019/papers/Wu_IP102_A_Large-Scale_Benchmark_Dataset_for_Insect_Pest_Recognition_CVPR_2019_paper.pdf
  2. Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S. and Guo, B. (2021) Swin transformer: Hierarchical vision transformer using shifted windows. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 10012-10022. Available at: https://arxiv.org/abs/2103.14030
  3. Setiawan, A., Yudistira, N. and Wihandika, R.C. (2022) Large-scale pest classification using efficient convolutional neural network with augmentation and regularizers. Computers and Electronics in Agriculture, 200. Available at: https://www.sciencedirect.com/science/article/pii/S0168169922005191
  4. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, L. and Polosukhin, I. (2017) Attention is all you need. Advances in Neural Information Processing Systems (NeurIPS), 30.
  5. Yoo, D., Kim, J. and Yoo, J. (2024) FSwin Transformer: Feature-Space Window Attention Vision Transformer for Image Classification. IEEE Access, 12, pp. 72598-72606. Available at: https://ieeexplore.ieee.org/abstract/document/10509828#citations
  6. Kim, M., Gao, S., Hsu, Y.-C., Shen, Y. and Jin, H. (2024) Token Fusion: Bridging the Gap between Token Pruning and Token Merging. Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pp. 372-382. Available at: https://arxiv.org/abs/2312.01026
  7. He, K., Zhang, X., Ren, S. and Sun, J. (2016) Deep residual learning for image recognition. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770-778. Available at: https://arxiv.org/abs/1512.03385
  8. Khanam, R. and Hussain, M. (2024) YOLOv11: An Overview of the Key Architectural Enhancements. Available at: https://doi.org/10.48550/arXiv.2410.17725
  9. Ma, J., Tang, L., Fan, F., Huang, J., Mei, X. and Ma, Y. (2022) SwinFusion: Cross-domain long-range learning for general image fusion via Swin Transformer. IEEE/CAA Journal of Automatica Sinica, 9, pp. 1200-1217. doi: 10.1109/JAS.2022.105686
  10. Lee, S., Choi, J. and Kim, H.J. (2024) Multi-criteria token fusion with one-step-ahead attention for efficient vision transformers. Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 741-751. Available at: https://arxiv.org/abs/2403.10030.