Possibility of monitoring D.v. virgifera flight by processing image of phero-traps using Raspberry Pi based devices

Necessity for seasonal monitoring of economically most important pests in different crops, increase input costs of their surveillance. In maize fields, Western corn rootworm – WCR (Diabrotica virgifera sp. virgifera) is economically the most important species and presents a limiting factor for production of maize in continuous cultivation. Its occurrence is usually monitored with pheromone traps. However, as previously mentioned they are time and money consuming due to constant need for field inspections. Since in research projects, finances predefined for weekly inspection of traps are most often non-eligible, there is a need for developing a novel approach for pest monitoring. The use of IT technologies along with commercially available pheromone traps could provide precise information about the situation in traps without frequent field inspections. Also, they are easy to maintain, manipulate and require minimum costs. This work aimed to assess the potential use and the precision of a sensor device with camera, in monitoring the WCR flight on pheromone traps. Sensor device equipped with small camera can capture images of a pheromone trap sticky base and transfer them to a remote server for review, storage and analysis. The main idea in this paper is to present a system that uses a Acta Agriculturae Serbica, Vol. XXII, 44 (2017) 207-217 208 method based on analysis of the image variations of the pheromone pest traps, performed on devices placed in their vicinity which means that sending every image to the server is avoided. In this way, information about the variations in pheromone traps can be found in one location without unnecessarily sending the same images to the server. The obtained results indicate that the proposed method for monitoring the variations of the number of caught specimens on sticky surfaces of pheromone traps, based on the variations of the dark surface on the images, can be a reliable tool in further work.


Significance of insect monitoring
Monitoring the occurrence and flight dynamics of harmful insects during vegetation is one of the crucial elements that condition quality pest control.The results of monitoring (light traps, pheromone traps etc.) allow the proper signalization and timely application of insecticides (Stamenković, 2016).However, financing is the most limiting factor for the realization of this activity (Tanasković et al., 2014), namely high costs of field observations.Pheromone traps are the most frequently used type of traps in monitoring flight activities of major crop pests.This method requires weekly inspections of sticky surfaces and monthly replacement of the pheromones during vegetation.The longevity of these actions and the number of field visits depends on the pest species and the number of generations per year (voltinism).

D.virgifera virgifera -significance, distribution and monitoring with pherotraps
Worldwide, economically, the most important pest of maize cultivated in monoculture, is Western corn rootworm -WCR (Diabrotica virgifera virgifera Le Conte, Coleoptera, Chrisomelidae) (EPPO, 2015).This species was described for the first time in 1868, on the territory of USA, and in 1909, it was recognized as a pest (Krysan and Smith, 1987).By the 1950s, this species has expanded at a speed of 20 km/year.In 1959, the first resistant WCR populations to commonly used insecticides were registered, and since then, the pest has invaded new regions, invading annually 110-200 km of new space on the territory of the United States (Baufeld and Enzian, 2005).
During the period from late 80ties to the beginning of 21 th century, the pest was introduced in Europe in three completely independent introductions (Miller et al., 2005).In Serbia, WCR was registered for the first time, in the vicinity of the Surčin Airport, in 1992.From that point, within several years, the pest has completely spread through the entire territory of Serbia (Sivčev et al., 2009).In 1993, WCR has occupied an area of 110 000 ha, located within range of 50 km from the "entering point".In 1994, it was located on 200 000 ha, retaining the spreading dynamics of 10-50 km/year (Bača et al., 1995).In 1995, WCR was, for the first time, identified in maize fields in Slavonia, in the vicinity of Brčko, in southern Hungary and Romania.In 1996, the pest continued to expand, and it was found on the territory of Vojvodina, Mačva, Stig, but also in the region of Loznica, south of Jagodina and in Čačak (Čamprag et al., 1997).
Today, Serbia is in the group of the first seven maize producers in Europe, with more than a million hectares under maize production (Kos et al., 2013;EuroStat, 2017).Since maize has great significance in human and animal nutrition, and also since in technological processing, over 500 different products are obtained from maize, and the required quantities of grain and the whole plants as primary products are growing.Due to the fact that areas under this crop are increasing, and the opposite tendency of reduction of arable land, maize is frequently cultivated in monoculture.Since maize is one of rare species that can tolerate the monoculture and when quality control measures taken against common pests (wireworms, moths, European corn borer, Maize leaf weevil, rodents, birds) there are no major problems in the production.However, the appearance of WCR in the 1990s has brought into question the cultivation of maize in monoculture on the territory of Serbia.
To achieve stable and high yields, especially in regions where maize is cultivated in monoculture, or in several consecutive years, it is important to carry out a long-term forecast and apply proper control measures against WCR.The forecast is relied on the results of monitoring mainly by pheromone traps, because they are the most precise.It is important to emphasize that WCR flight dynamics must be monitored at several sites simultaneously, in order to achieve adequate signaling of its occurrence.This causes the increase of travel costs.Therefore, a monitoring system with commercially available pheromone traps should be developed, that provides precise information, that is easy to maintain and manipulate and that requires minimum costs.

