Dynamic_Bottleneck Module Fusing Dynamic Convolution and Sparse Spatial Attention for Individual Cow Identification
Simple Summary
Abstract
1. Introduction
- In order to effectively extract the multi-scale features, we designed a dynamic convolution module Dy_Conv with a parallel structure of multiple branches. Dy_Conv generates feature maps with receptive fields of different sizes, allowing the model to simultaneously focus on the global features and back pattern features of cows.
- We constructed the Dynamic_Bottleneck module combining Dy_Conv with S2Attention, and replaced the 1st and 4th bottleneck layer of Resnet50, reducing computational complexity while efficiently fusing the multi-scale features. This helped the model to be applied to different cowsheds with complex environments.
- We embedded QAConv into the front of Resnet50, which adjusted the parameters and sizes of convolution kernels to adapt to the scale changes in cow targets in input images.
- To enhance the perception of local details, NAM attention mechanism was introduced into the backend of Resnet50 to achieve the feature fusion in the channels and spatial dimensions, which contributed to better distinguish visually similar individual cows.
2. Materials and Methods
2.1. Experimental Dataset
2.2. Methods
2.2.1. Low-Level Feature Extraction Based on QAConv
2.2.2. Dynamic_Bottleneck for Multi-Scale Feature Extraction
2.2.3. NAM for the Fusion of Channels and Spatial Features
3. Results
3.1. Experimental Details
3.2. Ablation Experiments
3.3. Model Evaluation
3.4. Visualization of Feature Maps
4. Discussion
4.1. Advantage of Dynamic_Bottleneck Design
4.2. Comparison Between NAM and Mainstream Attentions
4.3. Application on Cowsheds
4.4. Accuracy and Limitations
5. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Hossain, M.E.; Kabir, M.A.; Zheng, L.; Swain, D.L.; McGrath, S.; Medway, J. A systematic review of machine learning techniques for cattle identification: Datasets, methods and future directions. Artif. Intell. Agric. 2022, 6, 138–155. [Google Scholar] [CrossRef]
- Garcia, R.; Aguilar, J.; Toro, M.; Pinto, A.; Rodriguez, P. A systematic literature review on the use of machine learning in precision livestock farming. Comput. Electron. Agric. 2020, 179, 105826. [Google Scholar] [CrossRef]
- Ramudzuli, Z.R.; Malekian, R.; Ye, N. Design of a RFID system for real-time tracking of laboratory animals. Wirel. Pers. Commun. 2017, 95, 3883–3903. [Google Scholar] [CrossRef]
- Mora, M.; Piles, M.; David, I.; Rosa, G.J. Integrating computer vision algorithms and RFID system for identification and tracking of group-housed animals: An example with pigs. J. Anim. Sci. 2024, 102, skae174. [Google Scholar] [CrossRef]
- Yukun, S.; Pengju, H.; Yujie, W.; Ziqi, C.; Yang, L.; Baisheng, D.; Runze, L.; Yonggen, Z. Automatic monitoring system for individual dairy cows based on a deep learning framework that provides identification via body parts and estimation of body condition score. J. Dairy Sci. 2019, 102, 10140–10151. [Google Scholar] [CrossRef] [PubMed]
- Parivendan, S.; Sailunaz, K.; Neethirajan, S. Socializing AI: Integrating Social Network Analysis and Deep Learning for Precision Dairy Cow Monitoring—A Critical Review. Animals 2025, 15, 1835. [Google Scholar] [CrossRef]
- Sun, Y.P.; Jiang, Y.; Wang, Z.; Zhang, Y.; Zhang, L.L. Wild Bird Species Identification Based on a Lightweight Model With Frequency Dynamic Convolution. IEEE Access 2023, 11, 54352–54362. [Google Scholar] [CrossRef]
- Zhao, Y.; Zhu, S. Occluded pedestrian re-identification via Res-ViT double-branch hybrid network. Multimed. Syst. 2024, 30, 5. [Google Scholar] [CrossRef]
- Tang, H.; Fei, L.; Zhu, H.; Tao, H.; Xie, C. A Two-Stage Network for Zero-Shot Low-Illumination Image Restoration. Sensors 2023, 23, 792. [Google Scholar] [CrossRef]
- Kumar, S.; Pandey, A.; Satwik, K.S.R.; Kumar, S.; Singh, S.K.; Singh, A.K.; Mohan, A. Deep learning framework for recognition of cattle using muzzle point image pattern. Measurement 2018, 116, 1–17. [Google Scholar] [CrossRef]
- Weng, Z.; Meng, F.; Liu, S.; Zhang, Y.; Zheng, Z.; Gong, C. Cattle face recognition based on a Two-Branch convolutional neural network. Comput. Electron. Agric. 2022, 196, 106871. [Google Scholar] [CrossRef]
- Shen, W.; Hu, H.; Dai, B.; Wei, X.; Sun, J.; Jiang, L.; Sun, Y. Individual identification of dairy cows based on convolutional neural networks. Multimed. Tools Appl. 2020, 79, 14711–14724. [Google Scholar] [CrossRef]
- Hu, H.; Dai, B.; Shen, W.; Wei, X.; Sun, J.; Li, R.; Zhang, Y. Cow identification based on fusion of deep parts features. Biosyst. Eng. 2020, 192, 245–256. [Google Scholar] [CrossRef]
- Zhang, H.; Zheng, L.; Tan, L.; Gao, J.; Luo, Y. YOLOX-S-TKECB: A Holstein Cow Identification Detection Algorithm. Agriculture 2024, 14, 1982. [Google Scholar] [CrossRef]
- Weng, Z.; Liu, S.; Zheng, Z.; Zhang, Y.; Gong, C. Cattle facial matching recognition algorithm based on multi-view feature fusion. Electronics 2022, 12, 156. [Google Scholar] [CrossRef]
- Yang, L.; Xu, X.; Zhao, J.; Song, H. Fusion of retinaface and improved facenet for individual cow identification in natural scenes. Inf. Process. Agric. 2024, 11, 512–523. [Google Scholar] [CrossRef]
- Chen, X.; Yang, T.; Mai, K.; Liu, C.; Xiong, J.; Kuang, Y.; Gao, Y. Holstein cattle face re-identification unifying global and part feature deep network with attention mechanism. Animals 2022, 12, 1047. [Google Scholar] [CrossRef]
- Qiao, Y.; Kong, H.; Clark, C.; Lomax, S.; Su, D.; Eiffert, S.; Sukkarieh, S. Intelligent perception for cattle monitoring: A review for cattle identification, body condition score evaluation, and weight estimation. Comput. Electron. Agric. 2021, 185, 106143. [Google Scholar] [CrossRef]
- Wang, B.; Li, X.; An, X.; Duan, W.; Wang, Y.; Wang, D.; Qi, J. Open-Set Recognition of Individual Cows Based on Spatial Feature Transformation and Metric Learning. Animals 2024, 14, 1175. [Google Scholar] [CrossRef]
- Ferreira, R.E.; Bresolin, T.; Rosa, G.J.; Dórea, J.R. Using dorsal surface for individual identification of dairy calves through 3D deep learning algorithms. Comput. Electron. Agric. 2022, 201, 107272. [Google Scholar] [CrossRef]
- Andrew, W.; Hannuna, S.; Campbell, N.; Burghardt, T. Automatic individual holstein friesian cattle identification via selective local coat pattern matching in RGB-D imagery. In Proceedings of the 2016 IEEE International Conference on Image Processing (ICIP), Phoenix, AZ, USA, 25–28 September 2016; IEEE: New York, NY, USA; pp. 484–488. [Google Scholar] [CrossRef]
- Zhao, K.; Wang, J.; Chen, Y.; Sun, J.; Zhang, R. Individual Identification of Holstein Cows from Top-View RGB and Depth Images Based on Improved PointNet++ and ConvNeXt. Agriculture 2025, 15, 710. [Google Scholar] [CrossRef]
- Andrew, W.; Gao, J.; Mullan, S.; Campbell, N.; Dowsey, A.W.; Burghardt, T. Visual identification of individual Holstein-Friesian cattle via deep metric learning. Comput. Electron. Agric. 2021, 185, 106133. [Google Scholar] [CrossRef]
- Qiao, Y.; Clark, C.; Lomax, S.; Kong, H.; Su, D.; Sukkarieh, S. Automated individual cattle identification using video data: A unified deep learning architecture approach. Front. Anim. Sci. 2021, 2, 759147. [Google Scholar] [CrossRef]
- Du, Y.; Kou, Y.; Li, B.; Qin, L.; Gao, D. Individual identification of dairy cows based on deep learning and feature fusion. Anim. Sci. J. 2022, 93, e13789. [Google Scholar] [CrossRef]
- Liao, S.; Shao, L. Interpretable and generalizable person re-identification with query-adaptive convolution and temporal lifting. In Proceedings of the Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020; Part XI 16. Springer International Publishing: Cham, Switzerland, 2020; pp. 456–474. [Google Scholar] [CrossRef]
- Yu, T.; Li, X.; Cai, Y.; Sun, M.; Li, P. S2-MLPV2: Improved spatial-shift MLP architecture for vision. arXiv 2021, arXiv:2108.01072. [Google Scholar]
- Liu, Y.; Shao, Z.; Teng, Y.; Hoffmann, N. NAM: Normalization-based attention module. arXiv 2021. [Google Scholar] [CrossRef]
- Sergey, I.; Christian, S. Batch normalization: Accelerating deep network training byreducing internal covariate shift. In Proceedings of the International Conference on Machine Learning 2015, Lille, France, 7–9 July 2015; pp. 448–456. [Google Scholar]
- Yu, J.; Su, H.; Liu, J.; Yang, Z.; Zhang, Z.; Zhu, Y.; Yang, L.; Jiao, B. A strong baseline for tiger re-id and its bag of tricks. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, Seoul, Republic of Korea, 27–28 October 2019. [Google Scholar]
- Liu, C.; Zhang, R.; Guo, L. Part-pose guided amur tiger re-identification. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, Seoul, Republic of Korea, 27–28 October 2019. [Google Scholar]
- Dai, Z.; Chen, M.; Gu, X.; Zhu, S.; Tan, P. Batch dropblock network for person re-identification and beyond. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Seoul, Republic of Korea, 27 October–2 November 2019; pp. 3691–3701. [Google Scholar]
- Zhou, K.; Yang, Y.; Cavallaro, A.; Xiang, T. Learning generalisable omni-scale representations for person re-identification. IEEE Trans. Pattern Anal. Mach. Intell. 2021, 44, 5056–5069. [Google Scholar] [CrossRef] [PubMed]
Model | Rank-1 | Rank-5 | mAP | Parameters |
---|---|---|---|---|
ResNet50 | 89.7% | 95.6% | 90.8% | 23,508,032 |
ResNet50 + QAConv | 94.6% | 96.8% | 93.7% | 23,508,317 |
ResNet50 + QAConv + Dynamic_Bottleneck × 2 (no S2Attention) | 94.3% | 97.2% | 94.1% | 16,473,629 |
ResNet50 + QAConv + Dynamic_Bottleneck × 4 (no S2Attention) | 93.1% | 95.5% | 92.8% | 12,526,848 |
ResNet50 + QAConv + Dynamic_Bottleneck × 2 (with S2Attention) | 95.7% | 97.6% | 94.7% | 19,675,421 |
ResNet50 + QAConv + Dynamic_Bottleneck × 4 (with S2Attention) | 94.9% | 97.4% | 93.6% | 17,571,840 |
ResNet50 + QAConv + Dynamic_Bottleneck + NAM (with 2 Dynamic_Bottleneck layers) | 96.8% | 98.9% | 95.3% | 19,679,517 |
Dynamic_Bottleneck | Attention Mechanism | Rank-1 | Rank-5 | mAP | Parements |
---|---|---|---|---|---|
(with S2Attention) | CBAM | 92.7% | 96.4% | 93.4% | 23,512,128 |
GAM | 93.3% | 97.8% | 93.7% | 23,843,705 | |
NAM | 96.8% | 98.9% | 95.3% | 19,679,517 | |
(with SE Attention) | NAM | 95.7% | 96.8% | 94.1% | 16,669,248 |
ID Number | Cow1 | Cow2 | Cow3 | Cow4 | Cow5 | Cow6 | Cow7 | Total |
---|---|---|---|---|---|---|---|---|
Number of images | 8 | 11 | 5 | 8 | 9 | 4 | 5 | 50 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Qi, H.; Song, T.; Zhao, Y. Dynamic_Bottleneck Module Fusing Dynamic Convolution and Sparse Spatial Attention for Individual Cow Identification. Animals 2025, 15, 2519. https://doi.org/10.3390/ani15172519
Qi H, Song T, Zhao Y. Dynamic_Bottleneck Module Fusing Dynamic Convolution and Sparse Spatial Attention for Individual Cow Identification. Animals. 2025; 15(17):2519. https://doi.org/10.3390/ani15172519
Chicago/Turabian StyleQi, Haobo, Tianxiong Song, and Yaqin Zhao. 2025. "Dynamic_Bottleneck Module Fusing Dynamic Convolution and Sparse Spatial Attention for Individual Cow Identification" Animals 15, no. 17: 2519. https://doi.org/10.3390/ani15172519
APA StyleQi, H., Song, T., & Zhao, Y. (2025). Dynamic_Bottleneck Module Fusing Dynamic Convolution and Sparse Spatial Attention for Individual Cow Identification. Animals, 15(17), 2519. https://doi.org/10.3390/ani15172519