Member-only story
Learning to make drones ‘see’ with artificial intelligence

When I initially got the itch to purchase a ‘beginner’ level drone a few months back, I didn’t really know why I wanted it.
I didn’t want to pay big bucks because odds were I’d lose it, crash it or simply not appreciate it so I bought a sub $100 DJI ‘Tello’ drone (this one if you’re interested). I figured it’d be amusing for a while. A neat diversion to buzz around the backyard on a sunny day. It was a tiny little thing, with its four wee propellers and demure front-facing camera.
But when I learned that this unassuming flying machine could be interfaced to using Python and the djitellopy
library, I suddenly became way more interested. A drone I could program? That has a camera?
Oh yes, this is much more my speed. I felt an AI/ML experiment coming on and decided there and then that I was going to set myself the weekend goal to see if I could leverage machine learning to get this drone to perform near real-time object recognition.
In other words, teach the drone to see.
The Setup
It might seem counterintuitive to show you the end result at the beginning, but I think giving you an architecture overview first provides useful end-to-end context.
From there we can walk through each component, and the what/how/why of it coming into the picture. If you stick around until the end you’ll hopefully see a drone that can perform in-flight object recognition as it whizzes around the place.
So, what did I end up building? Let’s take a look:

As you can see, there are two main components in our solution, our drone_object_detector.py, and our Flask web server. At its core, we’re going to execute the drone_object_detector.py
script on the Tello drone while it’s in-flight. This will continually take images using the drones (admittedly quite rough) front-facing camera. These images will be sent to our flask web server, which will perform object detection on the images, then display them in a crude HTML window for us to view.