Segmenting Live Cattle using a New Approach to Combine Superpixels and SegNets

  • Diogo Nunes Gonçalves UCDB / UFMS
  • Wesley Nunes Gonçalves UFMS
  • Rodrigo da Costa Gomes EMBRAPA
  • Anderson Viçoso de Araujo UFMS
  • Julia Gindri Bragato Pistori UCDB
  • Gabriel Toshio Hirokawa Higa UCDB
  • Vanessa Aparecida de Moraes Weber UCDB / UEMS / KeroW Soluções de precisão
  • Hemerson Pistori UCDB / UFMS


A new strategy for cattle image segmentation is proposed by combining the strengths of SegNets and superpixel classification using CNNs. The individual strengths of these segmentation techniques can be seen as complementary. Thus, we investigate the combination of both through the following operators: MEAN, MULT, MAX, OR, and AND. This new approach is tested on a dataset containing 154 labeled images from cattle captured in a real livestock farm scenario, with complex poses and background. A pixelwise accuracy of 94.1% has being achieved by the proposed approach, which is higher than the original methods applied separately.


B. Xu, W. Wang, G. Falzon, P. Kwan, L. Guo, G. Chen, A. Tait, and D. Schneider, “Automated cattle counting using Mask R-CNN in quadcopter vision system,” COMPUTERS AND ELECTRONICS IN AGRICULTURE, vol. 171, APR 2020.

J. Salau and J. Krieter, “Instance Segmentation with Mask R-CNN Applied to Loose-Housed Dairy Cows in a Multi-Camera Setting,” ANIMALS, vol. 10, no. 12, DEC 2020.

R.-W. Bello, A. S. A. Mohamed, and A. Z. Talib, “Contour extraction of individual cattle from an image using enhanced mask r-cnn instance segmentation method,” IEEE Access, vol. 9, pp. 56 984–57 000, 2021.

——, “Enhanced mask r-cnn for herd segmentation,” International Journal of Agricultural and Biological Engineering, vol. 14, no. 4, pp. 238–244, 2021.

C. Chen, W. Zhu, and T. Norton, “Behaviour recognition of pigs and cattle: Journey from computer vision to deep learning,” Computers and Electronics in Agriculture, vol. 187, p. 106255, 2021.

T. Deng, B. Fu, M. Liu, H. He, D. Fan, L. Li, L. Huang, and E. Gao, “Comparison of multi-class and fusion of multiple single-class segnet model for mapping karst wetland vegetation using uav images,” Scientific Reports, vol. 12, no. 1, 2022.

S. Son, S.-H. Lee, J. Bae, M. Ryu, D. Lee, S.-R. Park, D. Seo, and J. Kim, “Land-cover-change detection with aerial orthoimagery using segnet-based semantic segmentation in namyangju city, south korea,” Sustainability (Switzerland), vol. 14, no. 19, 2022.

P. Maheswari, P. Raja, and V. T. Hoang, “Intelligent yield estimation for tomato crop using segnet with vgg19 architecture,” Scientific Reports, vol. 12, no. 1, 2022.

N. Dhingra, G. Chogovadze, and A. M. Kunz, “Border-seggcn: Improving semantic segmentation by refining the border outline using graph convolutional network,” in IEEE/CVF International Conference on Computer Vision Workshops, ICCVW 2021, Montreal, BC, Canada, October 11-17, 2021. IEEE, 2021, pp. 865–875. [Online]. Available:

Z. Chen, B. Guo, C. Lib, and H. Liu, “Review on superpixel generation algorithms based on clustering,” 2020, Conference paper, p. 532 – 537, cited by: 4. [Online]. Available: [link].

J.-H. Witte, J. Gerberding, C. Melching, and J. M. Gómez, “Evaluation of deep learning instance segmentation models for pig precision livestock farming,” in Business Information Systems, 2021, pp. 209–220.

D. A. Sant’Ana, M. C. B. Pache, J. Martins, G. Astolfi, W. P. Soares, S. L. N. de Melo, N. da Silva Heimbach, V. A. de Moraes Weber, R. G. Mateus, and H. Pistori, “Computer vision system for superpixel classification and segmentation of sheep,” Ecological Informatics, vol. 68, p. 101551, 2022.

A. D. S. Ferreira, D. M. Freitas, G. G. da Silva, H. Pistori, and M. T. Folhes, “Weed detection in soybean crops using convnets,” Computers and Electronics in Agriculture, vol. 143, pp. 314 – 324, 2017.

V. Badrinarayanan, A. Kendall, and R. Cipolla, “Segnet: A deep convolutional encoder-decoder architecture for image segmentation,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 39, no. 12, pp. 2481–2495, 2017.

E. Shelhamer, J. Long, and T. Darrell, “Fully convolutional networks for semantic segmentation,” IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 39, no. 4, pp. 640–651, 2017.
GONÇALVES, Diogo Nunes; GONÇALVES, Wesley Nunes; GOMES, Rodrigo da Costa; ARAUJO, Anderson Viçoso de; PISTORI, Julia Gindri Bragato; HIGA, Gabriel Toshio Hirokawa; WEBER, Vanessa Aparecida de Moraes; PISTORI, Hemerson. Segmenting Live Cattle using a New Approach to Combine Superpixels and SegNets. In: WORKSHOP DE VISÃO COMPUTACIONAL (WVC), 18. , 2023, São Bernardo do Campo/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2023 . p. 125-130. DOI: