FlyAI
By Russell Barnes. Posted
The fate of the whole colony depends on a Raspberry Pi
Advertisement
Get started with Raspberry Pi – everything you need to know to start your journey!
Flies crawl around inside a transparent sphere, spied on by a camera, as a disembodied voice reads out image recognition data that determines whether or not they will be fed. This is the unsettling theme of flyAI, a Pi-powered art installation by David Bowen, who was inspired to create it after reading philosopher Nick Bostrom’s Superintelligence: Paths, Dangers, Strategies. The book explores the prospective effects of future super-intelligent AI on the human race and while there are some utopian possibilities, David says there are also dangers: “The AI could end up repurposing our atoms for food!”
The full article can be found in The MagPi 56 and was written by Phil King.
David tells us why he uses houseflies in some of his work: “They’re often a stand-in for the absurd or, thinking about collective behaviour, the will of the collective,” although their actions aren’t quite as random as you might expect: “They do like to work their way to the tops of containers; they’re attracted to light.
“Also, they don’t elicit as much empathy from viewers as another living creature,” adds David. That’s probably just as well given the nature of flyAI, in which the flies’ survival depends on the accuracy of image recognition. A regular USB webcam positioned at the top of the custom-built fly chamber is connected to a Raspberry Pi 3 which employs OpenCV to determine when a fly is in view and take a still. The photo is then classified by the Google TensorFlow image recognition algorithm which ranks the top five possibilities in order, along with their percentages. The results are revealed gradually on an LCD screen, as if being typed, and also read out aloud using the Festival text-to-speech system.

If ‘fly’ is ranked number one by the algorithm – which happens around 60% of the time according to David – the flies are given some food. “So their fate is determined by how accurate this AI is.” The feeding process is also controlled by the Pi, which triggers a relay to start a pump to supply sugar water from a bucket, up through tubes into the middle of the chamber.
Having run the experiment for six weeks in his workshop, David reveals that the survival rate is good: “They live for about 30-40 days, which I’m told is longer than they live in the wild… they were getting kind of geriatric!” This is despite them interfering with the image recognition in a certain way: “The flies poop all over the inside of the sphere, including where the camera is.” While David obtains his flies from an online source, he thinks they could possibly reproduce within the chamber if given the right conditions to lay their eggs.
Looking to add further elements to the project, David is exploring the possibility of using the fly corpses to provide material for a microbial fuel cell that he’s working on, which in turn will power the Raspberry Pi. He would also like to implement machine learning so that the image recognition gets smarter, “so the two [Pi and flies] could be more interdependent.”
Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles
Get started with Raspberry Pi in Raspberry Pi Official Magazine 161
There’s loads going on in this issue: first of all, how about using a capacitive touch board and Raspberry Pi 5 to turn a quilt into an input device? Nicola King shows you how. If you’re more into sawing and drilling than needlework, Jo Hinchliffe has built an underwater rover out of plastic piping and […]
Read more →
Win one of three DreamHAT+ radars!
That’s right, an actual working radar for your Raspberry Pi. We reviewed it a few months ago and have since been amazed at some of the projects that have used it, like last month’s motion sensor from the movie Aliens. Sound good? Well we have a few to give away, and you can enter below. […]
Read more →
RP2350 Pico W5 review
It’s Raspberry Pi Pico 2, but with a lot more memory
Read more →