Classification of Fruit Flies by Gender in Images Using Smartphones and the YOLOv4-Tiny Neural Network

Mikhail A. Genaev, Evgenii G. Komyshev, Olga D. Shishkina, Natalya V. Adonyeva, Evgenia K. Karpova, Nataly E. Gruntenko, Lyudmila P. Zakharenko, Vasily S. Koval, Dmitry A. Afonnikov

Research output: Contribution to journalArticlepeer-review


The fruit fly Drosophila melanogaster is a classic research object in genetics and systems biology. In the genetic analysis of flies, a routine task is to determine the offspring size and gender ratio in their populations. Currently, these estimates are made manually, which is a very time-consuming process. The counting and gender determination of flies can be automated by using image analysis with deep learning neural networks on mobile devices. We proposed an algorithm based on the YOLOv4-tiny network to identify Drosophila flies and determine their gender based on the protocol of taking pictures of insects on a white sheet of paper with a cell phone camera. Three strategies with different types of augmentation were used to train the network. The best performance (F1 = 0.838) was achieved using synthetic images with mosaic generation. Females gender determination is worse than that one of males. Among the factors that most strongly influencing the accuracy of fly gender recognition, the fly’s position on the paper was the most important. Increased light intensity and higher quality of the device cameras have a positive effect on the recognition accuracy. We implement our method in the FlyCounter Android app for mobile devices, which performs all the image processing steps using the device processors only. The time that the YOLOv4-tiny algorithm takes to process one image is less than 4 s.

Original languageEnglish
Article number295
Issue number3
Publication statusPublished - 1 Feb 2022


  • Android app
  • Deep learning
  • Drosophila melanogaster
  • Gender
  • Image analysis
  • Mobile device
  • Object detection




Dive into the research topics of 'Classification of Fruit Flies by Gender in Images Using Smartphones and the YOLOv4-Tiny Neural Network'. Together they form a unique fingerprint.

Cite this