Back to R&D main

On-farm faecal worm egg count proof of principle

Project start date: 20 April 2018
Project end date: 07 November 2018
Publication date: 20 November 2018
Project status: Completed
Livestock species: Sheep, Goat, Lamb, Grassfed cattle, Grainfed cattle
Relevant regions: National
Download Report (1.3 MB)


The current process for obtaining faecal worm egg counts can be a time-consuming exercise; both in terms of the manual counting of eggs, and also the time it takes to send a faecal sample to a laboratory and receive the results. The on-farm faecal worm egg count proof of principle project aims to use machine learning to create an artificial intelligence (AI) model to replace the manual process of identifying and counting parasite eggs in samples. In so doing, it will be possible for the process to be completed on site, without involving a lab. As the ultimate users for the application reside in areas with unreliable mobile phone and internet connections, the project sought to confirm the feasibility of deploying the AI model to a mobile device with only occasional internet connectivity, where the phone’s camera would be used to capture images for evaluation.

The project proved that an AI model could be trained to recognise and count strongylid eggs from a set of computer-generated images. The model was then tested on an Android and iOS device; where a generated image on the device’s image library could be run against the model to count the number of eggs in the image. It was also proven that the model could be applied to a picture taken of a generated image using the phone’s camera. Finally, based on a comparison of detection and classification models, it was determined that a detection model was more precise at identifying different egg types and counts.

In order to train the AI model, tens of thousands of images were required. Individual egg types and plant debris were isolated from a sample image and fed into image-generating software that varied the placement and number of eggs on an image. The images were provided to an open-source machine learning platform, called TensorFlow; where transfer learning was used to ‘re-train’ a convolutional (image recognition) model. This model was then tested against generated images to determine how successful it was at predicting the presence of eggs.

A basic mobile app was created to use the AI model. The model was then deployed to an Android device using the TensorFlow Lite system. A user was able to select a preloaded image and run it against the AI model to obtain an egg count.

The project continued by extending the application to run on an iOS device; where the model was run against pictures taken using the phone’s camera. Computer generated images were printed out for this purpose.

Finally, a detection AI model was created to compare the precision and accuracy of a detection model to a classification model. By running the same set of images against both models, it could be determined which model was more effective at identifying and counting different egg types.

In conclusion, AI and machine learning are viable technologies for counting worm eggs in faecal samples. Using specialised systems, AI models can be deployed and run on mobile devices. However, further testing of the models against real images is required and consideration should be given to simplifying the problem by applying physical optimisations. For example, contriving a situation in which eggs cannot overlap and only appear in relatively small numbers.

Regardless of the presence of such a model, there remains a challenge around generating the images themselves. In order to get an image, producers will need to obtain and prepare samples for evaluation. Images must also be captured at the right distance for an accurate assessment.

More information

Project manager: Johann Schroder
Primary researcher: Solentive Systems Pty Ltd