Next Article in Journal
Creep Modelling of Rootstock during Holding in Watermelon Grafting
Next Article in Special Issue
On Using Artificial Intelligence and the Internet of Things for Crop Disease Detection: A Contemporary Survey
Previous Article in Journal
Alternaria alternata as a Seed-Transmitted Pathogen of Sida hermaphrodita (Malvaceae) and Its Suppression by Aureobasidium pullulans
Previous Article in Special Issue
Modeling the Essential Oil and Trans-Anethole Yield of Fennel (Foeniculum vulgare Mill. var. vulgare) by Application Artificial Neural Network and Multiple Linear Regression Methods
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Four Stage Image Processing Algorithm for Detecting and Counting of Bagworm, Metisa plana Walker (Lepidoptera: Psychidae)

by
Mohd Najib Ahmad
1,2,
Abdul Rashid Mohamed Shariff
2,3,4,*,
Ishak Aris
5 and
Izhal Abdul Halin
5
1
Agronomy & Geospatial Technology Unit, Biology & Sustainability Research Division, Malaysian Palm Oil Board, 6, Persiaran Institusi, Bandar Baru Bangi, Kajang 43000, Selangor, Malaysia
2
Department of Biological and Agricultural Engineering, Level 3, Faculty of Engineering, Universiti Putra Malaysia (UPM), Serdang 43400, Selangor, Malaysia
3
Smart Farming Technology Research Centre, Universiti Putra Malaysia, Serdang 43400, Selangor, Malaysia
4
Laboratory of Plantation System Technology and Mechanization (PSTM), Institute of Plantation Studies, Universiti Putra Malaysia, Serdang 43400, Selangor, Malaysia
5
Department of Electrical and Electronic Engineering, Level 4, Faculty of Engineering, Universiti Putra Malaysia (UPM), Serdang 43400, Selangor, Malaysia
*
Author to whom correspondence should be addressed.
Agriculture 2021, 11(12), 1265; https://doi.org/10.3390/agriculture11121265
Submission received: 29 September 2021 / Revised: 15 November 2021 / Accepted: 15 November 2021 / Published: 14 December 2021
(This article belongs to the Special Issue Digital Innovations in Agriculture)

Abstract

:
The bagworm is a vicious leaf eating insect pest that threatens the oil palm plantations in Malaysia. The economic impact from defoliation of approximately 10% to 13% due to bagworm attack might cause about 33% to 40% yield loss over 2 years. Due to this, monitoring and detecting of bagworm populations in oil palm plantations is required as the preliminary steps to ensure proper planning of control actions in these areas. Hence, the development of an image processing algorithm for detection and counting of Metisa plana Walker, a species of Malaysia’s local bagworm, using image segmentation has been researched and completed. The color and shape features from the segmented images for real time object detection showed an average detection accuracy of 40% and 34%, at 30 cm and 50 cm camera distance, respectively. After some improvements on training dataset and marking detected bagworm with bounding box, a deep learning algorithm with Faster Regional Convolutional Neural Network (Faster R-CNN) algorithm was applied leading to the percentage of the detection accuracy increased up to 100% at a camera distance of 30 cm in close conditions. The proposed solution is also designed to distinguish between the living and dead larvae of the bagworms using motion detection which resulted in approximately 73–100% accuracy at a camera distance of 30 cm in the close conditions. Through false color analysis, distinct differences in the pixel count based on the slope was observed for dead and live pupae at 630 nm and 940 nm, with the slopes recorded at 0.38 and 0.28, respectively. The higher pixel count and slope correlated with the dead pupae while the lower pixel count and slope, represented the living pupae.

1. Introduction

In Malaysia, the palm oil sector is described as one of the key contributors to the national economy and currently, the palm oil industry has contributed a GNI of RM 79.9 billion in 2017 [1]. The palm oil industry spans the value chain from upstream plantations to downstream processing with the oil palm planted area in Malaysia at about 5.81 million hectares in 2017 [2].
The oil palm bagworm is a leaf eating insect that has caused 43% yield loss in two years period [3]. Based on bygone records of bagworm infestations (1986–2000), it has been confirmed that over 63,955 ha of oil palm planted in 69 estates in Peninsular Malaysia had been attacked by the M. plana and P. pendula bagworm species [4]. Integrated pest management of the bagworms has been implemented in the past, however, information on their population dynamics, incidences, biological characteristics and dispersion are still understudied.
Based on the literature, there are several examples of image processing that have been applied in agriculture. An exclusion of the non-leaf portion from the leaf’s main area was applied by Mora et al. [5] to estimate the leaf area index (LAI) subsequently allowing more precise values of physiological information at the whole-plant level. An autonomous field robot was used for spraying and pollinating date clusters; it tracked its targets continuously whilst in motion. To realize the robot function, image processing algorithms were designed and implemented by Shapiro et al. [6] to be used in a spraying guidance system that was based on a proportional controller, evaluating the system dynamics and examining its behaviour under different parameters. Steward et al. [7] acquired sequential images of weed patches to switch nozzles on and off at correct locations in a plantation. The image processing algorithm, through image segmentation, was also used by Amatya et al. [8] to segment out branch and cherry regions from leaves and background for sweet cherry harvesting. They obtained 89.6% branch pixel classification exactness by applying RGB color structures on each pixel together with a Bayesian classifier for separating the branch pixels. Balch et al. [9] introduced fast color-based tracking and incorporated it with motion-based tracking to detect ants in a simultaneous video stream, and also presented new approaches for investigating the spatial movement of ant colonies.
Realizing the importance of precise data collection, efforts to develop a ground-based device using a deep learning image processing algorithm targeted to detect bagworms has been developed in this work. A Faster R-CNN was used to detect and count the bagworms on site. Robustness was evaluated by the ability to exclude moving objects which come in the form of flying insects in an oil palm plantation. As part of this study, an automatic detection system was the practical approach which used image processing techniques for the detection of the bagworms and classification algorithms to classify them according to the different properties of the images. The need for development of image processing algorithm for bagworm detecting and counting is crucial especially distinguishing the living and dead bagworms population. By meeting the target, planters can be assisted using an automated bagworm counter device to carry out census prior to control actions activity and can save the pesticides usage due to accurate timing of bagworms control.

2. Four Stage Methodology for the Bagworm Detection Algorithm

The proposed image processing algorithm comprises of four stages which involve image segmentation, shape extraction using morphological operators, object detection using deep learning with Faster R-CNN, image classification to distinguish between the stages of the bagworms, and finally, counting of the bagworms. Details of the designed procedure (Figure 1) followed by the experimental results of each stage is explained in the following subsections:

2.1. First Stage—Image Segmentation

The first stage involved the development of an image segmentation algorithm to localize/detect the region of interest (RoI) in the dataset based on color processing. The data obtained from the color processing was used to track the bagworms.
In stage 1100 RGB images from the site at Kg Teluk Bunot, Banting, Selangor, Malaysia was taken using a digital fixed-lens camera. The spatial resolution of each image was 4288 × 2845 pixels. The images were then resized to 300 × 199 pixels and filtered using a Gaussian smoothing technique with a 2D convolution operator to blur the image for noise reduction. These steps are comparable to using a mean filter, but with a different kernel that represents the shape of a Gaussian hump. The results were filtered again to sharpen, enhance the edges, and to allow detailed high-frequency image information to pass whilst lessening slow-changing data in the images. This was implemented by subtracting the blurry parts of the image [9]. Finally, the centre of focus where the bagworms resided was set as the target area [10].

2.2. Second Stage—Morphological Image Processing

The second stage used the morphological operator method, which focused on the extraction of shapes and patterns whilst removing non-targeted regions in the dataset.
In stage 2, the results were obtained using a Pyramid mean shift filter and Gaussian blur filter, which were both applied to the image in a Figure 2a, resulting in the images shown in Figure 2b,c.
Next, a color space of the image (Figure 2b) was converted from the RGB to a hue, saturation, value (HSV) to search for a specific color that represented the bagworms (Figure 3).
From the HSV color space, the Upper and Lower color range was determined using Color Picker software, where this range corresponded to the bagworm images. For the bagworms, the color ranges were as follows:
{Lower bagworms = [int(0.0 × 179), int(0.0 × 255), int(0.8 × 255)]}
{Upper bagworms = [int(0.2 × 179), int(1.0 × 255), int(1.0 × 255)]}
Subsequently, the threshold of the HSV image was found by subtracting the RoI with the HSV threshold image (Figure 4). Finally, the subtracted image was converted to grayscale and dilated to obtain the threshold image shown in Figure 5.

2.3. Third Stage—Object Detection through Deep Learning and Classification

The third stage involved classification, which employed a supervised classifying algorithm. This algorithm was based on trained data, specific to size and shape recognition to distinguish between the stages of bagworms. Experiments were conducted on three groups of M. plana Walker, which were classified according to their stages of development as shown in Table 1. The first group contained the early larval stage, 1–3. The second group was made up of the late larval stage, 4–7. The third group was the pupal stage (positioned at the bottom part of the oil palm fronds).
In stage 3, an algorithm was developed to detect the bagworms and classify them into groups of stages. This was achieved by training the dataset from the images for object detection and recognition. A deep learning technique with Faster R-CNN coupled with a Region Proposal Network (RPN) [11] was used to predict the object bounds and exact scores at each position. The Faster R-CNN model with a RPN is a fully-convolutional network that simultaneously predicts object bounds and objectness scores at each position. RPNs are trained end-to-end to generate high quality region proposals, which are used by Faster R-CNN for detection. With a simple alternating optimization, RPN and Faster R-CNN can be trained to share convolutional features. It enables a unified and deep-learning-based object detection system to run at 5–17 fps. The learned RPN improves region proposal quality and object detection accuracy. With almost 8000 images plus videos, the dataset was trained to produce a trained detection model which was based on the Faster R-CNN algorithm and classified into sets of images with bagworms or without bagworms. There are two steps involved in preparing the system to detect the bagworm; training and testing. Training is the process to produce a trained detection model. It was based on Faster R-CNN algorithm. Each step of training reports the loss. It will start high and get lower and lower as training progresses. The model trains until the loss consistently drops below 0.05.
The progress of the training job is monitored using TensorBoard as shown in Figure 6. A total of 8000 samples were trained from 400 images with an average of 20 samples per image. Training images were manually marked with bounding boxes that indicated areas where bagworms exist. Once training is completed, the model is tested with another input image to verify the accuracy of bagworm detection.
TensorFlow had been opted for since it is an open source artificial intelligence library and it allows creation of large-scale neural networks with many layers. It has the fastest growing library with active support and a lot of pre-trained models including the Faster R-CNN. The deep learning (DL) with Faster R-CNN algorithm for detecting bagworms is illustrated in the flow chart as shown in Figure 7.
The classification of the larval stages was carried out by grouping the larval stages based on their real size. Purpose of grouping the bagworms according to their stages is to assist detection of the larvae and pupae based on their eating behavior, position on palm frond and movement characteristic. These groups are planned to be used as targeted objects in three mode of selection in automated detector device. Here, three groups have been defined and shown in Table 1. Based on their actual size, which ranged from 1–12 mm, the image dataset consisted of bagworm pixel intensity trained according to each stage. Then, the input RGB images were resized without distorting their aspect ratio. Since there were various shapes of the bounding box, a good size representation was achieved by measuring the diagonal distance of the box. This was to simplify the detection without investigating the orientation of the bagworm.
Figure 7 describes the process flow of the bagworm detection algorithm using the DL with Faster R-CNN. It detected any movement of the bagworm by substracting the moving foreground from static background by using BackgroundSubstractorMOG2. The image from camera was initially froze into sequence of frames and labeled as current and previous frame. The algorithm continued processing the next frame until video captured was stopped. Then, after identify and masking the bounding box for the moving object, the living bagworm was visualized in a green box, whilst the dead bagworm was identified in a grey box.

2.4. Fourth Stage—Counting and Determination of the Living and Dead Larvae and Pupae through Motion Tracking and False Color Analysis

At the fourth stage, the technique for distinguishing the living and dead larvae and pupae through the motion analysis algorithm and false color analysis is done. Then, the counting algorithm was used to count the bagworm populations corresponding to the specified groups.
All the images captured at the field consisted of bagworms and leaflets, and contained zero static backgrounds. A static background is a clean background without a subject to be detected. Therefore, the BackgroundSubtractorMOG2 technique was used to produce the static background. Images from the camera were frozen into a sequence of frames. For simplicity, two frames were labelled as the current frame and the previous frame. The algorithm kept on continuing to the next frame until the video capture was stopped. This condition generated an assumption, where the moving bagworm was identified as a living bagworm and the static bagworm was recognized as a dead bagworm [12].
The living and dead bagworms were determined through motion tracking and false color analysis. An image where the bagworms were detected contained the image of the bagworm size and mortality. Using the pixel arrangement as a Cartesian coordinate system, a bounding box was drawn over the detected regions in the image. Mortality was determined by analyzing the bounding box for moving objects by placing it on the masked images. If a box contained masked moving objects, then the bagworm was classified as alive (labelled in a green box) and a living bagworm counter was incremented. Dead bagworms were detected and accounted for when the bounding box analysis found no movement in the masked images and were represented in a grey box (Figure 7).

2.5. Motion Tracking for Determination of the Living and Dead Larvae

Motion analysis was used to detect dead and living larvae. It detected any movement of the larvae by subtracting the moving foreground from the static background. The following describes the motion analysis algorithm process.
  • Previous frame was processed to be the static background image using BackgroundSubtractorMOG2.
  • Current frame was applied to the GaussianBlurr to filter the noise and become the foreground image.
  • Masked the background image with the foreground image.
  • Applied the cv2.countNonZero of the overlapping background image with the foreground image.
  • If there was a nonzero counter, it meant there was movement in the frame.

2.6. False Color for Determination of the Living and Dead Pupae

60 samples of dead and living pupae were randomly placed on a black ground canvas. Two light sources had been identified to be economical and practical, namely the 940 nm (IR) and 630 nm (red). These two wavelength points were selected based on the spectral reflectance properties of the living and dead pupae, which were significantly different between the 630 nm and the 940 nm. The data was achieved using a spectroradiometer in other experiments [13] to find the reflectance percentage at specific wavelengths for the pupae. The images for 630 nm and 940 nm were then captured in RGB format. The images were converted to grayscale before an average of all the pixel’s values were picked within a pupa’s boundary. The average pixel values were collected for all samples.
The steps for pixel counting are mentioned as follows:
  • Source captured in RGB
  • Location of each pupa was marked to calculate the slope value under the red vision (630 nm) as compared to the IR (940 nm) of the pupa at the same location.
  • Viewed image in grayscale using OpenCVimshow (img, imgfile, grayscale_option)
  • Zoomed each pupa until the pixel value was displayed.
  • Picked all the pixels from a pupa image.
  • Averaged the pixel values.

2.7. Counting

After all the bagworm detection procedures had been conducted, counting was carried out by averaging the total bagworms detected for 200 frames of an image. In this study, 200 frames were set during the snapshot.

2.8. Experimental Setup

The experiment was conducted under three different controlled conditions. The controlled conditions were set up as follows: (a) fully closed area, (b) half open area and (c) fully open area as shown in Figure 8. Meanwhile, the position of the camera from the targeted objects was set at 30 cm and 50 cm distance from the subjects to compensate for changes in lighting conditions and shadowing. Other factors that had to be accounted for were vibration and false capture of objects, such as other insect species that may have flown into the field of view of the camera setup.

2.9. Data Analysis

Data on detection accuracy with different approaches were analyzed using a one-way ANOVA and the means were separated by the Least Significant Difference (LSD) test at p < 0.05. The Pearson product-moment correlation coefficient was calculated to evaluate detection performance of the live and dead larvae of the bagworms using deep learning algorithm and manual counting.

3. Results

3.1. Stage-1 and 2

