Automatic Counting of Gulls from Drone Images

A big part of my career has involved counting seabirds. The UK and Ireland, a bunch of islands on the edge of the Atlantic and just south of the Arctic, have some of the most important seabird colonies in the world, with about 8 million birds of 25 different species breeding here. Keeping track of them is hugely important so we know what’s going on both with the birds themselves, and with the wider oceanic ecosystem they rely on.

Traditional counts involve heading into seabird colonies to count their nests (we no longer just count the legs and divide by two). Although accurate, it’s hugely disturbing to the birds, and for more remote islands, can be very difficult and expensive to organise and access. Images taken from drones are an obvious way to make seabird censusing a lot easier and cheaper.

Image
a view of the gull colony at South Walney on a summer’s evening. the grassy ground is dotted with hundreds of gulls, and another hundred are in the sky. On the horizon is the silhouette of Piel Castle.

I first started trying to use drone imagery to count a gull colony at South Walney in 2016. Even back then I was sure there must be a way to automatically count thousands of gulls in an orthomosaic; as Machine Learning has developed it’s become possible, but every time I had a look at papers that had done this, it involved programming and maths that was far beyond me. My dream was some sort of simple GUI where a site manager could drop in a drone photo, and get the total number of gulls as the output.

Now finally I think we are almost there, with a QGIS plugin Deepness plus free accounts on a couple of commercial machine learning websites, following an incredibly simple tutorial:

The tutorial uses Roboflow to easily train a dataset (and the images for the dataset itself can be prepared using Deepness in QGIS), then Ultralytics to develop the model, which can be trained using the processing power in Google CoLab.

All of these have “free” tiers that are suitable for relatively small amounts of data, but I did have to slip a tenner to google to get more power to train the datsets.

Using this method, I split some aerial imagery of gulls from a saltmarsh, using the Deepness Plugin, into smaller squares. These were loaded into Roboflow, where I spent a good hour going through and tagging a few hundred birds. I followed the rest of the tutorial very easily, and ran the resulting ONNX file back in Deepness in QGIS:

Image
aerial view of gulls sitting on green saltmarsh
Image
different aerial view of gulls sitting on green saltmarsh; now they have black bounding boxes as I’ve tagged them for the dataset
Image
a much wider aerial view of the saltmarsh, a diamond of green with a muddy brown creek cutting through the centre. This is a stitched orthomosaic of several hundred drone images, covering an area of about 2ha. Hundreds of small red squares show where the ML has detected a gull.

I ran the model on all ten 2-hectare areas of a large, sparse gull colony in North West England that we had mapped in the summer. On these images, I had previously spent about 90 minutes manually marking on all gulls for a total of 597 birds.

The results weren’t great on the first run, as the model returned 870 registrations, with 20% of these being something that was not a bird, or the wrong type of bird - a flock of two dozen shelducks, for example, or a piece of driftwood. But it also returned around 100 gulls that I’d missed when manually checking the image.

Image
aerial view of two shelducks swimming in the water, with concentric ripples spreading out from them. They have been detected with a red bounding box by the model.

The solution here is to train it on more data, as I hadn’t included anything in the training data that wasn’t green saltmarsh, while the area I ran the model on did have areas of bare sand and mud containg pale, gull-sized rocks. Further refining of the training dataset will greatly improve this, and hopefully get us a model with a very high accuracy rate.

Once I have gotten the model to this accuracy, it should be very simple to share it and show anyone who is used to QGIS, how to run the model in the deepness plugin. Now instead of spending hours manually counting gulls in the aerial imagery it can be easily done in a few minutes with QGIS, with very little technical knowledge required.

For this colony, the traditional count took a team of about a dozen people two days to cover all the area, and because of this, was only censused once every 5 years at best. Now, potentially, the drone flight could be done by one person in an afternoon, and then counted by ML in about half an hour - a vast improvement in time and cost.

Updated: