Computational classification of animals for a highway detection system


  • Denis Sato Universidade de São Paulo, Faculdade de Medicina Veterinária e Zootecnia, Pirassununga – SP, Brasil
  • Adroaldo José Zanella Universidade de São Paulo, Faculdade de Medicina Veterinária e Zootecnia, Departamento de Medicina Veterinária Preventiva e Saúde Animal, Pirassununga – SP, Brasil
  • Ernane Xavier Costa Universidade de São Paulo, Faculdade de Zootecnia e Engenharia de Alimentos, Departamento de Ciências Básicas, Pirassununga – SP, Brasil



Machine-learning, Vehicle-animal collisions, Computational vision


Vehicle-animal collisions represent a serious problem in roadway infrastructure. To avoid these roadway collisions, different mitigation systems have been applied in various regions of the world. In this article, a system for detecting animals on highways is presented using computer vision and machine learning algorithms. The models were trained to classify two groups of animals: capybaras and donkeys. Two variants of the convolutional neural network called Yolo (You only look once) were used, Yolov4 and Yolov4-tiny (a lighter version of the network). The training was carried out using pre-trained models. Detection tests were performed on 147 images. The accuracy results obtained were 84.87% and 79.87% for Yolov4 and Yolov4-tiny, respectively. The proposed system has the potential to improve road safety by reducing or preventing accidents with animals.


Download data is not yet available.


Abu-El-Haija S, Kothari N, Lee J, Natsev P, Toderici G, Varadarajan B, Vijayanarasimhan S. YouTube-8M: a large-scale video classification benchmark 2016 Sept 17 [cited 2020 Sept 21]. In: arXiv [Internet]. New York: Cornell University; [2020]. Available from:

Agrawal R, Singh N. Lane detection and collision prevention system for automated vehicles. In: Iyer B, Rajurkar AM, Gudivada V, editors. Applied computer vision and image processing [Internet]. Singapore: Springer; 2020 [cited 2021 May 7]. p. 46-59. (Advances in Intelligent Systems and Computing). Available from:

Al-Ghamdi AS, AlGadhi SA. Warning signs as countermeasures to camel-vehicle collisions in Saudi Arabia. Accid Anal Prev. 2004;36(5):749-60.

Al-Sebai MW, Al-Zahrani S. Cervical spinal injuries caused by collision of cars with camels. Injury. 1997;28(3):191-4.

Alshalali T, Josyula D. Fine-tuning of pre-trained deep learning models with extreme learning machine [Internet]. Proceedings - 2018 International Conference on Computational Science and Computational Intelligence; 2018 Dec 12-14; Las Vegas, Nevada [Internet]. New York: IEEE; 2018 [cited 2021 May7]. p. 469–473. Available from:

Biblioteca Virtual FAPESP [Internet]. São Paulo: FAPESP; 2020. Desenvolvimento de sistema de detecção animal antiatropelamento em rodovias - “Passa Bicho” [cited 2020 Sept 21]. Available from:

Bíl M, Andrášik R, Bartonička T, Křivánková Z, Sedoník J. An evaluation of odor repellent effectiveness in prevention of wildlife-vehicle collisions. J Environ Manage. 2018;205:209-14. Available from:

Bochkovskiy A. Darknet - Yolo-V4 and Yolo-v3/v2 for Windows and Linux. [Date unknown] - [cited 2020 Sept 21]. In: GitHub [Internet]. [place unknown]; c2020. [cited 2020 Sept 21]. Available from:

Bochkovskiy A, Wang C-Y, Liao H-YM. YOLOv4: optimal speed and accuracy of object detection. 2020 Apr 23 [cited 2020 Sept 21]. In: arXiv [Internet]. New York: Cornell University; 2020. Available from:

Bruijn T. PyFirmata [2020 Jun 23] - [cited 2020 Sept 21]. In: GitHub [Internet]. [place unknown]; c2020. Available from:

Bruinderink GWTAG, Hazebroek E. Ungulate traffic collisions in Europe. Conserv Biol. 1996;10(4):1059-67.