In the color space processing method, which involved morphological image processing, the results showed that the accuracy of the detection was low; the averages were 40% and 34%, at the 30 cm and 50 cm camera distances, respectively (Table 2). This was due to the color similarity between the damaged leaflets and the bagworms (Figure 9 and Figure 10).
The different camera distances gave different coverage areas of the whole frond. The farther the distance (50 cm), the wider the area that could be covered on a single frond. However, it showed poor feature details of the bagworms (Figure 9). Meanwhile, the closer the distance (30 cm), the better the details were but the coverage area was limited. This condition might cause problems when the setup is applied in the field, where more camera snapshots will be needed to cover the whole frond. Based on site measurements, it was revealed that the 30 cm camera distance needed 9 snapshot sessions and the 50 cm camera distance required 6 snapshot sessions to cover the whole frond. By applying the color processing approach, the controlled conditions did not significantly affect the results (Figure 9 and Figure 10). Although the camera distance was adjusted to 30 cm and 50 cm, the results had low detection accuracy as shown in Table 2.
The results for bagworms detection using a color processing technique at 30 cm and 50 cm camera distances is shown in Figure 9 and Figure 10, respectively. This colorimetric approach gave a poor result on detecting bagworms, although, the input images had been controlled in terms of light source or surrounding light and snapshot distances from the subject. The HSV (Hue, Saturation, and Value) parameters had been set to their optimum values, with the lower limits set at [0,0,204] and the upper limits adjusted to [36,255,255], nevertheless, wrong and missed detections of the RoI were still observed. This was due to the damaged leaflets having a close intensity and color range with the bagworms [14] (Figure 11).
Based on Figure 11, the effect of the damaged palm leaflet which had the same color of the bagworms led to the difficulty to detect the RoI and attributed to the wrong detection of the bagworms.

3.2. Stage-3

The results of the deep learning (DL) approach for detecting bagworms, captured at camera distances of 30 cm and 50 cm are shown in Figure 12 and Figure 13. By adopting this technique, the detection accuracy improved tremendously as compared to the stage 1 and 2 methods. The green boxes represented the boundary boxes which contained the RoI of the bagworms. Figure 12b and Figure 13b show better bagworm recognition as compared to the open and half open areas.
The summary results of the DL approach with Faster R-CNN for stage 3 is illustrated as follows:
From Table 3, it was proven that the DL with Faster R-CNN gave better results. There was a significant difference in terms of detection accuracy between the 30 and 50 cm camera distances, where p < 0.05 for the closed condition, as compared to other conditions. It generated the highest detection accuracy, recorded at 100% and 90%, respectively (Figure 14). Whereas, there was a slightly low detection at 30 cm and 50 cm camera distances for open and half open conditions, resulting in 90% and 80% detection. The wrong detection was observed, 10% and 20%, due to insufficiently strong trained data.
Based on Figure 14, the different image processing approaches between Stage 1&2 and Stage 3 gave different levels of detection accuracy and it was proven by the one-way ANOVA analysis with the Least Significant Difference (LSD) test at p < 0.05. By using the color processing technique, it was revealed that the percentage of the detection accuracy was low. The highest detection accuracy for the Stage 1&2 methods was recorded at the 55% detection accuracy at the 30 cm camera distance.
Meanwhile, by applying the Stage 3 method (DL), the percentage of detection accuracy increased up to 100% at the 30 cm camera distance. From both stages’ techniques, it was revealed that the 30 cm camera distance resulted in better detection performance and showed more accurate feature details of the bagworms.
Figure 15 shows the results for the bagworm group detection based on their real sizes at the 30 cm camera distance. The RoI was detected based on the boundary boxes, which were labelled according to larval group, on Group 1 (G1) and group 2 (G2) that were tracked in real-time in the field and the results are shown in Table 4. The results of the algorithm detection correspond reasonably close with the results of human detection. The correlation coefficients of the detection rate for group 1 and group 2 were 0.914 and 0.891 at standard deviation of 0.581 and 0.162, respectively.
Based on Table 4, the results of the algorithm detection were comparable with human detection for group 1 classification, and led to an almost 100% accurate detection. However, for Group 2 classification, 17–33% wrong detection was recorded due to the inconsistent distance of the image sensor to the bagworm and the moving orientation of the bagworms in Group 2.

3.3. Stage-4

Through motion tracking, the algorithm was able to distinguish between living and dead bagworms based on motion-tracking. Any motion detected in the bounding box was classified as a live bagworm. Bounding boxes created from previous detections were used to indirectly calculate the bagworm sizes and classified them into groups. The results of the detection of the living and dead bagworms are shown in Table 5.
The results in Table 5 showed that the algorithm was able to distinguish between the living and dead larvae, 100% in Group 1. However, false detection amounting to 27% was observed when distinguishing Group 2. The reason for false detection is when bagworms overlapped each other. This false detection can also be a miss-detection because sometimes bagworms are still alive but they are parasitized.
A Pearson product-moment correlation coefficient was computed to assess the relationship between the detection of the live and dead G1 larvae using DL algorithm and manual counting. There was a positive correlation between the two variables (DL algorithm and manual counting), r = 0.961, n = 30, p = 0.002 (live larvae) and r = 0.990, n = 30, p = 0.003 (dead larvae). A scatterplot summarizes the results (Figure 16).
From a scatterplot in Figure 17, there was a positive correlation between the two variables (DL algorithm and manual counting), r = 0.961, n = 30, p = 0.004 for live G2 larvae and r = 0.982, n = 30, p = 0.002 for dead G2 larvae. Overall, there was a strong or positive correlation between the detection of the live and dead G1 and G2 larvae via DL algorithm and manual counting. This indicated that DL algorithm showed a capability to be used in automatic detection system and able to produce high accuracy compared to manual counting.
The results of the living and dead pupae detection were achieved using our custom machine learning algorithm, which is presented in Table 6. A false color imaging method was used [15]. From the false color results, distinct differences in the pixel count based on the slope were observed for the dead (0.34) and live pupae (0.28) in the spectral band range of 630 nm (Red) and 940 nm (IR). This was possible due to the spectral reflectance properties between the dead and living specimens (0.38 and 0.26, respectively).

