All projects
August 2020 – February 2022 Archived

Search-and-Rescue Drone Vision

Fast obstacle detection for drone flight with YOLOv3-tiny, trained on my own dataset

  • Overall winner Vienna International Science Fair 2021
  • 50,000+ training iterations on a dataset I annotated
  • 35 fps detection on a GPU

This project started as a research proposal at the Summer STEM Institute in 2020. When the programme ended I continued it independently: the research, the dataset, the model and the path-planning algorithm are all my own work. The question was how to make collision avoidance faster, for a drone that knows its position from GPS and has to fly from one point to another as quickly as possible with no prior knowledge of the terrain. It won the Superior Ribbon, Best in Category for Mathematics and Computer Science, Best in Division (14 and above), and overall winner at the Vienna International Science Fair 2021.

The trained model running on footage I filmed with my drone in an alpine forest. Each box is a detected obstacle with its confidence.

Choosing the sensor and the model

I compared LIDAR, ultrasound, infrared and camera-based sensing, and chose a camera: my drone already carried one, image data is easy to collect, and cameras are cheap and fast. For the detector I chose YOLO over region-based CNNs, which are too slow for real-time use, and specifically YOLOv3-tiny for its small size, speed and low GPU memory requirement, all of which matter for hardware small enough to fly.

Dataset and training

There was no dataset for this task, so I built one. I took frames from the ColANet collision dataset and the UZH-FPV drone racing dataset, then annotated them by hand in LabelImg with a single class, Obstacle. A single camera gives no depth information, so I only labelled obstacles very close to the drone. This deliberately biases the model towards the obstacles that matter: it detects a tree only a few frames before impact, and the drone can keep flying in a straight line until it needs to manoeuvre, which is faster than steering around every obstacle in view.

I trained the model with Darknet, configured for one class and for maximum speed. Training on a CPU was estimated at two months, so I moved to Google Colab’s GPUs. Colab’s 12-hour session limit capped a run at about 20,000 iterations, so I resumed from checkpoints to train for more than 50,000 iterations in total. For test data I flew my drone through a forest in the Austrian Alps and annotated the footage.

I evaluated precision, recall, IoU and mAP at each checkpoint and at two confidence thresholds. At the final checkpoint, lowering the threshold from 0.25 to 0.1 raised precision from 0.73 to 0.84 and recall from 0.64 to 0.76. I chose the lower threshold on purpose: a false detection costs a small detour, while a missed one costs the drone. The test set was small and the overall mAP was modest at 0.12, so a larger dataset was the next step.

Path planning

The second part of the project was an algorithm that turns detections into a heading. For each frame it converts the edges of every bounding box into bearing angles, using the camera’s field of view. If every obstacle is clear of the forward direction by a set margin, the drone keeps flying straight. Otherwise it finds the nearest obstacle edge and the smallest heading change that clears it, checks that the new heading does not run into another obstacle, and repeats the next frame with the new heading as its reference. The algorithm is very cheap to compute, so it suits an on-board computer.

Designing the airframe

In a separate physics study I looked at how a drone’s physical build affects its top speed. I measured the stiffness of balsa, aluminium and carbon-fibre rods in a cantilever bending experiment: carbon fibre came out more than 15 times stiffer per unit mass than aluminium. I then designed a compact carbon-fibre frame around an NVIDIA Jetson Nano as the on-board computer, with 3-inch propellers chosen for thrust per watt.

The detection and path planning were developed and tested on recorded footage. Building the airframe and running the system on board was the planned next stage.