Counting objects by image processing
The commercially available pheromone traps consist of blend (lure), trap "body" and a sticky surface.The number of captured insects, on this surface, is proportional to the overall number of these insects in the environment.Instead of regular inspections of traps by users, and instead of counting the number of caught specimens "on site", sensor devices with camera can be used to capture photos and send them directly to the user or to the server on the Internet.The received photos can be viewed in order to check current situation on the trap, i.e. the changes in a number of caught specimens.Also, a specific analysis could be performed on the server to detect the specific and precise number of insects without the user's intervention.Computation on Cloud server could be used to analyze image and discover how many insects were caught on sticky pheromone trap.
There are many software solutions for counting objects on images.They are applied in a variety of cases.Costa and Yang (2009) used this solution for finding the number of pollen grains in a sample, Barbedo (2012) used these methods for counting the microorganisms on microscopic images, and Selinummi et al. (2005) showed quantification of labeled bacteria.Image analysis was also used for counting apples in the orchard (Stajnko and Lakota, 2001), and for counting feeder fish in fish farms or shops (Toh et al., 2009).Rahman and Islam (2013) presented method for recognition and counting object with marker controlled segmentation.
The aim of the paper was to develop a software solution for identifying the changes in the number of caught D. virgifera virgifera beetles on sticky surface of pheromone trap, based on the developed wireless image transfer.

Field experimental design
The field experiment was carried out in Bečej, Vojvodina province, Northern Serbia, from May 31 st to August 15 th 2017.Experimental plot occupied 2 ha under maize cultivar NS-640.The chosen field for the experiment represents the field with low WCR natural infestation.
The WCR pheromone trap (ANDERMATT, Biocontrol -Switzerland) was positioned in the middle of central row in the experimental field, on June 27 th (26 Julian week).The presence of WCR beetles in the trap was recorded weekly until the August 15 th (35 Julian week), when the experiment was terminated as a consequence of a drought.During each field inspection, sticky bases were replaced, while the lure was replaced monthly.
Collected sticky bases were used for further image processing.

Raspberry Pi as basis of the system
Raspberry Pi 3 has system on chip (SoC) that includes four Cortex-A53 processing cores, with 1.2 GHz and two level of cache memory.Also include graphics processor Dual Core VideoCore IV and memory module with 1GB.Network connection could be established through Ethernet port or by WiFi connection.It has 40 general-purpose input-output (GPIO) pins that represent physical interface to the outside world (Raspberry Pi 3, 2017).
Raspberry Pi represents computer module that characterize small dimension, high processing power and variety of interfaces for connecting with different devices.With appropriate UI peripherals it could be functioning as standard PC, but with Internet access it could be working as independent device with remote control from users.The roll of hard disk has SD smart card and the role of a hard drive in module has a SD card.As operating system for Raspberry Pi there could be used Raspbian is one of specifically configured Linux operating systems (Vujović and Maksimović, 2014).
It has support for many peripheral devices such as Camera Serial Interface (CSI) connector for connection to Pi's camera board.Besides of using Raspberry Pi as classical computer it could be used in electronic projects because its general purpose input/output pins.The advantage of this module is in the possibility of development application that could read the inputs and control the outputs based on conditions in the same way as programming on desktop computers.This is achieved with Python high-level programming language as clear and easy to run.Python has great number of modules as addition to standard library, like GPIO module, that could be used for access to general inputs and outputs.Also there are libraries that allow applications on Raspberry Pi to access relatively easily to the Internet (Richardson and Wallace, 2016).
Application on Raspberry Pi, such as image analysis, was development using Python programming language with the addition OpenCV framework for performing image processing functions (OpenCV, 2017).

