Enhancing Precision and Stability: A Cognitive Approach for Pesticide Image Segmentation in Crop Leaves

-The precise delineation of pests from crop foliage is crucial in intelligent pest identification. This study presents a novel cognitive segmentation methodology that aims to enhance the accuracy and reliability of this crucial procedure. The technique comprises several essential stages: The proposed method utilizes sophisticated image block processing techniques to partition the pest image into smaller, more manageable parts. Additionally, an adaptive learning technique is utilized to carefully choose the initial cluster centres, guaranteeing the segmentation procedure's precision. Subsequently, using K-means clustering facilitates the acquisition of initial segmentation outcomes, hence augmenting the identification procedure. To mitigate the impact of leaf veins, the proposed approach utilizes three digital morphological characteristics closely linked to ellipses. The study involved conducting experimental segmentation trials on crop photos that contained whiteflies. The study's findings provide compelling evidence that the suggested cognitive segmentation method outperforms existing techniques in accuracy and robustness. This technological development provides a robust basis for future pest identification and crop management advancements.


I. INTRODUCTION
The timely detection and identification of pests in real-time are crucial factors in improving pest control strategies, resulting in minimized crop damage and reduced pesticide costs.By integrating multi-spectral machine vision technology into an integrated pest management (IPM) system, a more versatile and resilient solution can be provided for the surveillance of a wide range of invertebrate pests, including the pink bollworm.Furthermore, thermal imaging technology integrated within the same machine vision framework can effectively identify diverse vertebrate pests, such as wild boars and rats.Traditional pest scouting techniques performed by human scouts, such as sweep nets, traps, or beat-sheet procedures, can take time and effort.Hence, there is a growing demand for using autonomous aerial vehicles, specifically quadcopters integrated with multispectral and thermal imaging systems, to conduct real-time pest scouting.This technology enables efficient scouting operations during the day and night.
The utilization of unmanned aerial vehicles for autonomous scouting has the potential to offer up-to-date data regarding the numbers and spatial distribution of pest and vertebrate populations.As a result, focused pest management measures can be implemented, thereby decreasing the need for wideranging chemical sprays that impact entire agricultural areas.This methodology enables targeted actions to effectively mitigate the impact of vertebrate pests, resulting in decreased agricultural losses and reduced pesticide expenditure.In addition, it alleviates the unintentional negative consequences inflicted upon beneficial species such as bees and natural predators of pests [1].Previous research endeavours have investigated diverse methodologies for identifying and monitoring pests.Authors in [2] obtained favourable outcomes by using Near Infrared (NIR) images spanning a wavelength range of 700 to 1500 nm and soft X-ray images within the range of 0.1 nm to 10 nm to detect invertebrates.The identification of weighting elements as crucial was noted, with the observation that using extreme weight values can lead to errors.
The early pest identification algorithm utilizing a cognitive vision technique was proposed by researchers in [3].Nonetheless, the researchers' efforts were limited by the utilization of sensors that solely captured static images-in their study in [4] examined the capabilities of a ground-based hyperspectral imaging system.However, their research was restricted to small, acquired images, which restricts its practicality for monitoring vegetation on a broad scale.Their stud in [5] utilized an RGB imaging system to diagnose plant diseases.However, the outcomes of disease detection using this method were frequently found to be less than desirable.The efficacy of this method could be augmented by incorporating multispectral imaging techniques.The machine vision technique for scouting whiteflies in greenhouse conditions was introduced by [6].Although their method demonstrated efficiency, additional improvements could be achieved by incorporating various types of pests and conducting studies in both laboratory and field environments.This article presents a novel approach for pest detection using machine vision and multispectral imaging, which does not require supervised network training.The utilization of multispectral images in this study is justified by their enhanced adaptability to dynamic environmental conditions, such as fluctuations in sunshine and partial occlusions, in contrast to RGB photographs.Significantly, our methodology focuses on assessing green foliage's ultraviolet (UV) spectrum ranging from 100 nm to 400 nm.This investigation aims to identify and detect nine invertebrate species, which represent a previously untapped area in the field of pest detection study.II.LITERATURE REVIEW Within agriculture, picture segmentation assumes a crucial function by acting as a virtual tool that effectively delineates the plant from its immediate environment or discerns the fruit from the remainder of the plant and its background.This activity is essential for facilitating automated agricultural procedures, including harvesting, yield estimation, and disease detection [7].Image processing technologies provide us with the ability to detect items accurately, quickly, and delicately, resembling the act of harvesting ripe fruit without causing harm to the plant.However, the journey towards attaining precise plant and fruit detection by image processing is not devoid of obstacles.Consider a hypothetical situation in which the illumination conditions cause the object's visual perception to be altered, resembling the phenomenon of a chameleon assuming a new coloration.In the presence of unpredictable lighting conditions, segmentation algorithms that rely on colorbased approaches encounter significant challenges as they attempt to interpret the constantly changing hues [8,9].The situation becomes increasingly perplexing when the subject exhibits a coloration that closely resembles its environment.For example, let us contemplate the challenge of identifying a lush fruit, such as an apple or grape, concealed among a foliage of leaves and branches, all adorned in a uniform verdant hue.In situations characterised by their mysterious nature, the traditional method that relies on colour as the primary determinant encounters difficulties, hence creating a desire for more effective outcomes [10].In order to overcome these obstacles, experts in the field have put forth approaches that utilise a wide range of characteristics, such as texture and shape, by closely examining groups of pixels and their complex interconnections [11].However, numerous innovative strategies heavily rely on the utilization of thresholds to measure attributes such as colour, shape, or size.This technique might be likened to a game with ever-changing rules for each new image, resulting in outcomes that are as unpredictable as the weather.The essential aspect of this issue pertains to recognizing that the total effectiveness of fruit and plant detection heavily relies on the proficiency of our segmentation efforts [12][13][14].Therefore, we must develop a resilient segmentation algorithm that remains steadfast, irrespective of the colour variations of the fruit or the background scenery.In an era characterized by dynamic and evolving issues, it is crucial to thoroughly examine contemporary research efforts about the detection of plants and fruits.Within the subsequent pages, we present an extensive collection of modern methodologies sourced from the archives of academia [15,16].This compilation represents a rich tapestry woven through innovative approaches and persistent efforts.

