1. Introduction
It is estimated that insect pests damage 18–20% of the world’s annual crop production, which is worth more than USD 470 billion. Most of these losses (13–16%) occur in the field [
1]. Many notorious pests of very important crops (cotton, tomato, potato, soybean, maize etc.) belong to the order Lepidoptera and mainly to the sub-order of moths [
2], which includes more than 220,000 species. Almost every plant in the world can be infested by at least one moth species [
3]. Herbivorous moths mainly act as defoliators, leaf miners, fruit or stem borers, and can also damage agricultural products during storage (grains, flours etc.) [
4].
Some moth species have been thoroughly studied because of their dramatic impact on crop production. For example, the cotton bollworm
Helicoverpa armigera Hübner (Lepidoptera: Noctuidae) is a highly polyphagous moth that can feed on a wide range of major crops such as cotton, tomato, maize, chickpea, alfalfa, and tobacco. It has been reported to cause at least 25–31.5% losses on tomato [
5,
6]. Without effective control measures, damage by
H. armigera and other moth pests on cotton can be as high as 67% [
7]. Similarly, another notable moth species, the tomato leaf miner
Tuta absoluta Povolny (Lepidoptera: Gelechiidae), is responsible for notable losses from 11% to 43% every year but can reach 100% if control is inadequate [
8].
Effective control measures (e.g., pesticide spraying) require timely applications that can only be guaranteed if a pest population monitoring protocol is in effect from the beginning till the end of crop season. Monitoring of moth populations is usually carried out by various paper or plastic traps such as the delta and the funnel that rely on sex pheromone attraction [
9]. The winged male adults follow the chemical signals of the sex pheromone (the female’s synthetic odor) and either are captured on a sticky surface or, in the case of a funnel-type trap [
10], land on the pheromone dispenser and, over time, get exhausted and fall into the bottom bucket. Manual assessment requires people to visit the traps and count the number of captured insects. If performed properly, manual monitoring is costly. In large plantations, traps are so widely scattered that a means of transport is required to visit them repeatedly (usually every 7–14 days). Many people such as scouters and area managers are involved; therefore, manual monitoring cannot be performed at a large scale, spatially and temporally, due to manpower and cost constraints. Moreover, manual counting of insects in traps is often compromised due to its cost and repetitive nature, and delays in reporting can lead to a situation where the infestation has escalated to a higher level than currently reported.
For these reasons, in recent years we have witnessed a significant advancement in the field of automated vision-based insect traps (also known as e-traps, see [
11,
12,
13] for thorough reviews). In [
14,
15,
16,
17,
18] the authors use cameras attached to various platforms for biodiversity assessment in the field, while in this study we are particularly interested in agricultural moth pests [
19,
20,
21,
22,
23,
24]. Biodiversity assessment aims to count and identify a diverse range of flying insects that are representative of the local insect fauna, preferably without eliminating the insects. Monitoring of agricultural pests usually targets a single species in a crop where traps of various designs (e.g., delta, sticky, McPhail, funnel, pitfall, Lindgren, various non-standard bait traps, etc.) and attractants (pheromones or food baits) are employed. Individuals of the targeted species are captured, counted, identified, and eliminated. Intensive research is being conducted on various aspects of automatic monitoring such as different wireless communication possibilities (Wi-Fi, GPRS, IoT, ZigBee), power supply options (solar panels, batteries, low-power electronics design, etc.) and sensing modalities [
25,
26]. Fully automated pest detection systems based on cameras and image processing need to detect and/or identify insects and report wirelessly to a cloud server level. The transmission of the images introduces a large bandwidth overhead that raises communication costs and power consumption and can compromise the design of the system that must use low-quality picture analysis to mitigate these costs. Therefore, the current research trend—where also our work belongs—is to embed sophisticated deep-learning-based (DL) systems in the device deployed in the field (edge computing) and transmit only the results (i.e., counts of insects, environmental variables such as ambient humidity and temperature, GPS coordinates, and timestamps) [
27,
28]. Moreover, such a low-data approach allows for a network of LoRa-based nodes with a common gateway that uploads the data, further reducing communication costs. Our contribution detects and counts the trapped insects in a specific but widely used trap for all species of Lepidoptera with a known pheromone trap: the funnel trap.
The camera-based version of the funnel trap is attached to a typical, plastic funnel trap without inflicting any change in its shape and functionality. Therefore, all monitoring protocols associated with this trap remain valid even after it is transformed to a cyber-physical system. By the term ‘cyber-physical’ we mean that the trap is monitored by computer-based algorithms (in our case deep learning) running onboard (i.e., in edge platforms). Moreover, in the context of our work, the physical and software components are closely intertwined: the e-trap receives commands from and reports data to a server via wireless communication and changes its behavioral modality by removing the floor of the trap through a servomotor to dispose of the captured insects and repositioning itself after disposal.
Automatic counting of insects is an active field of research with many other approaches beyond camera-based traps [
25]. Automatic counting and wireless reporting is important because then, insect monitoring can scale up to global scales. Knowing where and how serious the infestation is, allows us to prioritize and apply interventions in a timely manner without making excessive use of insecticides. Our contribution and the novelties we introduce are as follows:
(A) Deep learning classification largely depends on the availability of a large amount of training examples [
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39]. Construction of large image datasets from real field operation is time-consuming to collect, as it requires annotation (i.e., manually labeling insects with a bounding box using specialized software). Manual annotation is laborious as it needs to be applied to hundreds of images and requires knowledge of software tools that are not generally well-known to other research fields such as agronomy or entomology. We develop a pipeline of actions that does not require manual labeling of insects in pictures with bounding boxes to create image-based insect counters.
(B) E-traps must autonomously operate for months without human intervention. To face the inevitable problem of complete overlap of insects we introduce a novel, affordable mechanism (<USD 10) that completely solves this problem by attaching a servomotor to the bottom of the bucket. We detach the bottom of the bucket from the main e-funnel, and the servomotor can rotate and dispose of the trapped insects that have been dehydrated by the sun. A device with the ability to dispose of a congested scene solves the serious limitation caused by overlapping insects.
(C) We specifically investigate problematic cases such as overlapping and congestion of insects trapped in a bucket. During field operations, we observed a large number of trapped insects (30–70 per day). When the insect bodies pile up, one cannot count them reliably from a photograph of the internal space of the trap. The partial or complete occlusion of insects’ shapes as well as congregation of partially disintegrated insects and debris are common realities that prevent image processing algorithms from counting them efficiently in the long run. We studied this problematic case, and present crowd counting algorithms originally applied for counting people in surveillance applications.
(D) We carry out a thorough study comparing three different DL approaches that can be embedded in edge devices with a view to find the most affordable ones in terms of cost and power consumption. In order for insect surveillance at large scales to become widely adopted, hardware costs must be reduced and the associated software must be made an open-source. Therefore, we open-source all the algorithms to make insect surveillance widespread and affordable for farmers. We present results for two important Lepidopteran pests, but our framework (that we open-source) can be applied to automatically count all captured Lepidoptera species with a commercially available pheromone attractant.