4. Discussions

In color processing technique, it was revealed that percent detection of the bagworms was low, ranging from 30–40%. Although variables such as surrounding light effect and camera distance were controlled and minimized, the results seem to be similar due to difficulty to differentiate color between bagworm and damage palm leaflet. Within HSV colorspace, the bagworm color range was searched and Upper and Lower color range was determined, however, the damage leaflet has a close and same color range which is brownish color (normal practice observation) [14]. This nature condition contributed to low detection accuracy of the bagworm through color processing technique. In order to overcome this constraint, deep convolutional neural networks were practiced and applied. It has been broadly applied in various challenging and puzzling tasks namely segmentation [16], classification [17] and object detection [18]. In this study, by applying a deep CNN, the percentage of detection accuracy was increased, up to 100% (Figure 14). A closer camera distance resulted in a higher percentage of detection accuracy due to there being more details in the images. The result was almost the same as reported by Najib et al. [19], whereby a closer camera distance gave 100% detection accuracy and better detection performance. However, the imaging environment needs to be properly controlled to minimize the variables and increase the detection accuracy. Frankly, any movement such as shadow, noise and override from surrounding was the main challenge that needed to be considered and minimized [12]. A high resolution imagery, such as 1600 × 1200 pixels or more, is needed for strong detection. Thus, camera distance plays an important role to maximize details of the recognized object during snapshot [20]. By employing the closed conditions at the 30 cm and 50 cm camera distances, the highest percentages of detection accuracy were obtained, at 100 and 90%, respectively. Furthermore, the video processing or motion tracking method was applied at the 30 cm camera distance in the closed condition, with the aspect ratio of the video file being fixed to 16:9 to get an accurate result. Indeed, by classifying bagworms according to groups, the algorithm was able to successfully distinguish between the stages of the bagworms, which relied on a bounding box that possessed the orientation and stage of the bagworms. According to Gutierrez et al. [21], the best approach based on pests, Bemisia tabaci and Trialeurodes vaporariorum detection and identification accuracy is investigated using machine learning and deep learning models. By applying the ML algorithms, K-nearest neighbour (KNN) and Multilayer Perceptron (MLP), the best healthy and unhealthy pest detection average rate were obtained with an accuracy rate of 63.8% and 64.9%, respectively. Whilst, the DL algorithm was getting an accuracy rate of 85.5% for the pest detection, implying that the DL technique is a better solution than the ML technique. Ding and Taylor [22] has carried out a DL with a neural network model to detect, categorize and count the moths population and attained a good result. By working under idyllic experimental settings, it is predicted that the model can obtain better results, although, the sunlight and obstructions might affected the images quality. Then, Xie et al. [23] has integrated a sparse-coding method for encrypting insect images using a multi-kernel learning (MKL) approach to make an insect detection system, whereby obtained a mAP (mean average precision) result of 86% for 24 type of insects in the fields. Another approach was compared through a supervised classifier, which was generated and developed by Diago et al. [24] to portray the grapevine canopy, measured leaf area and yield by using RGB images, with referred to the Mahalanobis distance. The segmentation algorithm was successfully discriminate the leaves and grape cluster with 92% and 98% accuracy, respectively. The contrast between object, black grapes with leaves and surrounding determined the performance of segmentation. Another study done by Nuske et al. [25], successfully applying the image processing technique to estimate yield in the vineyard. Based on their results, different light conditions demonstrated an excellent color features and texture condition descriptors, aiming for grape bunch segmentation. With an average error between 3 to 11%, the total yield could be well projected. In addition, Xia et al. [26] reported that small insect pests detection should be carried out under controlled light conditions due to variable illumination effects. High resolution imagery such as 1600 × 1200 pixels or more is needed for strong detection. The visible imagery had a higher resolution and was able to display more detailed features, such as the target geometry and localization to discriminate the background. Furthermore, the Faster R-CNN which was created from SPP-Net, achieved bold-alteration performance in accuracy, speed and accomplish end-to-end networking as part of the main object detection work [27]. The convolutional layers create a set of anchors at diverse scales and aspect ratios, predicting the bounding box coordinates together with a probability score and determining the region whether it is an object or background. Through the feature maps, the anchors are developed by spatially sliding a 3 × 3 window. Then, these features are applied for object classification and bounding box regression layers, whereby it functions to determine or verify whether the region proposal is a targeted object or just a background. Meanwhile, the bounding box is forecasting the coordinates of the region. In our study, further analysis by pixel counting under greyscale images resulted in different slope values for both pupae, which successfully gave positive results, with an 89% detection accuracy.

5. Conclusions

We can conclude that a 4-stage image processing algorithm can be used to detect bagworms. Deep learning with Faster R-CNN is a feasible, practical, and reliable method for bagworm detection. An accuracy of 100% detection is possible as demonstrated by the accuracy achieved in stage 3 of the algorithm. A camera distance of 30 cm, in a controlled lighting environment resulted in the highest percentage of detection accuracy. The motion tracking and false color approaches have successfully distinguished between the living and dead larvae and pupae, respectively, with up to 100% and 89% accuracy.

Author Contributions

