Skip to content

Artificial Intelligence Performs Key Step in Fruit Fly Management

Mexican fruit fly (Anastrepha ludens)

The Mexican fruit fly (Anastrepha ludens) is one of the world’s most damaging insect pests. A key method for managing them is the sterile insect technique, in which sterile male flies are mass-reared and released into the wild, whereupon they mate with wild females, which then fail to produce offspring. Determining the precise age of mass-reared fruit flies is a critical step in the sterile insect technique, and researchers in Mexico have applied machine-learning algorithms that can accurately measure the age of fruit fly pupae to properly time irradiation. (Photo by Andrés Diaz Cervantes)

By Diana Pérez-Staples, Ph.D., and Horacio Tapia-McClung, Ph.D.

Horacio Tapia-McClung, Ph.D.

Horacio Tapia-McClung, Ph.D.

Diana Pérez-Staples, Ph.D.

Diana Pérez-Staples, Ph.D.

Two of the world’s most damaging pests are the Mediterranean fruit fly (Ceratitis capitata) and the Mexican fruit fly (Anastrepha ludens), causing billions of dollars in damage to agriculture. Fortunately, the sterile insect technique is currently used as part of area-wide integrated management programs to control these flies is certain regions of the world.

The sterile insect technique (SIT) is a type of birth control, consisting in rearing millions of these flies in factories, irradiating them with X or gamma rays to make them sterile, and then releasing them in areas where the pests are present. When the sterile males mate with wild females, the females will not have fertile eggs to lay in the fruits. Thus, population levels are decreased. The SIT has good green credentials because it only targets the pest species, it does not introduce foreign genetic material into the population, and it reduces the use of insecticides.

The irradiation process in SIT is key to its success. For tephritid flies, irradiation is usually carried out a couple of days before the pupae emerge as adults. If pupae are irradiated too soon or too late in their development process, this can lead to problems in mobility and behavior as adults. However, even during controlled conditions, pupae can vary in their development time. Thus, one of the tests that are carried out pre-irradiation is to determine the physiological age of the pupae.

Currently, at these fruit fly factories throughout the world, technicians must determine the correct time to irradiate by taking a sample of pupae, removing the pupal case to expose the eyes, and then checking the eye color against a color chart. This can be laborious and prone to human error, as it depends on the skill, experience, and expertise of the technician, as well as natural biases in color interpretation. The technicians can get tired from this repetitive work, while sick days and vision problems could also cause variations in the correct determination.

Artificial Intelligence to the Rescue

At the Universidad Veracruzana, in collaboration with the Secretary of Agriculture of Mexico (Programa Operativo de Moscas, DGSV-SENASICA), we teamed up with experts in artificial intelligence to develop methods based on algorithms that can accurately determine the age of a pupa from a digital image captured with a common mobile device. We share our results in a new article published this month in the Journal of Economic Entomology.

Iván González-López

Iván González-López

For this, and as part of his Ph.D. at the Facultad de Ciencias Agrícolas of the Universidad Veracruzana, Iván González-López, currently based at the IAEA-FAO Entomology Laboratory in Austria, took photographs of the exposed eyes of pupae of both Mediterranean fruit flies and Mexican fruit flies. We chose pupae that still had a few days to emerge and deliberately took rough photographs that did not have perfect lighting conditions or focus. In fact, they were taken quickly and with a mobile phone.

Then, as a part of her master’s research at the Laboratorio Nacional de Informática Avanzada in Xalapa Veracruz, Georgina Carrasco processed the images with a program that was trained to detect the eye area in the photograph and crop it. Afterward, using the correct answers from a technician at the factory, another algorithm was trained through a supervised machine-learning method known as transfer learning, to accurately determine the age of the pupae.

We found that algorithms based on a neural network architecture known as Inception v1 correctly identified the physiological age of maturity at two days before emergence, with a 75 percent accuracy for the Mexican fruit fly and 83.16 percent for Mediterranean fruit fly, respectively. This method is not perfect for sure, and it still requires a technician to dissect the pupae and take photographs, but it is a promising approximation of how supervised machine learning and artificial intelligence can be used to help uncertainty in decisions about when to irradiate. The level of accuracy may also be improved as more pictures are taken and provided for the algorithm to learn from.

The next steps will be to develop software that could easily be used by technicians as well as to train these algorithms with other tephritid pest species currently controlled through SIT. Certainly, it highlights that there can be some exciting collaborations between entomologists and artificial intelligence researchers.

Diana Pérez-Staples, Ph.D., is a research professor at the Institute of Biotechnology and Applied Ecology at the Universidad Veracruzana, in Xalapa, Veracruz, Mexico. Email: Horacio Tapia-McClung, Ph.D., is a research professor at the Artificial Intelligence Research Institute at the Universidad Veracruzana also in Xalapa. Email:


Leave a Reply (Comments subject to review by site moderator and will not publish until approved.)

This site uses Akismet to reduce spam. Learn how your comment data is processed.