Written by:  


Automated pest detection


AI is not magic, just plain hard work

Sounds easy — but data science is no magic bullet, it requires a lot of hard work, and a lot of labeled data. This takes time and effort. We needed to feed the pest detection algorithm with many iterations of labeled images, so it could gradually predict the pest type with increasing accuracy until it is fully trained to detect pests without any human intervention. 

We first focused on the detection of whiteflies, since those were the majority of the insects on the glue traps. Plus, they are quite easy to detect by eye (even an untrained eye, such as that of our data scientist, managed to identify them on the glue trap). Still, it took two months of taking pictures, labeling, and training and retraining the algorithm. But by then, we managed to detect the whiteflies with an average accuracy of 99%. Quite cool! 

Other pest types, like thrips, fruit flies, and sciaras, were also labeled in that period of time. This number was much lower than the number of whiteflies, but still enough to enable us to take our next step: to train our pest detection model to accurately detect these other pest types as well. That appeared to be more complicated, we did not reach the accuracy that we had with the whiteflies. So, the first idea: more pictures, more labels. But that did not bring the desired result either. Back to the hard work and common sense. We realized that the difference in accuracy might possibly be caused by the data labels. Could it be that labeling an insect using a picture taken by a camera would give other results than when you would look at the glue trap directly and note down each insect type? 

With that thought, we added a step where we compared the manual counts on paper from the expert’s daily rounds with the labels he mentioned on the pictures. And indeed, we found a difference in paper count per glue trap and labeled count per picture of that same glue trap. A tiny insect like a thrip is far more difficult to distinguish on a photo than ‘in real life’. 

So another manual step was needed: comparing the real glue traps and their pictures and adding the missing counts to the labeled data. We then retrained and finetuned the algorithm once more. And once more. And once more. But with a great result: accuracy of 93% for thrips.

More automation

With the achieved accuracy, it is possible to automate the daily or weekly count of insects on a glue trap. With that information, however, even more is possible. The pest detection application not only makes it possible to detect the type and number of flies but also gives insights into the location and increase or decrease of flies over time. A dashboard provides an overview of areas that require attention in the greenhouse, allowing the grower to take targeted preventive measures. Combined with the possibility to monitor the effect of those measures, the pest detection app thus enables cost reduction on expensive pesticides. And in the future, this can result in a fully automated pest detection process, monitoring the greenhouse on pests at any given time, enabling the expert to remotely access all required data to make (or confirm) decisions and use this data as evidence.

But when you have successfully applied or trained a model on a use case and you have proven that it works, you have spent about 10% of the effort required to productize it or embed it within a business process. 

Read this article in Dutch on groentennieuws.nl

Every week, indoor growers spend hours walking around their greenhouses, analyzing crops and inspecting the type and number of flies on glue traps. The latter plays a key role in the early-stage detection of pests. Early intervention significantly reduces crop waste and the use of crop protection products — thus, reducing costs. The inspection itself, however, takes a lot of time. And it requires the trained eye of a skilled expert.

So, what if we could automate it?

They are the biggest fear of any grower: pests. If you do not see them coming, yields can be ruined. Luckily, there exists such a thing as glue traps. By using these traps, pests can be foreseen at an early stage by simply monitoring whether the count of certain pest types increases over time. In order to do this, you need to be able to recognize the different pest types on a trap. This is not something that can be done by any employee; it requires the eye of an expert. And expert hours are, of course, costly and scarce. 

Fortunately, there is an alternative to the manual counting process. In a joint project with one of our customers, a cucumber grower, we automated this process of pest detection. 

pest detect2

Innovating with sensors and algorithms

The first step was gathering enough pictures of glue traps and flies on them, and to categorize each of these flies. So still quite a manual step as the starting point of the automation. 

For this, we built a mobile app to take pictures via a smartphone and send them to our cloud platform. Multiple weeks in a row, a team member of the grower took pictures of glue traps in their greenhouse, using this mobile application (please check our upcoming software engineering blog for more details on the creation of the app).  

Then, he used that same app to categorize each insect on the picture (data labeling). And the last step: with those labeled pictures, we trained our algorithm to accurately determine the different pest types and calculate the probability of beginning pests.

backBack to overview

Want to stay updated?