Conceptualization, M.N.A. and A.R.M.S.; methodology, M.N.A., I.A. and A.R.M.S.; software, M.N.A. and A.R.M.S.; validation, M.N.A., A.R.M.S., I.A. and I.A.H.; formal analysis, M.N.A.; investigation, M.N.A.; resources, M.N.A.; data curation, M.N.A.; writing—original draft preparation, M.N.A.; writing—review and editing, A.R.M.S. and I.A.H. All authors have read and agreed to the published version of the manuscript.

Funding

This research received Universiti Putra Malaysia Journal Publication Fund, project code~9001103.

Institutional Review Board Statement

This research received no external funding.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

The authors would like thank the Director-General of the Malaysian Palm Oil Board (MPOB) for permission to publish this article, the financial support, patenting of all data under the pending patent filing with PI No.: 2019006153 and protecting copyright of the algorithm under Voluntary Notification of Copyright No. CRLY 00022664. Thanks also to University Putra Malaysia (UPM) for all support rendered throughout this research. Our thanks to Sakina Bibi Mohamed Shariff for the professional editing services rendered.

Conflicts of Interest

No potential conflict of interest was reported by the authors.

References

  1. National Transformation Programme Annual Report. Available online: https://www.pemandu.gov.my/assets/publications/annualreports/NTP_AR2017_ENG.pdf (accessed on 13 May 2018).
  2. Kushairi, A.; Soh, K.L.; Azman, I.; Elina, H.; Meilina, O.A.; Zanal, B.M.N.I.; Razmah, G.; Shamala, S.; Ahmad Parveez, G.K. Oil palm economic performance in Malaysia and R&D progress in 2017. J. Oil Palm. Res. 2018, 30, 163–195. [Google Scholar]
  3. Malaysian Palm Oil Board. Standard Operating Procedures (SoP) Guidelines for Bagworm Control; Malaysian Palm Oil Board (MPOB): Bangi, Malaysia, 2016; pp. 1–20. ISBN 978-967-961-218-9. [Google Scholar]
  4. Ho, C.T.; Yusof, I.; Khoo, K.C. Infestations by the bagworms Metisa plana and Pteroma pendula for the period 1986–2000 in major oil palm estates managed by Golden Hope Plantation Berhad in Peninsular Malaysia. J. Oil Palm Res. 2011, 23, 1040–1050. [Google Scholar]
  5. Mora, M.; Avila, F.; Carrasco-Benavides, M.; Maldonado, G.; Olguín-Cáceres, J.; Fuentes, S. Automated computation of leaf area index from fruit trees using improved image processing algorithms applied to canopy cover digital photography. Comput. Electron. Agric. 2016, 123, 195–202. [Google Scholar] [CrossRef] [Green Version]
  6. Shapiro, A.; Korkidi, E.; Demri, A.; Ben-Shahar, O.; Riemer, R.; Edan, Y. Toward elevated agrobotics: Development of a scaled-down prototype for visually guided date palm tree sprayer. J. Field Robot 2009, 26, 572–590. [Google Scholar] [CrossRef] [Green Version]
  7. Steward, B.L.; Tian, L.F.; Tang, L. Distance-based control system for machine vision-based selective spraying. Trans. ASAE 2002, 45, 1255–1262. [Google Scholar] [CrossRef] [Green Version]
  8. Amatya, S.; Karkee, M.; Gongal, A.; Zhang, Q.; Whiting, M.D. Detection of cherry tree branches with full foliage in planar architecture for automated sweet-cherry harvesting. Biosys. Eng. 2015, 146, 3–15. [Google Scholar] [CrossRef] [Green Version]
  9. Balch, T.; Khan, Z.; Veloso, M. Automatically tracking and analyzing the behaviour of live insect colonies. In Proceedings of the 5th International Conference on Autonomous Agents, Montreal, Canada, 28 May–1 June 2001; pp. 521–528. [Google Scholar]
  10. Uvais, Q.; Chen, C.H. Digital Image Processing: An Algorithmic Approach with MATLAB; CRC Press, Taylor & Francis Group: Boca Raton, NJ, USA, 2010. [Google Scholar]
  11. Ren, S.; He, K.; Girshick, R.; Sun, J. Faster R C-NN: Towards Real-Time Object Detection with Region Proposal Networks. In Proceedings of the Advances in Neural Information Processing System 25, 24th International Conference, ICONIP 2017, Guangzhou, China, 14–18 November 2017; pp. 91–99. [Google Scholar]
  12. Yang, Y.; Peng, B.; Wang, J.A. System for Detection and Recognition of Pests in Stored-Grain Based on Video Analysis. In Proceedings of the Conference on Control Technology and Applications, Nanchang, China, 3–5 June 2010; pp. 119–124. [Google Scholar]
  13. Najib, M.A.; Rashid, A.M.S.; Ishak, A.; Izhal, A.H.; Ramle, M. Identification and determination of the spectral reflectance properties of live and dead bagworms, Metisa plana Walker (Lepidoptera: Psychidae), using Vis/NIR spectroscopy. J. Oil Palm Res. 2020, 33, 425–435. [Google Scholar] [CrossRef]
  14. Najib, M.A.; Rashid, A.M.S.; Ramle, M. Monitoring insect pest infestation via different spectroscopy techniques. Appl. Spectrosc. Rev. 2018, 53, 836–853. [Google Scholar]
  15. Najib, M.A.; Rashid, A.M.S.; Ishak, A.; Izhal, A.H.; Ramle, M. A false colour analysis: An image processing approach to distinguish between dead and living pupae of the bagworms, Metisa plana Walker (Lepidoptera: Psychidae). Trans. Sci. Technol. 2019, 6, 210–215. [Google Scholar]
  16. Badrinarayanan, V.; Kendall, A.; Cipolla, R. Segnet: A deep convolutional encoder-decoder architecture for image segmentation. IEEE Trans. Pattern Anal. Mach. Intell. 2017, 37, 2481–2495. [Google Scholar] [CrossRef] [PubMed]
  17. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
  18. Dai, J.; Li, Y.; He, K.; Sun, J. R-FCN: Object detection via region based fully convolutional networks. Adv. Neural Inf. Process. Syst. 2016, 379–387. [Google Scholar]
  19. Najib, M.A.; Rashid, A.M.S.; Ishak, A.; Izhal, A.H.; Ramle, M. Development of an automated detection and counting system for the bagworms, Metisa plana Walker (Lepidoptera: Psychidae), census. In Proceedings of the 19th International Oil Palm Conference 2018: Nurturing People and Protecting the Planet, Cartagena, Colombia, 26–28 September 2018. [Google Scholar]
  20. Simone, W.; Heinz, H.F.B.; Johannes, P.S.; Alexander, T.; Christian, S. Effects of infrared camera angle and distance on measurement and reproducibility of thermographically determined temperatures of the distolateral aspects of the forelimbs in horses. JAVMA Sci. Rep. 2013, 242, 388–395. [Google Scholar]
  21. Gutierrez, A.; Ansuategi, A.; Susperregi, L.; Tubio, C.; Ivan Rankit, I.; Lenda, L. A Benchmarking of Learning Strategies for Pest Detection and Identification on Tomato Plants for Autonomous Scouting Robots Using Internal Databases. J. Sens. 2019. [Google Scholar] [CrossRef]
  22. Ding, W.; Taylor, G. Automatic moth detection from trap images for pest management. Comput. Electron. Agric. 2016, 123, 17–28. [Google Scholar] [CrossRef] [Green Version]
  23. Xie, C.; Zhang, J.; Li, R.; Li, J.; Hong, P.; Xia, J.; Chen, P. Automatic classification for field crop insects via multiple-task sparse representation and multiple-kernel learning. Comput. Electron. Agric. 2015, 119, 123–132. [Google Scholar] [CrossRef]
  24. Diago, M.; Correa, C.H.; Millan, B.; Barreiro, P.; Valero, C.; Tardaguila, J. Grapevine yield and leaf area estimation using supervised classification methodology on RGB images taken under field conditions. Sensors 2012, 12, 16988–17006. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  25. Nuske, S.; Wilshusen, K.; Achar, S.; Yoder, L.; Narasimhan, S.; Singh, S. Automated visual yield estimation in vineyards. J. Field Robot. 2014, 31, 837–860. [Google Scholar] [CrossRef]
  26. Xia, C.; Lee, J.-M.; Li, Y. In situ detection of small-size insect pests sampled on traps using multifractal analysis. Opt. Eng. 2012, 51, 02700. [Google Scholar] [CrossRef]
  27. Kai, H.; Muyi, S.; Xiaoguang, Z.; Guanhong, Z.; Hao, D.; Zhicai, L. A New Method in Wheel Hub Surface Defect Detection: Object Detection Algorithm Based on Deep Learning. In Proceedings of the International Conference on Advanced Mechatronic System, Xiamen, China, 6–9 December 2017; pp. 335–338. [Google Scholar]