A. Acquisition of Images
The whitefly, a small but highly destructive insect notorious for its ability to drain the vitality of various plant species, poses a significant challenge in agriculture.The record of life's tale is painstakingly documented by Barbedo (2014) throughout six distinct stages.The whiteflies attain maturity during the final phase of this entomological narrative, exhibiting a small physical dimension of roughly 1mm.The mature adult whitefly (Trialeurodes vaporariorum Westwood) is easily identifiable due to its yellowish abdomens and spotless white wings, as illustrated in Fig. 1.This characteristic appearance makes it a prominent subject of our investigation.

FIGURE 1. Enhanced Images of adult whiteflies
Our pursuit of an extensive collection of whitefly visual records brought us to the expansive Xiaotangshan National Precision Agriculture Research Demonstration Base, situated in the scenic surroundings of Beijing, China.Equipped with a diverse array of digital cameras and the versatile optical capabilities of mobile phones, we began on a photographic expedition aimed at capturing the fundamental nature of these enigmatic insects.By carefully adjusting the position of our lenses at a captivatingly close distance, ranging from 20 to 60 centimetres from the lush foliage, we took great care to guarantee that our photographs were caught with precise perpendicular alignment.The visual representation of our study into the complex realm of whiteflies is revealed in the comprehensive collection of images showcased in Fig. 2.

B. Data Pre-processing
The inclusion of image preparation was integral to our methodology, encompassing two essential processes.The bilinear interpolation method was initially utilized to scale and crop photos to facilitate segmentation.photos with dimensions below 100 pixels were afterwards set to zero.Following this, the crop photos were partitioned into blocks, with the size of each block being chosen based on previous knowledge and expertise.Figure 3 depicts the outcomes of the pre-processing stage, which is a vital preliminary step in our expedition of picture analysis.The investigation of whiteflies involves an exploration of its mysterious nature.Figure 1 clearly represents their unique attributes, which serve as a valuable tool in our efforts to differentiate these small insects within the visually dynamic context of agricultural imagery.Upon traversing the vast range of colours inside the RGB (Red, Green, Blue), we have a significant and noticeable abundance of green tones.Equipped with this valuable understanding, we began a rigorous mathematical exploration, harnessing the computational capabilities of Euclidean distance.The distance in question functioned as a navigational tool, guiding us as we traversed the complex RGB vectors of each pixel.In this manner, we assumed the role of a digital mapper, meticulously mapping out the expansive realm of colours.where Rvalue and Bvalue are two adjustable constants.Green to red is described by the a* component of the CIE L*a*b* colour space.Images with high a* values are likelier to be pests, whereas those with low a* values are more likely to be crop leaves.The K-means clustering algorithm holds a prominent position in the captivating field of data analysis.It is widely regarded as a distinguished method in unsupervised classification approaches, as evidenced by the comprehensive research conducted by Yao et al. in 2013.The algorithm under consideration exhibits expertise in data segmentation, effectively organizing data into distinct clusters called 'K' through a systematic and precise process.What is its primary directive?To minimize the illusive error function, one must engage in a quest that embodies the principles of precisiondriven analytics.The algorithm in question is widely recognized and appreciated for its extensive range of applications and utility.Nevertheless, more than conformity to established customs would be required in our diligent pursuit of accuracy.We embarked upon a transformative endeavour to achieve proficiency in reliably distinguishing whiteflies within the complex framework of crop leaf photos.The trajectory we pursued involved adopting a refined version of the K-means clustering technique developed and documented by Wang et al. in 2018.The implementation of the improved approach, denoted as approach 1, was a significant milestone in our pursuit of achieving precise rendering at the pixel level.

