Deep-learning-based classification of pig carcasses according to sex

Authors

  • Matteo D'Angelo Department of Veterinary Medicine, University of Teramo, Teramo, Italy
  • Rocco D'Alterio Farm4trade s.r.l., Chieti, Italy
  • Beatrice Armeni Department of Veterinary Medicine, University of Teramo, Teramo, Italy
  • Domenico Robbe Department of Veterinary Medicine, University of Teramo, Teramo, Italy
  • Alfonso Rosamilia Istituto Zooprofilattico Sperimentale della Lombardia e dell'Emilia-Romagna "Bruno Ubertini", Brescia, Italy
  • Andrea Capobianco Dondona Farm4trade s.r.l., Chieti, Italy
  • Giuseppe Marruchella Department of Veterinary Medicine, University of Teramo, Teramo, Italy

DOI:

https://doi.org/10.12834/VetIt.4112.42741.2

Keywords:

pig carcass, deep learning, sex categories

Abstract

Slaughterhouses provide an opportunity for the automated collection of data from large numbers of animals under standardised conditions. This study investigated the use of deep learning for automated classification of pig carcasses according to sex. A total of 4,219 images of female, entire male and surgically castrated male pigs slaughtered in Italy, Spain and the Netherlands were used. Images were acquired from different perspectives, and the vulva, scrotum or perianal region was annotated according to sex category. A YOLO11m object-detection model was trained and evaluated on an independent test set comprising 672 images from 224 carcasses. Classification performance was assessed both at the single-image level and at the animal level by combining predictions from three views of each carcass. Image-level accuracy was 97.5%, with macro-averaged precision, recall and F1-score of 97.7%, 97.5% and 97.6%, respectively. At the animal level, 219/224 carcasses were correctly classified, corresponding to an accuracy of 97.8%, with macro-averaged precision, recall and F1-score of 97.9%, 98.0% and 97.9%, respectively. All classification errors involved castrated males, particularly their distinction from females, whereas direct confusion between entire males and females did not occur. These results demonstrate the feasibility of deep learning-based sex classification of pig carcasses and support its potential integration into automated slaughterhouse data-collection systems.

References

Batorek N., Čandek-Potokar M., Bonneau M. & Van Milgen J. (2012). Meta-analysis of the effect of immunocastration on production performance, reproductive organs and boar taint compounds in pigs. Animal, 6 (8), 1330-1338. doi: 10.1017/S1751731112000146.

Bee, G., Quiniou, N., Maribo, H., Zamaratskaia, G., & Lawlor, P. G. (2020). Strategies to Meet Nutritional Requirements and Reduce Boar Taint in Meat from Entire Male Pigs and Immunocastrates. Animals : an open access journal from MDPI, 10(11), 1950. https://doi.org/10.3390/ani10111950.

Blömke, L., Volkmann, N., & Kemper, N. (2020). Evaluation of an automated assessment system for ear and tail lesions as animal welfare indicators in pigs at slaughter. Meat science, 159, 107934. https://doi.org/10.1016/j.meatsci.2019.107934.

Bonicelli, L., Trachtman, A. R., Rosamilia, A., Liuzzo, G., Hattab, J., Mira Alcaraz, E., Del Negro, E., Vincenzi, S., Capobianco Dondona, A., Calderara, S., & Marruchella, G. (2021). Training Convolutional Neural Networks to Score Pneumonia in Slaughtered Pigs. Animals : an open access journal from MDPI, 11(11), 3290. https://doi.org/10.3390/ani11113290.

Bonneau, M., & Weiler, U. (2019). Pros and Cons of Alternatives to Piglet Castration: Welfare, Boar Taint, and Other Meat Quality Traits. Animals : an open access journal from MDPI, 9(11), 884. https://doi.org/10.3390/ani9110884.

Bottacini, M., Scollo, A., Edwards, S. A., Contiero, B., Veloci, M., Pace, V., & Gottardo, F. (2018). Skin lesion monitoring at slaughter on heavy pigs (170 kg): Welfare indicators and ham defects. PloS one, 13(11), e0207115. https://doi.org/10.1371/journal.pone.0207115.

Čandek-Potokar, M., Škrlep, M., Kostyra, E., Żakowska-Biemans, S., Poklukar, K., Batorek-Lukač, N., Kress, K., Weiler, U., & Stefanski, V. (2020). Quality of Dry-Cured Ham from Entire, Surgically and Immunocastrated Males: Case Study on Kraški Pršut. Animals : an open access journal from MDPI, 10(2), 239. https://doi.org/10.3390/ani10020239.

D'Angelo, M., Sciota, D., Romano, A., Rosamilia, A., Guarnieri, C., Cecchini, C., Olivastri, A., & Marruchella, G. (2025). Detecting ear lesions in slaughtered pigs through open-source convolutional neural networks. Porcine health management, 11(1), 29. https://doi.org/10.1186/s40813-025-00442-9.

De Luca, S., Zanardi, E., Alborali, G. L., Ianieri, A., & Ghidini, S. (2021). Abattoir-Based Measures to Assess Swine Welfare: Analysis of the Methods Adopted in European Slaughterhouses. Animals : an open access journal from MDPI, 11(1), 226. https://doi.org/10.3390/ani11010226.

Eurostat. 2025a. EU livestock populations continued to decrease in 2024. Eurostat, European Commission, Luxembourg. https://ec.europa.eu/eurostat/web/products-eurostat-news/w/ddn-20250626-1 (accessed on 18 September 2026).

Eurostat. 2025b. Key figures on the European food chain – 2025 edition. Publications Office of the European Union, Luxembourg. doi: 10.2785/8194502.

FAO. 2025. World Food and Agriculture – Statistical Yearbook 2025. Food and Agriculture Organization of the United Nations, Rome. doi: 10.4060/cd4313en.

Grandin T. (2017). On-farm conditions that compromise animal welfare that can be monitored at the slaughter plant. Meat science, 132, 52–58. https://doi.org/10.1016/j.meatsci.2017.05.004.

Huanca-Marca, N. F., Estévez-Moreno, L. X., Espinosa, N. L., & Miranda-de la Lama, G. C. (2025). Assessment of pig welfare at slaughterhouse level: A systematic review of animal-based indicators suitable for inclusion in monitoring protocols. Meat science, 220, 109689. https://doi.org/10.1016/j.meatsci.2024.109689.

Hunter, R. H., & Greve, T. (1996). Intersexuality in pigs: clinical, physiological and practical considerations. Acta veterinaria Scandinavica, 37(1), 1–12. https://doi.org/10.1186/BF03548114.

Jocher G. & Qiu J. (2024). Ultralytics YOLO11, version 11.0.0 [computer software]. Ultralytics. https://github.com/ultralytics/ultralytics (accessed on 16 September 2026).

Kim, J., Kwon, Y. K., Kim, H. W., Seol, K. H., & Cho, B. K. (2023). Robot Technology for Pork and Beef Meat Slaughtering Process: A Review. Animals : an open access journal from MDPI, 13(4), 651. https://doi.org/10.3390/ani13040651.

Lin T. Y., Maire M., Belongie S., Hays J., Perona P., Ramanan D., Dollár P. & Zitnick C.L. (2014). Microsoft COCO: common objects in context. In Computer Vision – ECCV 2014 (Fleet D., Pajdla T., Schiele B. & Tuytelaars T., eds), Lecture Notes in Computer Science, vol. 8693. Springer, Cham, 740-755. doi: 10.1007/978-3-319-10602-1_48.

Nguyen V. A. (2026). AnyLabeling: effortless AI-assisted data labeling [computer software]. https://github.com/vietanhdev/anylabeling (accessed on 16 September 2026).

Romano, A., Golunova, E., Marruchella, G., Capobianco Dondona, A., Bernabò, N., Del Negro, E., Pettinella, S. D., Naadland, S. S., Jensen, A. D., Alvseike, O. A., & Nagel-Alne, G. E. (2025). Automated detection and scoring of pleurisy in Norwegian slaughtered pigs: A field trial. Food Control, 178, Article 111514. https://doi.org/10.1016/j.foodcont.2025.111514.

Romano, A., Baghini, S., Capobianco Dondona, A., Bernabò, N., & Marruchella, G. (2026). Image-based assessment of tail docking and tail biting in slaughtered pigs across three European countries. Frontiers in veterinary science, 13, 1751411. https://doi.org/10.3389/fvets.2026.1751411.

Russell, B. C., Torralba, A., Murphy, K. P., & Freeman, W. T. (2008). LabelMe: A database and web-based tool for image annotation. International Journal of Computer Vision, 77(1–3), 157–173. https://doi.org/10.1007/s11263-007-0090-8.

Schimitzek, P. (2019). Device for optically identifying the sex of a slaughter pig (U.S. Patent No. 10,165,782 B2). U.S. Patent and Trademark Office. https://patents.google.com/patent/US10165782B2 (accessed on 18 September 2026).

Škrlep, M., Tomašević, I., Mörlein, D., Novaković, S., Egea, M., Garrido, M. D., Linares, M. B., Peñaranda, I., Aluwé, M., & Font-I-Furnols, M. (2020). The Use of Pork from Entire Male and Immunocastrated Pigs for Meat Products-An Overview with Recommendations. Animals : an open access journal from MDPI, 10(10), 1754. https://doi.org/10.3390/ani10101754.

Sokolova, M., & Lapalme, G. (2009). A systematic analysis of performance measures for classification tasks. Information Processing & Management, 45(4), 427–437. https://doi.org/10.1016/j.ipm.2009.03.002.

Squires, E. J., Bone, C., & Cameron, J. (2020). Pork Production with Entire Males: Directions for Control of Boar Taint. Animals : an open access journal from MDPI, 10(9), 1665. https://doi.org/10.3390/ani10091665.

Tholen, J., Kirse, A., Voß, A., Schulze Althoff, G., Strotkötter, L., Kreienbrock, L., & Upmann, M. (2026). Detection of carcass contamination using video image analysis during industrial pig slaughter. Frontiers in Food Science and Technology, 6, Article 1698416. https://doi.org/10.3389/frfst.2026.1698416.

Ultralytics. (2023). YOLO performance metrics. Ultralytics documentation. https://docs.ultralytics.com/guides/yolo-performance-metrics/ (accessed on 16 September 2026).

van Staaveren, N., Doyle, B., Manzanilla, E. G., Calderón Díaz, J. A., Hanlon, A., & Boyle, L. A. (2017). Validation of carcass lesions as indicators for on-farm health and welfare of pigs. Journal of animal science, 95(4), 1528–1536. https://doi.org/10.2527/jas.2016.1180.

Downloads

Published

2026-10-09

How to Cite

D'Angelo, M., D'Alterio, R., Armeni, B., Robbe, D., Rosamilia, A., Capobianco Dondona, A., & Marruchella, G. (2026). Deep-learning-based classification of pig carcasses according to sex. Veterinaria Italiana, 62(4). https://doi.org/10.12834/VetIt.4112.42741.2

Issue

Section

Paper

Most read articles by the same author(s)

Similar Articles

1 2 3 4 > >> 

You may also start an advanced similarity search for this article.