Figure 1. Big picture of the four stage methodology for bagworm detection.
Figure 1. Big picture of the four stage methodology for bagworm detection.
Agriculture 11 01265 g001
Figure 2. Morphological image processing using: (a) Original RGB image, (b) Polarized image after Pyramid mean shift filter, and (c) Gaussian blur filter.
Figure 2. Morphological image processing using: (a) Original RGB image, (b) Polarized image after Pyramid mean shift filter, and (c) Gaussian blur filter.
Agriculture 11 01265 g002
Figure 3. Color space conversion from RGB to HSV.
Figure 3. Color space conversion from RGB to HSV.
Agriculture 11 01265 g003
Figure 4. Targeted object with HSV.
Figure 4. Targeted object with HSV.
Agriculture 11 01265 g004
Figure 5. Threshold bagworms image.
Figure 5. Threshold bagworms image.
Agriculture 11 01265 g005
Figure 6. Loss of dataset during training progress.
Figure 6. Loss of dataset during training progress.
Agriculture 11 01265 g006
Figure 7. Process flow for the Faster R-CNN algorithm with moving object detection.
Figure 7. Process flow for the Faster R-CNN algorithm with moving object detection.
Agriculture 11 01265 g007
Figure 8. Controlled conditions (a) fully closed area, (b) half open area, and (c) fully open area.
Figure 8. Controlled conditions (a) fully closed area, (b) half open area, and (c) fully open area.
Agriculture 11 01265 g008
Figure 9. Object detection based on 30 cm camera distance with: (a) open, (b) closed and (c) half open areas.
Figure 9. Object detection based on 30 cm camera distance with: (a) open, (b) closed and (c) half open areas.
Agriculture 11 01265 g009aAgriculture 11 01265 g009b
Figure 10. Detection based on 50 cm camera distance with: (a) open, (b) closed and (c) half-open areas.
Figure 10. Detection based on 50 cm camera distance with: (a) open, (b) closed and (c) half-open areas.
Agriculture 11 01265 g010
Figure 11. Wrong detection of targeted objects through the color processing technique.
Figure 11. Wrong detection of targeted objects through the color processing technique.
Agriculture 11 01265 g011
Figure 12. Detection based on 30 cm camera distance through DL with controlled conditions: (a) open, (b) closed and (c) half-open areas.
Figure 12. Detection based on 30 cm camera distance through DL with controlled conditions: (a) open, (b) closed and (c) half-open areas.
Agriculture 11 01265 g012
Figure 13. Detection based on 50 cm camera distance through DL with: (a) open, (b) closed and (c) half-open areas.
Figure 13. Detection based on 50 cm camera distance through DL with: (a) open, (b) closed and (c) half-open areas.
Agriculture 11 01265 g013aAgriculture 11 01265 g013b
Figure 14. Detection accuracy based on different image analysis techniques according to the Stage 1&2 and Stage 3 methods at different camera distances. Note: Bars across a group with the different letters were significantly different (p < 0.05) after the LSD test.
Figure 14. Detection accuracy based on different image analysis techniques according to the Stage 1&2 and Stage 3 methods at different camera distances. Note: Bars across a group with the different letters were significantly different (p < 0.05) after the LSD test.
Agriculture 11 01265 g014
Figure 15. Classification of bagworm stages according to features extracted and marked with bounding box: (a) Test 1, (b) Test 2, and (c) Test 3.
Figure 15. Classification of bagworm stages according to features extracted and marked with bounding box: (a) Test 1, (b) Test 2, and (c) Test 3.
Agriculture 11 01265 g015
Figure 16. Detection performance of the live and dead G1 larvae by deep learning (DL) and manual counting.
Figure 16. Detection performance of the live and dead G1 larvae by deep learning (DL) and manual counting.
Agriculture 11 01265 g016
Figure 17. Detection performance of the live and dead G2 larvae by deep learning (DL) and manual counting.
Figure 17. Detection performance of the live and dead G2 larvae by deep learning (DL) and manual counting.
Agriculture 11 01265 g017
Table 1. Bagworm classification corresponding to real sizes subjected to the stages of development.
Table 1. Bagworm classification corresponding to real sizes subjected to the stages of development.
GroupBagworm StagesReal Sizes, mm
11–31.3–4.4
24–74.5–10.1
3pupal10.2–13.6
Table 2. Color processing performance at different camera distances and conditions.
Table 2. Color processing performance at different camera distances and conditions.
Camera DistanceConditionAlgorithm
Detection
Human
Detection
Detection, %
30 cmOpen91947
Closed101953
Half open41921
50 cmOpen31926
Closed71936
Half open91946
Table 3. DL performance to detect bagworms at different camera distances and areas.
Table 3. DL performance to detect bagworms at different camera distances and areas.
Camera DistanceConditionAlgorithm
Detection
Human
Detection
Detection, %
30 cmOpen91090 a
30 cmClosed1010100 b
30 cmHalf open91090 a
50 cmOpen81080 a
50 cmClosed91090 b
50 cmHalf open81080 a
Note: Rows with different letters were significantly different (p < 0.05) after one-way ANOVA using the LSD test.
Table 4. Bagworm group classification performance between algorithm and human.
Table 4. Bagworm group classification performance between algorithm and human.
Data
Samples
Algorithm DetectionHuman DetectionWrong Detection of G1, %Wrong Detection of G2, %
Group 1Group 2Group 1Group 2
Figure 15a383 800
Figure 15b5106121717
Figure 15c68612033
Table 5. Algorithm performance on the determination of living and dead bagworms according to bagworm group.
Table 5. Algorithm performance on the determination of living and dead bagworms according to bagworm group.
GroupsDeep Learning DetectionActual Number of BagwormsWrong Detection of Live
Bagworms, %
Wrong Detection of Dead Bagworms, %
LiveDeadLiveDead
G1313100
G285115270
Table 6. Measured slope on reflectance of living and dead pupae specimens using 630 nm and 940 nm wavelengths.
Table 6. Measured slope on reflectance of living and dead pupae specimens using 630 nm and 940 nm wavelengths.
Descriptive StatisticsSpectral ReflectanceFalse Color Imaging
LiveDeadLiveDead
Mean0.26 ± 0.020.38 ± 0.020.28 ± 0.020.34 ± 0.02
Min0.26 ± 0.020.38 ± 0.020.15 ± 0.010.30 ± 0.02
Max0.27 ± 0.020.38 ± 0.020.46 ± 0.010.46 ± 0.01
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Ahmad, M.N.; Shariff, A.R.M.; Aris, I.; Abdul Halin, I. A Four Stage Image Processing Algorithm for Detecting and Counting of Bagworm, Metisa plana Walker (Lepidoptera: Psychidae). Agriculture 2021, 11, 1265. https://doi.org/10.3390/agriculture11121265

AMA Style

Ahmad MN, Shariff ARM, Aris I, Abdul Halin I. A Four Stage Image Processing Algorithm for Detecting and Counting of Bagworm, Metisa plana Walker (Lepidoptera: Psychidae). Agriculture. 2021; 11(12):1265. https://doi.org/10.3390/agriculture11121265

Chicago/Turabian Style

Ahmad, Mohd Najib, Abdul Rashid Mohamed Shariff, Ishak Aris, and Izhal Abdul Halin. 2021. "A Four Stage Image Processing Algorithm for Detecting and Counting of Bagworm, Metisa plana Walker (Lepidoptera: Psychidae)" Agriculture 11, no. 12: 1265. https://doi.org/10.3390/agriculture11121265

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop