27th Nov, 2020.

Introduction

Flying quadcopters is a lot of fun! You eventually run into some obstacles but most of the time you enjoy being able to control something that flies. I really loved playing with my quadcopter but as it went farther away from me, it became difficult to spot where it was. That's when I thought: Is there a way to detect this quadcopter from a far away distance?

Collecting the data

We humans are able to identify a quadcopter only by seeing it numerous times in various positions. This enables our mind to create mental maps of what a quadcopter looks like. For a computer to do this job, we need to first supply it with a lot of images of drones taken in different orientations and different backgrounds. On searching online for various drone datasets, I could find none. the last resort of this problem was to manually create the dataset. This data collection would take a really long time as the model would need at least ~1000 images of the drones labelled with where the drones are present in the image. To solve this problem, I wrote a python script which would generate this dataset. The script would superimpose "ONLY drone" images with a "background image" which would give us different images of the same drone in various positions and angles. Below is how the images are added:

image.png

image.png

The first image is the original drone image. The second image is this same drone superposed on a background. As you can see with just one image of this drone and multiple backgrounds, we can generate a lot of images for training our model.

Training the model

The model I used for training this drone detector was based on the YOLO-v3 architecture. I trained the model for a couple thousand epochs and then tested this trained model on my own drone!

Results

https://www.youtube.com/watch?v=5cwzs7jM8so

The model does pretty well in finding my drone. Note that the training data does not include even a single image of my drone!