Identifying British earthworms currently requires collecting and killing specimens, to then use microscopic morphological features for identification. This is the biggest barrier to earthworm recording and limits the number of people who are willing and able to contribute earthworm species occurrence data to the National Earthworm Recording Scheme.
So, what if there was a way to identify earthworms live? So far, no live earthworm ID guide has proven accurate enough to meet the high standards of the National Earthworm Recording Scheme. This isn’t necessarily because some earthworm species couldn’t be identified live, but more likely because we simply don’t have enough data on the natural variation in live ID characters within and between species to produce a reliable guide.
The Earthworm Image Recognition Project was established to investigate the possibility of using auto-identification of earthworms from photos for use in future soil health apps.
This project received funding from the Department for Environment, Food and Rural Affairs (Defra) as part of the Natural Capital and Ecosystem Assessment (NCEA) programme. The NCEA is undertaking a nationwide survey of England’s land, coast and sea with the aim of transforming environmental decision-making by building a ‘whole system’ picture of the state of our natural environment

This proof-of-concept study was delivered by the UK Centre for Ecology and Hydrology and Biological Recording Company with guidance from the Earthworm Society of Britain, Defra and the Joint Nature Conservation Committee.

Earthworm Sampling Days
A programme of 16 Earthworm Sampling Days was delivered at sites across England and Wales. During these events, participants sampled for earthworms and used their personal smartphone devices to take photos of the specimens using a specific protocol. Following photography of the earthworms, the specimens were collected, euthanised and preserved so that they could be accurately identified by the National Recorder for Earthworms. Photos were submitted by the volunteer earthworm surveyors following the event and then added to the earthworm image training library.
No experience was necessary as all participants were trained on both earthworm sampling and the smartphone photography protocol. Furthermore, no photography skills were required – it’s important that the images used to train the AI come from a range of devices and are taken by individuals ranging in smartphone photography skill level so that the training data represents the actual data that farmers would be submitting when the app is tested.

In addition to the primary of aim of generating a training image library, the Earthworm Sampling Day programme also benefited the National Earthworm Recording Scheme by generating 295 new species occurrence records, including 11 instances where species were recorded for the first time within a Watsonian vice county. It also engaged new people with earthworm recording, resulted in specimens being added to regional and national museum collections and

Developing the Algorithm
In addition to the Earthworm Sampling Days, earthworms were collected, photographed and identified by Keiron Brown and Aidan Keith. A total of 12,179 photographs were taken of 650 different earthworm specimens that were identified to species level. 21 out of 30 UK species (or species aggregates) were represented within the training image library.

The images were divided into training, validation and testing sets and the algorithm underwent 34 epochs (training steps) until it no longer showed signs of improvement, reaching an overall accuracy of 42%. The confusion matrix below illustrates how the accuracy of the algorithm to correctly identify individual species was significantly variable and ranged from 0% to 69% depending on the species. A perfect algorithm would display a strong diagonal band and significant values away from this diagonal band indicate common misclassification. Looking at the significant misclassifications helped us to recommend a number of improvements to the image collection protocol and algorithm development that can be implemented to improve the performance of the model.

We also established issues with the algorithm using the whole image (rather than just the area with the earthworm) for species classification and recommendations were made for reducing or eliminating this issue.
Proof-of-concept Conclusions
- It is possible to recruit volunteers to collect a large number of images of earthworms using a detailed protocol.
- These images can be used as a training dataset by combining collection with laboratory identification.
- The collection protocol should be refined to avoid the over-handling of specimens, keep the collection tray clean and avoid strong shadows.
- The image set is strongly biased towards common species and more sampling effort will be required to balance the existing library.
- Using a segmentation algorithm to mask out the earthworms prior to classification may improve the performance of the algorithm.
- Species that bare proving too difficult for the algorithm to classify should be grouped into aggregates to improve the overall results.
- Computer vision models show some promise but more development is needed for a usable solution.
The Earthworm Image Recognition Project Activity Report provides a more detailed overview of this proof-of-concept study.
Acknowledgements
We’d like to say thank you to Defra and JNCC for sitting on a steering group for the project and to all the organisations that helped us to deliver this programme of events.

We’d also like to say a huge thank you to all of the volunteers who contributed to the sampling, photography and identification of earthworm specimens.








3 thoughts on “Earthworm Image Recognition Project”