Cartucho J, Ventura R, Veloso M. Robust object recognition through symbiotic deep learning in mobile robots. In: 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS); 2018; Madrid, Spain [Internet]. New York: IEEE; 2018 [cited 2020 Sept 21]. p.2336-41.

Cartucho J. mAP. 2005 May 29 [cited 2020 Sept 21]. In: GitHub [Internet]. [place unknown]; c2020. Available from:

Chollet F. Building powerful image classification models using very little data. 2016 Jun 5 [cited 2020 May 20]. In: The Keras Blog [Internet]. [place unknown]; 2020. Available from:

Christiansen P, Steen KA, Jørgensen RN, Karstoft H. Automated detection and recognition of wildlife using thermal cameras. Sensors. 2014;14(8):13778-93.

Chrome Web Store [Internet]. Fatkun Batch Download Image - Chrome extension. [place unknown]; 2020 [cited 2020 Sept 21]. Available from:

Chu B, Madhavan V, Beijbom O, Hoffman J, Darrell T. Best practices for fine-tuning visual classifiers to new domains. In: Hua G, Jégou, H, editors. Computer Vision – ECCV 2016 Workshops. Switzerland: Springer; 2016. p. 435-42. (Lecture Notes in Computer Science, including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics; v. 9915).

Common Objects in Context – COCO. COCO 2020 Object Detection Task [Internet]. [place unknown]; 2020 [cited 2020 Sept 21]. Available from:

Consumer Reports [Internet]. Yonkers, NY: CR; c2020. Cars with advanced safety systems [cited 2020 Sept 21]. Available from:

D’Angelo G, van der Ree R. Use of reflectors and auditory deterrents to prevent wildlife-vehicle collisions. In: van der Ree R, Smith DJ, Grilo C, editors. Handbook of road ecology [Internet]. Hoboken: John Wiley & Sons; 2015 [cited 2021 May 7]. p. 213-8. Available from:

Dodd CK Jr, Barichivich WJ, Smith LL. Effectiveness of a barrier wall and culverts in reducing wildlife mortality on a heavily traveled highway in Florida. Biol Conserv. 2004;118(5):619-31.

Everingham M, Winn J. The PASCAL Visual Object Classes Challenge 2012 (VOC2012) development kit [Internet]. [place unknown]: PASCAL VOC; 2012 May 18 [cited 2020 Sept 21]. Available from:

Fei-Fei L, Deng J, Li K. ImageNet: constructing a large-scale image database. J Vis. 2010;9(8):1037.

Fijitsu Blog [Internet]. [place unknown]: Fujitsu; 2019. How Fujitsu is using AI to make Japan’s roads and rivers safe [cited 2020 Sept 21]. Available from: in order to monitor,national highways across the country.

Google. Colaboratory [Internet]. [place unknown]; 2020 [cited 2020 Feb 12]. Available from:

Grace MK, Smith DJ, Noss RF. Reducing the threat of wildlife-vehicle collisions during peak tourism periods using a Roadside Animal Detection System. Accid Anal Prev. 2017;109:55-61.

He K, Gkioxari G, Dollar P, Girshick R. Mask R-CNN. In: Proceedings of the IEEE International Conference on Computer Vision; 2017; Venice, Italy [Internet]. New York: IEEE; 2017 [2021 May 7]. p. 2980-8. Available from:

He K, Girshick R, Dollar P. Rethinking imageNet pre-training. Proceedings of the IEEE International Conference on Computer Vision; 2019 Nov 27 Oct.-2; Seoul, South Korea [Internet]. New York: IEEE; 2019 [cited 2021 May 7]. p. 4917–4926. Available from:

Hoiem D, Chodpathumwan Y, Dai Q. Diagnosing error in object detectors. 2012 [cited 2021 May 3]. In: University of Illinois Urbana-Champaign. The Grainger College of Engineering. Derek Hoiem [Internet]. Urbana, IL: Derek Hoiem; c2021. Available from:

Hothorn T, Müller J, Held L, Möst L, Mysterud A. Temporal patterns of deer-vehicle collisions consistent with deer activity pattern and density increase but not general accident risk. Accid Anal Prev. 2015;81:143-52.

Huang GB, Ramesh M, Berg T, Learned-Miller E. Labeled Faces in the Wild: a database for studying face recognition in unconstrained environments. Amherst: University of Massachusetts; 2007. Technical Report 07-49.

Huijser MP, Delborgo Abra F, Duffield JW. Cost justification and an example of cost-benefit analyses of mitigation measures aimed at reducing collisions with Capybara in São Paulo State, Brazil. In: Proceedings of the 2013 International Conference on Ecology and Transportation (ICOET 2013); 2013; Scottsdale Arizona. [place unknown]: ICOET; 2013.

Khosla A, Jayadevaprakash N, Yao B, Fei-Fei L. Novel dataset for fine-grained image categorization. In: Proceedings of the IEEE Conf. Comput. Vision and Pattern Recognition, 2011 [Internet]. Stanford: Standford University; 2020 [cited 2020 Sept 21]. Available from: Click on Dataset Reference / Primary / pdf.

Kušta T, Keken Z, Ježek M, Kůta Z. Effectiveness and costs of odor repellents in wildlife-vehicle collisions: a case study in Central Bohemia, Czech Republic. Transp Res Part D Transp Environ. 2015;38:1-5.

Lesmerises F, Dussault C, St-Laurent MH. Major roadwork impacts the space use behaviour of gray wolf. Landsc Urban Plan. 2013;112(1):18-25.

Lin TY, Maire M, Belongie S, Hays J, Perona P, Ramanan D, Dollár P, Zitnick CL. Microsoft COCO: common objects in context. In: Proceedings of the European Conference on Computer Vision; 2014; Zurich, Switzerland [Internet]. Switzerland: Springer; 2014 [cited 2021 May 3]. p. 740-55. (Lecture Notes in Computer Science; vol. 8693). Available from:

Liu W, Anguelov D, Erhan D, Szegedy C, Reed S, Fu CY, Berg AC. SSD: single shot multibox detector. In: Proceedings of the European Conference on Computer Vision; 2016; Amsterdam, The Netherlands [Internet]. Switzerland: Springer; 2016 [cited 2021 May 3]. p. 21-37. (Lecture Notes in Computer Science; vol. 9905). Available from:

Munappy A, Bosch J, Olsson HH, Arpteg A, Brinne B. Data management challenges for deep learning. In: Proceedings of the 45th Euromicro Conference on Software Engineering and Advanced Applications (SEAA); 2019 Aug 28-30; Kallithea, Greece [Internet]. New York: IEEE; 2019 [cited 2021 May 3]. p. 140–147. Available from:

Oishi Y, Oguma H, Tamura A, Nakamura R, Matsunaga T. Animal detection using thermal images and its required observation conditions. Remote Sens. 2018;10(7):1050.

Olson DD, Bissonette JA, Cramer PC, Green AD, Davis ST, Jackson PJ, Coster DC. Monitoring wildlife-vehicle collisions in the Information Age: how smartphones can improve data collection. J Wildlife Rehabil. 2014;34(3):7-16.

PASCAL VOC Project. The PASCAL Visual Object Classes Challenge 2012 [Internet]. [place unknown]: VOC 2012; 2012. 4 Detection task, 2012 May 21 [cited 2020 Feb 12]. Available from:

Pathak AR, Pandey M, Rautaray S, Pawar K. Assessment of object detection using deep convolutional neural networks. In: Subhash B, Vikrant B, Anjali AC, Anil SH, Suresh CS, editors. Intelligent computing and information and communication [Internet]. Singapore: Springer Nature; 2018 [cited 2021 May 3]. p. 457-66. Available from:

Perissinotto M, Moura DJ, Cruz VF, Souza SRL, Lima KAO, Mendes AS. Conforto térmico de bovinos leiteiros confinados em clima subtropical e mediterrâneo pela análise de parâmetros fisiológicos utilizando a teoria dos conjuntos fuzzy. Cienc Rural. 2009;39(5):1492-8.

Ponce J, Berg TL, Everingham M, Forsyth DA, Hebert M, Lazebnik S, Marszalek M, Schmid C, Russell BC, Torralba A, Williams CKI, Zhang J, Zisserman A. Dataset issues in object recognition. In: Ponce J, Hebert M, Schmid C, editors. Toward category-level object recognition [Internet]. Berlin: Springer; 2006 [cited 2021 May7]. p. 29–48. Available from:

Pynn TP, Pynn BR. Moose and other large animal wildlife vehicle collisions: implications for prevention and emergency care. J Emerg Nurs. 2004;30(6):542-7.

Rangda MB, Hanchate DB. Animal detection using histogram oriented gradient. Int J Recent and Innov Trends Comput Commun. 2014;2(2):178-83.

Rawat W, Wang Z. Deep convolutional neural networks for image classification: a comprehensive review. Neural Comput. 2017;29(9):2352-449. PMid:28599112.

Rodríguez-Morales B, Díaz-Varela ER, Marey-Pérez MF. Spatiotemporal analysis of vehicle collisions involving wild boar and roe deer in NW Spain. Accid Anal Prev. 2013;60:121-33.

Russakovsky O, Deng J, Su H, Krause J, Satheesh S, Ma S, Huang Z, Karpathy A, Khosla A, Bernstein M, Berg AC, Fei-Fei L. ImageNet large scale visual recognition challenge. Int J Comput Vis. 2015;115(3):211-52.

Sharma SU, Shah DJ. A practical animal detection and collision avoidance system using computer vision technique. IEEE Access. 2017;5:347-58.

Sullivan JM. Trends and characteristics of animal-vehicle collisions in the United States. J Safety Res. 2011;42(1):9-16.

Tavares DM, Coelho IB, Cardoso PH, Lima RPO, Stein PP. Cenário dos acidentes por atropelamento de fauna nas rodovias federais brasileiras e a mortalidade dos humanos envolvidos. In: Anais do XXXI Congresso de Pesquisa e Ensino em Transportes [Internet]. [place unknown]: ANPET; 2017 [cited 2020 Feb 12]. Available from:

Tissier ML, Jumeau J, Croguennec C, Petit O, Habold C, Handrich Y. An anti-predation device to facilitate and secure the crossing of small mammals in motorway wildlife underpasses. (I) Lab tests of basic design features. Ecol Eng. 2016;95:738-42.

Tzutalin D. LabelImg [2015] - [cited 2020 Feb 12]. In: GitHub [Internet]. [place unknown]; c2020. Available from:

Wadey J, Beyer HL, Saaban S, Othman N, Leimgruber P, Campos-Arceiz A. Why did the elephant cross the road? The complex response of wild elephants to a major road in Peninsular Malaysia. Biol Conserv. 2018;218:91-8.

Weiss K, Khoshgoftaar TM, Wang D. A survey of transfer learning. J Big Data. 2016;3(1):9.

Ye T, Wang B, Song P, Li J. Automatic railway traffic object detection system using feature fusion refine neural network under shunting mode. Sensors. 2018;18(6):1916.

Yu M, Yang P, Wei S. Railway obstacle detection algorithm using neural network. AIP Conf Proc. 2018;1967(May):040017.

Zhou D. Thermal image-based deer detection to reduce accidents due to deer-vehicle collisions [Internet]. Minneapolis: Intelligent Transportation Systems Institute, Center for Transportation Studies, University of Minnesota; 2013 Jan[cited 2020 Feb 12]. Available from:

Zhuang F, Qi Z, Duan K, Xi D, Zhu Y, Zhu H, Xiong H, He Q. A comprehensive survey on transfer learning. 2019 Nov 7 [cited 2020 Feb 12]. In: arXiv [Internet]. New York: Cornell University; 2020. Available from:




How to Cite

Sato, D., Zanella, A. J., & Costa, E. X. (2021). Computational classification of animals for a highway detection system. Brazilian Journal of Veterinary Research and Animal Science, 58, e174951.

Most read articles by the same author(s)