Abstract
The development of intelligent agriculture has accelerated the automation and scale of cattle farming. Recognizing cattle faces as a significant biological characteristic is crucial for accurate reproduction and health tracking. We propose a multi-target cow face detection model (MT-CF-DM) in complex scenes based on the YOLOv7 framework. The backbone of our proposal model consists of the GhostNet and the CBAM (convolutional block attention module) attention mechanism to improve the model’s perception of various scales and features. Additionally, we propose three novel modules of the neck network: SPPFCSPC (Spatial Pyramid Pooling-Fast Cross-Stage Partial Connection), a novel BiFPN, and C2f (CSP Bottleneck with 2 convolutions). SPPFCSPC is to reduce the number of model parameters. New BiFPN is to utilize feature information and improve the model’s detection capability. C2f is to maintain the network’s lightweight nature and obtain more comprehensive gradient flow data. Moreover, a method for establishing cow face datasets is proposed based on the MT-CF-DM. During the testing phase, our model combines with a cropping module to simultaneously acquire a dataset for cow faces. The experimental results show the parameter of the proposal model is 15.8 M, the model size is 22.3 M, GFLOPs are 25.8, FPS is 97.6, mAP is 98.5%, precision is 98.8%, recall is 97.3%. Compared to YOLOv7, our proposed model reduces parameters by 56.8% and has a 48.3 increase in FPS. The model demonstrates high accuracy and small number of parameters for detecting cow faces in complex environments, suitable for edge computing system applications.


















Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.References
Parikoglou, I., Emvalomatis, G., Thorne, F.: Precision livestock agriculture and productive efficiency: the case of milk recording in Ireland. Agric. Econ. 53, 109–120 (2022). https://doi.org/10.1111/agec.12729
Piña, R., Lange, K., Machado, V., Bratcher, C.: Big data technology adoption in beef production. Smart Agric. Technol. 5, 100235 (2023). https://doi.org/10.1016/j.atech.2023.100235
Daum, T., Ravichandran, T., Kariuki, J., Chagunda, M., Birner, R.: Connected cows and cyber chickens? Stocktaking and case studies of digital livestock tools in Kenya and India. Agric. Syst. 196, 103353 (2022). https://doi.org/10.1016/j.agsy.2021.103353
Ayoub Shaikh, T., Rasool, T., Rasheed Lone, F.: Towards leveraging the role of machine learning and artificial intelligence in precision agriculture and smart farming. Comput. Electron. Agri. (2022). https://doi.org/10.1016/j.compag.2022.107119
Liu, Z., Xiang, X., Qin, J., YunTan, Q., Zhang, N.N., Xiong: Image recognition of citrus diseases based on deep learning. Comput. Mater. Contin. 66, 457–466 (2020). https://doi.org/10.32604/cmc.2020.012165
Hwang, J.-W., Park, J., Park, R.-H., Park, H.-M.: Audio-visual speech recognition based on joint training with audio-visual speech enhancement for robust speech recognition. Appl. Acoust. (2023). https://doi.org/10.1016/j.apacoust.2023.109478
Yokoi, K., Iribe, Y., Kitaoka, N., Tsuboi, T., Hiraga, K., Satake, Y., Hattori, M., Tanaka, Y., Sato, M., Hori, A., Katsuno, M.: Analysis of spontaneous speech in Parkinson’s disease by natural language processing. Parkinsonism Relat. Disord. (2023). https://doi.org/10.1016/j.parkreldis.2023.105411
Chen, X., Yang, K., Liu, X., Xu, Y., Luo, J., Zhang, S.: Efficient and accurate identification of missing tags for large-scale dynamic RFID systems. J. Syst. Archit. (2022). https://doi.org/10.1016/j.sysarc.2022.102394
Wang, H., Qin, J., Hou, Q., Gong, S.: Cattle face recognition method based on parameter transfer and deep learning. J. Phys. Conf. Ser. (2020). https://doi.org/10.1088/1742-6596/1453/1/012054
Yan, H., Cui, Q., Liu, Z.: pig face identification based on improved alexnet model. INMATEH Agric. Eng. 61, 97–104 (2020). https://doi.org/10.35633/inmateh-61-11
Li, X., Xiang, Y., Li, S.: Combining convolutional and vision transformer structures for sheep face recognition. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2023.107651
Noor, A., Zhao, Y., Koubaa, A., Wu, L., Khan, R., Abdalla, F.Y.O.: Automated sheep facial expression classification using deep transfer learning. Comput. Electron. Agric. (2020). https://doi.org/10.1016/j.compag.2020.105528
Xu, B., Wang, W., Guo, L., Chen, G., Li, Y., Cao, Z., Wu, S.: CattleFaceNet: a cattle face identification approach based on RetinaFace and ArcFace loss. Comput. Electron. Agric. (2022). https://doi.org/10.1016/j.compag.2021.106675
Sun, S., Yang, S., Zhao, L.: Noncooperative bovine iris recognition via SIFT. Neurocomputer 120, 310–317 (2013). https://doi.org/10.1016/j.neucom.2012.08.068
O’Neill, C.J., Roberts, J.J., Cozzolino, D.: Identification of beef cattle categories (cows and calves) and sex based on the near infrared reflectance spectroscopy of their tail hair. Biosys. Eng. 162, 140–146 (2017). https://doi.org/10.1016/j.biosystemseng.2017.07.007
Li, Z., Lei, X., Liu, S.: A lightweight deep learning model for cattle face recognition. Comput. Electron. Agric. (2022). https://doi.org/10.1016/j.compag.2022.106848
Hao, W., Zhang, K., Han, M., Hao, W., Wang, J., Li, F., Liu, Z.: A novel Jinnan individual cattle recognition approach based on mutual attention learning scheme. Expert Syst. Appl. (2023). https://doi.org/10.1016/j.eswa.2023.120551
Mahmud, M.S., Zahid, A., Das, A.K., Muzammil, M., Khan, M.U.: A systematic literature review on deep learning applications for precision cattle farming. Comput. Electron. Agric. (2021). https://doi.org/10.1016/j.compag.2021.106313
Ren, S., He, K., Girshick, R., Sun, J.: Faster R-CNN: towards real-time object detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 39, 1137–1149 (2017). https://doi.org/10.1109/TPAMI.2016.2577031
Li, R., Zhang, J., Zhao, X., Wang, D., Hann, M., Greaves, D.: Phase-resolved real-time forecasting of three-dimensional ocean waves via machine learning and wave tank experiments. Appl. Energy (2023). https://doi.org/10.1016/j.apenergy.2023.121529
Liu, W., Anguelov, D., Erhan, D., Szegedy, C., Reed, S., Fu, C.-Y., Berg, A. C: In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11–14, 2016, Proceedings, Part I 14, Springer, pp. 21–37 (2016)
Tan, M., Pang, R., Le, Q. V.: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020, pp. 10781–10790
Redmon, J., Divvala, S., Girshick, R., Farhadi, A.: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 779–788 (2016)
Cheng, M., Yuan, H., Wang, Q., Cai, Z., Liu, Y., Zhang, Y.: Application of deep learning in sheep behaviors recognition and influence analysis of training data characteristics on the recognition effect. Comput. Electron. Agric. (2022). https://doi.org/10.1016/j.compag.2022.107010
Ma, C., Deng, M., Yin, Y.: Pig face recognition based on improved YOLOv4 lightweight neural network. Inf. Proc. Agric. (2023). https://doi.org/10.1016/j.inpa.2023.03.004
Jiang, M., Rao, Y., Zhang, J., Shen, Y.: Automatic behavior recognition of group-housed goats using deep learning. Comput. Electron. Agric. (2020). https://doi.org/10.1016/j.compag.2020.105706
Qiao, Y., Guo, Y., He, D.: Cattle body detection based on YOLOv5-ASFF for precision livestock farming. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2022.107579
Li, C., Li, L., Jiang, H., Weng, K., Geng, Y., Li, L., Ke, Z., Li, Q., Cheng, M., Nie, W.: YOLOv6: a single-stage object detection framework for industrial applications. Comput. Vision Pattern Recognit. (2022). https://doi.org/10.48550/arXiv.2209.02976
Wang, C.-Y., Bochkovskiy, A., Liao, H.-Y. M.: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7464–7475. (2023)
Ge, Z., Liu, S., Wang, F., Li, Z., Sun, J.: Yolox: exceeding yolo series in 2021. Comput. Vision Pattern Recognit. (2021). https://doi.org/10.48550/arXiv.2107.08430
Han, K., Wang, Y., Tian, Q., Guo, J., Xu, C., Xu, C.: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1580–1589 (2020)
Woo, S., Park, J., Lee, J.-Y., Kweon, I. S.: Proceedings of the European Conference on Computer Vision (ECCV), pp. 3–19 (2018)
Wang, Z., Bovik, A.C., Sheikh, H.R., Simoncelli, E.P.: Image quality assessment: from error visibility to structural similarity. IEEE Trans. Image Proc. 13, 600–612 (2004). https://doi.org/10.1109/tip.2003.819861
He, K., Zhang, X., Ren, S., Sun, J.: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 770–778 (2016)
Howard, A.G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto, M., Adam, H.: Mobilenets: efficient convolutional neural networks for mobile vision applications. Comput. Vis. Pattern Recognit. (2017). https://doi.org/10.48550/arXiv.1704.04861
Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., Chen, L.-C.: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4510–4520 (2018)
Howard, A., Sandler, M., Chu, G., Chen, L.-C., Chen, B., Tan, M., Wang, W., Zhu, Y., Pang, R., Vasudevan, V.: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1314–1324 (2019)
Ma, N., Zhang, X., Zheng, H.-T., Sun, J.: Proceedings of the European Conference on Computer Vision (ECCV), pp. 116–131 (2018)
Zhang, X., Zhou, X., Lin, M., Sun, J.: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6848–6856 (2018)
Zhang, P., Li, D.: CBA+ASFF-YOLOXs: an improved YOLOXs for guiding agronomic operation based on the identification of key growth stages of lettuce. Comput. Electron. Agric. (2022). https://doi.org/10.1016/j.compag.2022.107491
Chen, L., Yao, H., Fu, J., Tai Ng, C.: The classification and localization of crack using lightweight convolutional neural network with CBAM. Eng. Struct. (2023). https://doi.org/10.1016/j.engstruct.2022.115291
Yuan, C., Liu, T., Gao, F., Zhang, R., Seng, X.: YOLOv5s-CBAM-DMLHead: a lightweight identification algorithm for weedy rice (Oryza sativa f. spontanea) based on improved YOLOv5. Crop Prot. (2023). https://doi.org/10.1016/j.cropro.2023.106342
He, K., Zhang, X., Ren, S., Sun, J.: Spatial pyramid pooling in deep convolutional networks for visual recognition. IEEE Trans. Pattern Anal. Mach. Intell. 37, 1904–1916 (2015). https://doi.org/10.1109/TPAMI.2015.2389824
He, K., Gkioxari, G., Dollár, P., Girshick, R.: Proceedings of the IEEE International Conference on Computer Vision, pp. 2961–2969 (2017)
Liu, S., Qi, L., Qin, H., Shi, J., Jia, J.: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8759–8768 (2018)
Lin, T.-Y., Dollár, P., Girshick, R., He, K., Hariharan, B., Belongie, S.: Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2117–2125 (2017)
Liu, Z., Lin, Y., Cao, Y., Hu, H., Wei, Y., Zhang, Z., Lin, S., Guo B.: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10012–10022 (2021)
Li, H., Li, J., Wei, H., Liu, Z., Zhan, Z., Ren, Q. J.:Slim-neck by GSConv: as better design paradigm of detector architectures for autonomous vehicles (2022)
Zheng, Z., Li, J., Qin, L.: YOLO-BYTE: an efficient multi-object tracking algorithm for automatic monitoring of dairy cows. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2023.107857
Li, J., Li, J., Zhao, X., Su, X., Wu, W.: Lightweight detection networks for tea bud on complex agricultural environment via improved YOLO v4. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2023.107955
Zhang, Q., Yang, Q., Zhang, X., Wei, W., Bao, Q., Su, J., Liu, X.: A multi-label waste detection model based on transfer learning. Resour. Conserv. Recycl. (2022). https://doi.org/10.1016/j.resconrec.2022.106235
Wang, S.-Y., Qu, Z., Li, C.-J., Gao, L.-Y.: BANet: Small and multi-object detection with a bidirectional attention network for traffic scenes. Eng. Appl. Artif. Intell. (2023). https://doi.org/10.1016/j.engappai.2022.105504
Zhang, F., Wang, S., Cui, X., Wang, X., Cao, W., Yu, H., Fu, S., Pan, X.: Goat-face recognition in natural environments using the improved YOLOv4 algorithm. Agriculture (2022). https://doi.org/10.3390/agriculture12101668
Wang, Z., Ling, Y., Wang, X., Meng, D., Nie, L., An, G., Wang, X.: An improved faster R-CNN model for multi-object tomato maturity detection in complex scenarios. Ecol. Inf. 72, 101886 (2022)
Wu, L., Ma, J., Zhao, Y., Liu, H.: Apple detection in complex scene using the improved YOLOv4 model. Agronomy (2021). https://doi.org/10.3390/agronomy11030476
Xu, L., Wang, Y., Shi, X., Tang, Z., Chen, X., Wang, Y., Zou, Z., Huang, P., Liu, B., Yang, N., Lu, Z., He, Y., Zhao, Y.: Real-time and accurate detection of citrus in complex scenes based on HPL-YOLOv4. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2022.107590
Xiao, J., Liu, G., Wang, K., Si, Y.: Cow identification in free-stall barns based on an improved Mask R-CNN and an SVM. Comput. Electron. Agric. (2022). https://doi.org/10.1016/j.compag.2022.106738
Gu, Z., Zhang, H., He, Z., Niu, K.: A two-stage recognition method based on deep learning for sheep behavior. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2023.108143
Yang, W., Wu, J., Zhang, J., Gao, K., Du, R., Wu, Z., Firkat, E., Li, D.: Deformable convolution and coordinate attention for fast cattle detection. Comput. Electron. Agric. (2023). https://doi.org/10.1016/j.compag.2023.108006
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflict of interest
The authors have no relevant financial or non-financial interests to disclose.
Data availability
The datasets generated during the current study are available from the corresponding author on reasonable request.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Lei, X., Wen, X. & Li, Z. A multi-target cow face detection model in complex scenes. Vis Comput 40, 9155–9176 (2024). https://doi.org/10.1007/s00371-024-03301-w
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00371-024-03301-w