Image processing
In our paper we are estimating the number of insects by using the formula A n -represents area on captured image, expressed in pixels, that have black or nearby black color.
A in -represents area of initial image, before capturing any insects, expressed in pixels.Idealy, frame would be white and A in = 0, but sticky surface could have mark line or other objects added inadvertently that must be taken into account.
A n1 -is area in pixels of one average insect on image n est -is calculated number of insects on sticky surface according to occupied pixels on images.

Results and discussion
Sticky surface of the pheromone trap was replaced each week, caught specimens were counted visually and images were also taken periodically.In case when there was a small number of captured insects, counting object could be used to determine their number.The problem occurred when a higher number of insects were captured, larger area was occupied and insects were often stuck one to another, without clear bounders between them.This is situation when typical method for counting object could be difficult to implement.Also, the captured insects lose their color and become dark stains.So, they do not have any marker that could be used for enumeration.This problem was overcome by calculating area that insects occupied.The area is defined by the number of pixels with dark or near dark color.
The idea was to convert original image (Figure 2) from color to grayscale mode so other color on images or reflection do not have influence on computing area.After conversion, the image (Figure 2b) that will be used in the next step contained shades of grey to the black color.
Except insects, small impurities could entered in the trap accidentally from the environment and these spots often have black color which means that they may have influence on end result.Next step represented removing impurities and resulting image (Figure 3) was used then for calculating area expressed in number of pixels.virgifera on pheromone trap with removed smaller objects If the initial image before implementation is not all in white, then its content must be taken into account.Any changes in the image could be presented through the difference between current state and initial state.The ratio between the difference of black pixels on the image and the area of one average insect was used as indicator of the number of insects (Formula 1).
The number of caught D. virgifera virgifera beetles by visual inspection and the calculated number by software are presented in Table 1.The result of calculation presented as an example in Figure 2 was satisfactory, since the number of visually counted beetles and the number of beetles obtained by image analysis differed by 0.3% .
Often, in our application the accuracy of calculated number is not the most important for users, but only indications of major changes on images have very significant value for them.A user of the system may have information about the situation on pheromone traps without the need for continuous image viewing.System for calculation could be configured to inform user when there are significant changes on images or when the percent of black pixels expand over the specified criteria.The main benefit of our system is image processing on devices positioned near pheromone traps.These devices are based on Raspberry Pi module and its camera for taking images and their analysis.The initial idea was to send images from local devices on the Cloud server for storing and viewing.When users have access to images over time through Internet, they have no need to visit location with traps in order to check their status.
Although the results of this work indicate at precision of this Raspberry PI module in counting the insects on sticky bases of pheromone traps, the question remains: how would this system behave in the case when the image is not clear enough.For example, beside insects, some other objects could be caught in the trap, same size or larger than average insects.In these situations user has to go to the location of the trap and physically remove undesired or non target object.After this correction, trap would restore to previous state and the process of counting would be continued in the same way as before.
Presented system for calculation of caught insects could be implemented on server to reduce user engagement which means that users receive indication about significant changes.Devices used near traps have to send images continuously.The activity causes higher energy consumption because higher amount of data needs to be send.Also on the server side, data arrived from many locations could cause increased load and latency.To overcome this problem, computation could be extend from the server to a computer supported devices, closer to monitoring locations.Our counting system run on Raspberry Pi fits into this concept without necessary sending of all images.Images can be analyzed immediately and there is a small latency in obtaining results.In the case when result that indicates occurrence of the insect was detected, user can view images and take appropriate action.

Conclusion
The presented system for estimating the number of insects in pheromone traps has primarily an emphasis on the detection of changes in the images of captured insects.The estimated number has satisfactory accuracy as indicator for users to take appropriate actions in time.Further research will be carried out to verify the accuracy in unfavorable environmental conditions that may have impact on the clarity of the images.Also research will be directed towards moving data processing from server to devices near physical locations and checking the savings in data transmissions.
a) Block schema for Raspberry Pi; b) Raspberry Pi 3 model

Figure 2 .
Figure 2. Original (left -a) and image in grayscale mode (right -b) of sticky bases of Diabrotica virgifera sp.virgifera on pheromone trap

Figure 3 .
Figure 3. Image of catch insects on sticky bases of Diabrotica virgifera sp.virgifera on pheromone trap with removed smaller objects

Table 1 .
The number of caught beetles on sticky bases counted visually and calculated by image analysis