Pseudocode for Enhanced K-means Clustering Algorithm Algorithm 1: Enhanced K-means Clustering Algorithm Input:
The desired number of output clusters, K; Pixels of whitefly image, xi.Output: Assigned cluster number for each input pattern.
Step 3: Recompute µi based on the mean of the K-clusters.
Step 4: Calculate the Manhattan distance (L) between each cluster, considering the mean of a* component for each cluster.
Step 5: Repeat steps 2-4 until the maximum Manhattan distance (L) is achieved.Within the complex domain of picture segmentation for insect pests, the crucial task of choosing the initial cluster centres arises as a fundamental factor in determining accuracy and achievement.Relying solely on rigid and inflexible classification centres can quickly undermine the algorithm's ability to adapt, making it unsuitable for image segmentation.We pursued novel ideas to overcome this challenging situation, avoiding the potential introduction of randomness associated with K-means clustering.In our endeavour to achieve uniqueness, we endeavoured to find a resolution that surpassed the ordinary.Hence, our expedition culminated with the creating of a self-learning algorithm, an innovative achievement that skillfully and strategically establishes cluster centres.Algorithm 2 manifests this ambitious endeavour as evidence of our unwavering commitment to achieving accuracy in the elusive domain of insect pest picture segmentation.
Step 1: Transform the image to the CIE Lab* color space.Step 2: Descendently sort the a* component, resulting in the sorted sequence P.
Step 3: Select pixels corresponding to the maximum and minimum N values based on P. Count the number (N1) of pixels with the minimum a* component, satisfying Eq. ( 1).Compute the mean of R, G, and B values of these pixels as R1, G1, and B1, respectively.
Step 4: Count the number (N2) of pixels with the maximum a* component not satisfying Eq. ( 1).Calculate the mean of R, G, and B values of these pixels as R2, G2, and B2, respectively.
Step 5: If N1 exceeds ε1, select R1, G1, and B1 as the initial cluster center µ1 for a healthy leaf.
Step 6: If N2 exceeds ε2, designate R2, G2, and B2 as the initial cluster center µ2 for a whitefly-infested leaf.We have proposed a novel adaptive method in our ongoing search for flexibility and accuracy in choosing a central node for a cluster at the outset.With this ground-breaking method, we can extract the locations of these vital cluster centres from the complex mosaic of crop images themselves.But we weren't satisfied with that; we aimed to improve our flexibility and accuracy to unprecedented levels.Enter image block processing, a method for breaking down large amounts of information into more manageable chunks.Think of a raw, unprocessed photograph as a 400x300-pixel canvas, the equivalent of a huge, uncharted region.As seen in Figure 3, we cut this canvas into 12 separate blocks of 100 by 100 pixels each.Our adaptive method, method 2, uses the RGB values as three-dimensional input feature vectors and sets to work inside the constraints of each block.This means that the first clustering centres emerge independently in each block, much like the first sparks of an artist's inspiration.These regional hubs, which function like puzzle parts, are precisely determined.However, our concern for accuracy continues beyond the perimeter of the block.We can make out the whole picture instead of seeing only bits and pieces.The concordant union of each block's cluster centre means bringing the original cluster centres for the complete image to life.

C. Elimination of leaf Vein
Veins are complicated vascular highways that carry nutrients and water across the leaf's lush topography.However, our system may mistake these important structures for whiteflies in its search for precision in leaf image segmentation because of the deceptive shade they cast.To cope with this difficulty, we resort to the sophisticated field of digital morphological features, particularly the characteristics of an ellipse.Just picture a leaf as a blank canvas on which an algorithm could misinterpret the beauty of nature.Mathematical wizardry is used to crack the code.The ellipse's major and minor axes, as well as its charming quirkiness, serve as our three main points of reference.Envision the ellipse embedded entirely within the bounds of the confined space, accurately reflecting its very nature.The major and minor axis lengths are calculated from this embrace, allowing us to evaluate the overall size of this elliptical work of art.A mystical ratio between the ellipse's foci and its major axis length emerges as the answer: eccentricity.Its values are confined to the holy range from 0 to 1, much as the full gamut of human expression.The complete circle, a symbol of oneness, is bestowed upon us by an eccentricity of 0, whereas the exquisite line segment, simplicity itself, is presented to us by an eccentricity of 1.We set out on a quest to determine the true nature of interconnected things, armed with the knowledge that only the eccentric can provide.Those whose eccentricity is larger than 0.98 or whose ratio () is less than 0.2 are suspected of being impostors.The ability to locate veins (a). Figure 2(a) shows the leaf veins as green lines.where 2(b) is the concluding segment.

IV. RESULTS
The segmentation experiments were conducted with great attention to detail using the MATLAB 2019 computational environment.The experiments were performed on a computer equipped with an Intel® Core™ i5-3210 processor running at a clock speed of 2.5 GHz.The computer had 10 GB of Random Access Memory (RAM) and ran on the Windows 7 operating system.The experimenting canvas displayed a variety of whitefly images positioned on the backdrop of three varied crop leaves, specifically corn, tomato and pepper.The photos functioned as a litmus test, evaluating the effectiveness of the proposed segmentation process.The collected photos depicted a visually engaging tapestry, which unveiled the presence of whiteflies and showcased the exquisite array of whitefly eggs at different stages of development.The presence of this mosaic fundamentally increased the level of complexity associated with the segmentation task.By utilising the adaptive learning approach to determine the initial cluster centres, our efforts produced satisfactory outcomes, as demonstrated by the comparison of Figure 5(a, c, e, g, i, k) with Figure 5(b, d, f, h,  j, l).However, it is necessary to recognise the existence of specific areas of misalignment within the segmented outputs.The primary obstacle arises when whiteflies or their eggs reside within the leaf veins, so eluding accurate detection and separation.The Figure 6 shown vividly illustrates the nuanced intricacy, so shedding light on the limitations of our algorithm's effectiveness.
In order to evaluate the precision of the segmentation algorithms, we conducted a thorough assessment by carefully comparing manually segmented images with their autonomously segmented counterparts.This evaluation approach is in line with the methodology proposed by Sezgin and Sankur in 2004.The set of automatic segmentation strategies examined in this study included a fixed threshold method, the well-established Otsu method, the long-standing K-means clustering strategy as described by Wang et al. in their 2018 formulation, and our own original method.The data presented in Table 1 provide evidence supporting the superiority of our strategy compared to the three alternative ways.The project we developed demonstrated a significantly lower average misclassification rate when applied to various crop conditions.The calculated mean error rate, measured at 0.0364, exhibited a notable advantage, demonstrating a 20.6% superiority compared to the fixed threshold approach, a 15.88% advantage over the Otsu method, and a remarkable 16.8% lead over the conventional K-means cluster method Whitefly imagery segmentation on a variety of crop leaves.(a, i) Authentic whitefly photos, taken on maize and tomato leaves, respectively.Whitefly on pepper leaves, original photographs (c, e, g, k). the letters (b, d, f, h, j, and l) The completed segmentation.
The proposed technique demonstrated superiority and improved stability, as indicated by its smaller standard deviation.The aforementioned results clearly demonstrate our approach's remarkable adaptability in insect pest picture segmentation.V. CONCLUSION The current work presents a newly developed cognitive segmentation method designed exclusively for photos of pests.This methodology combines three fundamental tactics, each playing a crucial role in improving the accuracy and stability of segmentation.The trinity of techniques comprises three key components: picture block processing, incorporating adaptive initial cluster centres via self-learning, and a discerning mechanism for removing leaf veins.The segmentation experiment utilized photos depicting whiteflies infesting three types of crop leaves.The empirical evidence strongly supports the efficacy of our recently proposed approach in accurately distinguishing whiteflies from the complex background of crop leaf photos.Compared to previous segmentation algorithms that were tested, our suggested methodology demonstrated superior performance, clearly showing its effectiveness in accurately and robustly segmenting pest images.

FIGURE 3 .
FIGURE 3.Example of the outcome of pre-processing an image.(a) A 400x300px image that has already been processed.100x100 pixel block size (b).
FIGURE 4.The ability to locate veins (a).Figure2(a) shows the leaf veins as green lines.where 2(b) is the concluding segment.
FIGURE 5.Whitefly imagery segmentation on a variety of crop leaves.(a, i) Authentic whitefly photos, taken on maize and tomato leaves, respectively.Whitefly on pepper leaves, original photographs (c, e, g, k). the letters (b, d, f, h, j, and l) The completed segmentation.

TABLE I COMPARISON
OF SEGMENTATION TECHNIQUES' FALSE POSITIVE AND FALSE NEGATIVE RATES.