A blue canvas, diamond shaped container is suspended from a tree.

Flies which feast on blood – such as tsetse and horse flies – inflict painful bites and spread debilitating diseases among people and animals alike. So a lot of work has gone into designing the most efficient traps to control the populations of these flies.

Biting fly traps tend to be blue, because decades of field research has shown that such flies find this colour especially attractive. But it’s never been clear why these flies find blue to be so irresistible – especially since blue objects are not a common sight in the natural environment.

Scientists have speculated that blue surfaces might look like shaded places to flies since shadows have a blueish tinge. Tsetse flies in particular seek out such shaded spots to rest in, which might explain their attraction to blue traps.

Another possibility is that blue surfaces might lure hungry flies by providing them with the telltale signs they use to distinguish animals against a background of foliage. According to this theory, a fly might mistake a blue trap for an animal it wishes to bite and feed upon.

A bright blue trap for tsetse flies is suspended from a tree.
Fabian Plock/Shutterstock

But assessing these possibilities is especially tricky because flies perceive colour differently to people. Humans perceive colour using the responses of three kinds of light-detecting photoreceptor in the retina which are broadly sensitive to blue, green and red wavelengths of light.

But most “higher flies” – such as tsetse and horseflies – have five kinds of photoreceptor sensitive to UV, blue and green wavelengths. So, a blue trap won’t look the same to a fly as it does to the human who designed it.

From flies to AI…

In our study, we tackled the problem by using artificial intelligence (AI). We used artificial neural networks which are a form of machine learning inspired by the structure of real nervous systems. Artificial neural networks learn by modifying the strengths of connections between a network of artificial neurons.

We fed these networks with the photoreceptor signals that a fly would experience when looking at animals or foliage backgrounds, both in light and in shade. We then trained the networks to distinguish animals from leaves, and shaded from unshaded objects, using only that visual information.

The trained networks would find the most efficient way of processing the visual signals, which we expected to share properties with the mechanisms that have evolved in real flies’ nervous systems. We then investigated whether the artificial neural networks classified blue traps as animals or as shaded surfaces.

Blueness or brightness?

After training, our neural networks could easily distinguish animals from leaf backgrounds, and shaded from unshaded stimuli, using the sensory information available to a fly. However, what surprised us was that they solved these problems in completely different ways.

The networks identified shade using brightness and not colour – quite simply, the darker a stimulus appeared, the more likely it was to be classified as shaded. Meanwhile, animals were identified using the relative strength of blue and green photoreceptor signals. Relatively greater blue compared to green signals indicated that a stimulus was probably an animal rather than a leaf, and vice versa.

The implications of this became clear when we fed these networks the visual signals caused by blue traps. The blue traps were never mistaken for shaded surfaces, but they were commonly misclassified as animals.

A close up of an insect with huge blue/green eyes
The horse fly (Hybomitra epistates) can inflict painful bites upon people and livestock.
Mircea Costina/Shutterstock

Of course, artificial neural networks are not real flies, nor exact models of a fly’s nervous system. But they do show us the most efficient way of processing a fly’s visual signals to identify natural stimuli. And we expect evolution to have taken advantage of similar principles in real fly nervous systems.

The best way to identify shade using the visual information a fly has is through brightness and not blueness. Meanwhile, the best way of identifying animals was, somewhat counterintuitively, using blueness. Such a mechanism is very strongly stimulated by blue traps, explaining why they prove such a powerful lure for hungry flies. Further evidence for this idea comes from field studies which show that tsetse landing on coloured traps are relatively starved.

If we can understand the sensory signals and behaviour that cause flies to be caught in traps, we can engineer traps to more efficiently exploit those mechanisms and more effectively control the flies. We’ve already had some success in doing this for tsetse flies.

More effective traps will help minimise the impacts of those flies on health and welfare of people and animals. They could help prevent the damaging effects of biting flies on livestock, help in the fight against dangerous fly-borne diseases such as sleeping sickness, and protect us and animals from fly attacks in general.

The Conversation

Roger Santer has received funding from the Knowledge Economy Skills Scholarships program, and from the Centre for International Development Research at Aberystwyth (CIDRA).