Forestry pest monitoring system based on image recognition

By extracting pixel grayscale differences at the insect body boundary and detecting the direction of the main vein, combined with confidence scoring and supplementary recognition techniques, the problem of insect edge characteristic differences and occlusion recognition in the pest monitoring system was solved, achieving higher recognition accuracy and continuity.

CN121074807BActive Publication Date: 2026-02-03SHAANXI MEIMEIJIAYUAN AGRI TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511613813.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-06
Publication Date
2026-02-03
Estimated Expiration
2045-11-06

AI Technical Summary

Technical Problem

Existing technologies struggle to adapt to the differences in insect edge characteristics across various image scenarios in pest identification, leading to missing target outlines and positioning errors. In particular, they are insensitive to the occluded area when the leaf vein is obscured, and lack a continuous comparison mechanism, resulting in insufficient consistency and timeliness in identification.

Method used

The grayscale difference and spatial centroid of the insect body boundary pixels are calculated by the patch centroid extraction module. Combined with the leaf vein occlusion marking module, the direction and angle of the main vein are detected to generate a leaf vein occlusion marking image. Then, the pixel gradient change and symmetry are calculated by the confidence score generation module to filter out areas with confidence scores below the threshold for supplementary identification. Finally, the fluctuation detection module compares the confidence score changes frame by frame to draw the dynamic change range.

Benefits of technology

It improves the accuracy of insect location, the ability to respond to occlusion, and the continuity of temporal identification, thereby enhancing the identification stability and coverage integrity of the pest monitoring system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121074807B_ABST
    Figure CN121074807B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of image recognition, in particular to a forestry pest monitoring system based on image recognition, which comprises a patch barycenter extraction module, a vein occlusion marking module, a confidence score generation module, a region supplementary identification module and an identification fluctuation detection module. In the application, stable boundary points are extracted through boundary gray difference, and a spatial barycenter is calculated to generate a pest distribution map. According to the angle between the main vein and the direction of the pest, the occlusion area is determined to improve the occlusion identification accuracy. A multi-factor scoring system is constructed by fusing pixel gradient change, key point hit rate and contour symmetry to enhance the identification stability. The low-confidence area is screened out, and supplementary labeling is carried out in combination with the spatial proximity relationship to improve the coverage integrity. Based on the confidence difference between continuous image frames, the fluctuation area is extracted to realize dynamic tracking, effectively improving the pest positioning accuracy, the occlusion response capability and the time sequence identification continuity.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image recognition, in particular to a forestry pest monitoring system based on image recognition. BACKGROUND

[0002] The field of image recognition technology is an important branch of artificial intelligence, mainly studying how to use computer vision technology to detect, recognize, analyze and understand the target in the image or video, and its core includes image preprocessing, feature extraction, target detection, classification recognition and pattern recognition combined with deep learning algorithm, and is widely used in security monitoring, medical diagnosis, industrial detection, intelligent transportation, agricultural monitoring and other fields. With the development of deep learning, this field is constantly evolving towards high precision, multi-scene and low computing cost. Among them, the traditional forestry pest monitoring system based on image recognition refers to obtaining the image of plant leaves or tree trunks in the forestry environment by using image acquisition equipment, extracting the edge, color, texture and other feature information of the pest in the image, and identifying and classifying the pest species based on support vector machine, convolutional neural network and other training models, so as to realize the detection and marking of the pest species in the forest area. This method usually relies on manual annotation samples to construct a training set, extracts local features of the image through multiple convolution layers, and completes classification and recognition after feature fusion.

[0003] The prior art mainly uses texture and color features as the basis for identification, which is difficult to obtain clear structure expression under the condition of dark boundary and unclear texture of the pest body, and cannot effectively adapt to the difference in edge characteristics of the pest body in different image scenes, resulting in missing and positioning deviation of the recognition target contour. It is not sensitive to the response of the occluded area when the main vein of the leaf is blocked, resulting in the neglect or misidentification of part of the pest area. The image frame sequence recognition process lacks a continuous comparison mechanism and is difficult to form a dynamic response chain, which shows the problem of lag in recognizing the state change of the pest body, limiting the recognition continuity and timeliness in a variable environment. SUMMARY

[0004] The purpose of the present application is to solve the shortcomings in the prior art, and to provide a forestry pest monitoring system based on image recognition.

[0005] In order to achieve the above purpose, the technical scheme adopted by the present application is as follows: the forestry pest monitoring system based on image recognition comprises:

[0006] The patch center extraction module extracts the pest body boundary pixels, calculates the gray difference to verify the stable boundary points, performs spatial weighting to obtain the center coordinates, and connects to form a pest body patch center image;

[0007] The leaf vein occlusion marking module detects the direction of the main vein based on the centroidal image of the insect patch, calculates the direction through texture direction contrast, measures the angle with the patch direction, and marks the occlusion mark when the angle is within a set range, generating a leaf vein occlusion marking image.

[0008] The confidence score generation module detects the insect boundary lines through the leaf vein occlusion marker image, calculates pixel gradient changes, calculates the key point hit rate to obtain the integrity rate, extracts symmetrical points to calculate coordinate differences to obtain symmetry, and integrates the three to generate a recognition confidence score image.

[0009] The region supplementary identification module, based on the identification confidence score image, filters regions with confidence scores below a confidence threshold, calculates the spatial distance to neighboring regions, and marks the supplementary identification range when the distance is below a step size threshold, thereby generating a supplementary insect identification image;

[0010] The fluctuation detection module compares the confidence changes in the supplementary insect identification images frame by frame, calculates the difference between adjacent frames and compares it with the fluctuation threshold. If the difference exceeds the threshold, it draws the change range and generates an identification fluctuation image.

[0011] As a further embodiment of the present invention, the centroid image of the insect patch includes a set of stable boundary points, a weighted centroid coordinate set, and an insect distribution trajectory line; the leaf vein occlusion marking image includes main vein direction information, angle measurement data, and occlusion area marking points; the recognition confidence score image includes boundary continuity index, key point hit ratio, and contour symmetry difference; the supplementary insect recognition image includes low confidence region location, spatial proximity metric value, and supplementary recognition region annotation; and the recognition fluctuation image includes inter-frame confidence change value, fluctuation anomaly recognition region, and dynamic change annotation range.

[0012] As a further aspect of the present invention, the included angle is within a set range, meaning that the included angle between the direction of the worm patch and the direction of the main vein is within a predetermined angle range;

[0013] The confidence threshold refers to the lowest confidence value limit used to judge the recognition result.

[0014] As a further aspect of the present invention, the step size threshold refers to the upper limit of spatial distance used to determine whether adjacent regions have sufficient space distance.

[0015] The fluctuation threshold refers to the difference limit used to identify changes in confidence between frames.

[0016] As a further aspect of the present invention, the patch centroid extraction module includes:

[0017] The boundary pixel detection submodule acquires the edge of the insect region in the monitoring image, detects the coordinates of the boundary pixels of the insect, records the spatial position and gray value of the pixels, establishes a boundary pixel coordinate set, and generates a boundary pixel coordinate matrix.

[0018] The grayscale difference calculation submodule, based on the boundary pixel coordinate matrix, calls the grayscale values ​​of adjacent boundary pixels point by point, compares the grayscale difference with the set grayscale difference threshold, obtains the spatial coordinate set of stable points, and generates a stable boundary point sequence.

[0019] The spatial weighted operation submodule calls the spatial coordinate values ​​according to the stable boundary point sequence, performs weighted operation on the coordinate points according to the weight factor, calculates the centroid position coordinates of each insect, connects the centroid position coordinates of multiple insects and integrates them into a unified set to obtain the centroid image of the insect patch.

[0020] As a further aspect of the present invention, the leaf vein occlusion marking module includes:

[0021] The main vein direction detection submodule detects the main vein direction line in the leaf area based on the centroid image of the insect patch, obtains the set of main vein pixels, calls the pixel texture direction contrast to calculate the direction value of the set point by point, extracts the continuous and consistent direction based on the difference of direction value, and generates the main vein direction parameter sequence.

[0022] The angle measurement and calculation submodule calls the direction vector of the patch in the centroid image of the worm patch according to the main vein direction parameter sequence, calculates the angle between the main vein direction and the patch direction one by one, judges the angle value with the set angle threshold range, filters the patch positions that meet the conditions, and obtains the set of angle measurement values.

[0023] The occlusion mark submodule calls the corresponding spatial coordinates for the set of included angle measurements, marks the area falling within the set angle range, generates an image mark layer based on the marked coordinate points, and superimposes the mark layer on the original insect patch centroid image to obtain the leaf vein occlusion mark image.

[0024] As a further aspect of the present invention, the confidence score generation module includes:

[0025] The boundary line detection submodule detects continuous boundary lines of the insect body region based on the leaf vein occlusion mark image, extracts the boundary pixel sequence, calls the gray values ​​of adjacent pixels, calculates the gradient change between adjacent pixels, sets and filters boundary line segments that meet the conditions, and obtains the boundary gradient change matrix.

[0026] The integrity rate calculation submodule detects the key point positions on the insect body boundary based on the boundary gradient change matrix, counts the number of key points and compares them with the total number of all boundary points, calculates the hit point ratio, and generates an integrity rate value.

[0027] The symmetry fusion submodule calls the integrity rate value, extracts the coordinates of the corresponding symmetry points on the boundary, calculates the coordinate differences between the symmetry points to obtain the symmetry value, and fuses the integrity rate value, the symmetry value, and the statistical values ​​in the boundary gradient change matrix to generate a unified distribution matrix and establish an identification confidence score image.

[0028] As a further aspect of the present invention, the region supplementation identification module includes:

[0029] The confidence filtering submodule extracts the confidence value data of the insect body region based on the recognition confidence score image, calls the set confidence threshold to filter the region confidence value, records the location of the pixel region with confidence value lower than the confidence threshold, and obtains the coordinate set of low confidence region.

[0030] The spatial distance calculation submodule collects two-dimensional spatial distance values ​​between the coordinates of the low confidence region and the edge coordinates of the adjacent insect body region based on the coordinate set of the low confidence region, and performs difference judgment in combination with the set step size threshold, calculates the distance difference ratio of the region to be supplemented, and includes the region with the ratio lower than the unit threshold into the identification candidate range to generate the supplementary identification interval quantity.

[0031] The supplementary region labeling submodule calls the spatial location index that has been determined in the supplementary recognition interval quantity, performs region labeling processing in the image, reconstructs the insect body contour structure according to the candidate interval connectivity, and obtains the supplementary insect body recognition image.

[0032] As a further aspect of the present invention, the fluctuation detection module includes:

[0033] The confidence difference calculation submodule extracts the confidence values ​​of consecutive time frames based on the supplementary insect identification image, calls the confidence values ​​of corresponding positions in adjacent frames for subtraction, forms a difference sequence matrix, and obtains the time-series confidence difference matrix.

[0034] The fluctuation threshold comparison submodule calls the set fluctuation threshold according to the time series confidence difference matrix, compares the difference value with the threshold value item by item, determines the inter-frame pixel position that exceeds the threshold and records the index coordinates, and obtains the fluctuation trigger coordinate set.

[0035] The dynamic range drawing submodule calls the wave trigger coordinate set to mark the boundaries of the dynamic range on the continuous frame images, and draws them in overlapping layers to form a visual marker layer, which is then superimposed on the supplementary insect identification image to generate an identification wave image.

[0036] Compared with the prior art, the advantages and positive effects of the present invention are as follows:

[0037] In this invention, stable boundary points are extracted by boundary grayscale differences and spatial centroids are calculated to generate a distribution map of the insect body. The occlusion area is determined based on the angle between the main vein and the direction of the insect body to improve the accuracy of occlusion recognition. A multi-factor scoring system is constructed by integrating pixel gradient changes, key point hit rate and contour symmetry to enhance recognition stability. Low confidence areas are screened and supplemented with spatial proximity relationships to improve coverage integrity. Fluctuation areas are extracted based on the confidence difference between consecutive image frames to achieve dynamic tracking, effectively improving the accuracy of insect body positioning, occlusion response capability and temporal recognition continuity. Attached Figure Description

[0038] Figure 1 This is a system flowchart of the present invention;

[0039] Figure 2 This is a flowchart of the patch centroid extraction module of the present invention;

[0040] Figure 3 This is a flowchart of the leaf vein occlusion marking module of the present invention;

[0041] Figure 4 This is a flowchart of the confidence score generation module of the present invention;

[0042] Figure 5 Flowchart of the region supplementary identification module of the present invention;

[0043] Figure 6 This is a flowchart of the fluctuation detection module of the present invention. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0045] In the description of this invention, it should be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientation or positional relationships, are based on the orientation or positional relationships shown in the accompanying drawings and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, in the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.

[0046] Please see Figure 1 Image recognition-based forest pest monitoring systems include:

[0047] The plaque centroid extraction module obtains the boundary pixels of the insect in the monitoring image, calculates the gray-scale difference of the boundary point by point and continuously compares them to obtain stable boundary points, performs weighted calculation on the boundary points in spatial position to obtain the centroid coordinates, and then connects all the centroid coordinates to generate the overall distribution set to obtain the centroid image of the insect patch.

[0048] The leaf vein occlusion marking module detects the direction line of the leaf main vein based on the centroid image of the insect patch, calls the pixel texture direction contrast to calculate the direction of the main vein, measures and records the angle between the direction of the main vein and the direction of the insect patch, and marks the occlusion mark in the area when the angle measurement value falls within the set angle range, thus obtaining the leaf vein occlusion marking image.

[0049] The confidence score generation module detects continuous lines of the insect boundary based on the leaf vein occlusion mark image and calculates the pixel gradient change. It counts the number of key points of the insect and compares the hit point ratio to generate the integrity rate value. It extracts the contour symmetry points and calculates the coordinate difference to obtain the symmetry value. It fuses the three types of values ​​to generate the overall distribution and obtains the recognition confidence score image.

[0050] The region supplementary identification module calls the identification confidence score image to filter insect regions with confidence scores lower than the confidence threshold, calculates the spatial distance between adjacent regions, and marks the supplementary identification range in the image when the spatial distance is less than the set step size threshold, thus obtaining the supplementary insect identification image;

[0051] The fluctuation detection module compares the confidence values ​​of consecutive time-series images frame by frame with the supplementary insect identification image, calculates the difference between adjacent frames and compares it with the fluctuation threshold. When the difference exceeds the fluctuation threshold, the dynamic change range is plotted on the image to obtain the fluctuation identification image.

[0052] The centroid image of the insect patch includes a set of stable boundary points, a weighted centroid coordinate set, and the insect distribution trajectory line. The leaf vein occlusion marker image includes the main vein direction information, the included angle measurement data, and the occlusion area marker points. The recognition confidence score image includes the boundary continuity index, the key point hit ratio, and the contour symmetry difference. The supplementary insect recognition image includes the low confidence region location, the spatial proximity metric, and the supplementary recognition region annotation. The recognition fluctuation image includes the inter-frame confidence change value, the fluctuation anomaly recognition region, and the dynamic change annotation range.

[0053] Please see Figure 2 The plaque centroid extraction module includes:

[0054] The boundary pixel detection submodule acquires the edge of the insect region in the monitoring image, detects the coordinates of the boundary pixels of the insect, records the spatial position and gray value of the pixels, establishes a boundary pixel coordinate set, and generates a boundary pixel coordinate matrix.

[0055] First, color image data is extracted from the monitoring images. The images are then converted to grayscale to simplify subsequent processing. During the conversion, the RGB channel values ​​of each pixel are retrieved, and a grayscale value is calculated using a linear weighted average method. This grayscale value is then mapped one-to-one with the spatial coordinates of the pixel. Next, the pixel matrix of the entire image is traversed, and the grayscale values ​​of each pixel and its adjacent pixels (up, down, left, and right) are extracted. The differences between these grayscale values ​​are calculated, and an edge detection threshold is set to determine the location of the insect's edge. This threshold depends on the mean and standard deviation of the overall grayscale variation in the image. For example, if the average of all grayscale differences in the entire image is 18 and the standard deviation is 7, then an edge detection threshold can be set. The edge detection threshold is the average value plus the standard deviation, i.e., a threshold of 25. This means that when the gray-level difference between two adjacent pixels is greater than 25, a boundary is considered to exist. The gray-level difference between the current pixel and its surrounding pixels is checked pixel by pixel to see if it exceeds this set value. If it does, the point is marked as a boundary pixel, and its x-coordinate, y-coordinate, and gray-level value in the image are recorded as an entry. By repeating the above process, the spatial position and gray-level value of all boundary pixels are extracted in sequence to form a boundary pixel coordinate set. This coordinate set is then arranged in order to construct a three-column matrix structure, with each row representing a boundary pixel and its corresponding spatial coordinate and gray-level value in the image, ultimately generating a boundary pixel coordinate matrix.

[0056] The grayscale difference calculation submodule, based on the boundary pixel coordinate matrix, calls the grayscale values ​​of adjacent boundary pixels point by point, compares the grayscale difference with the set grayscale difference threshold, obtains the spatial coordinate set of stable points, and generates a stable boundary point sequence.

[0057] First, the grayscale value of each boundary pixel and its position index in the boundary point sequence are read. Each point is processed sequentially to determine whether the grayscale value difference between the point and its preceding and following boundary points is within a set range. To set this grayscale difference threshold, the standard deviation of the grayscale values ​​of all boundary points must first be obtained and combined with the average fluctuation of the grayscale values ​​of the boundary points. The difference threshold of 5 is set based on the actual observation results that the grayscale difference fluctuation of boundary points in grayscale stable regions of a large number of images is mostly between 3 and 5. Therefore, an upper limit of 5 can be used as the screening threshold. For each boundary point processed, the grayscale difference between the point and the preceding boundary point and the grayscale difference between the point and the following boundary point are calculated respectively. If neither of the two differences is greater than the threshold, the point is judged as a stable boundary point. The spatial coordinates of the point are extracted and added to the stable point set. To maintain the continuity of the judgment, it is also necessary to ensure that two or more consecutive boundary points in the sequence meet the above conditions to form a stable boundary segment. Otherwise, a single isolated point is ignored to avoid misjudgment. After overall traversal and judgment, the spatial coordinates of all points that maintain stable grayscale differences are extracted to form a new sequence and recorded as the stable boundary point sequence.

[0058] The spatial weighted operation submodule calls spatial coordinate values ​​based on the stable boundary point sequence, performs weighted operation on the coordinate points according to the weight factor, calculates the centroid position coordinates of each insect, connects and integrates the centroid position coordinates of multiple insects into a unified set, and obtains the centroid image of the insect patch.

[0059] First, extract the coordinates of all stable boundary points in sequence, and establish two corresponding coordinate vectors to calculate the weighted average values ​​for the horizontal and vertical directions, respectively. For weighting, a weight value needs to be assigned to each stable point. This weight is based on the ratio of the gray value to the standard deviation of the gray value distribution of all stable points in the image. After statistically analyzing the gray values ​​of all stable boundary points, calculate their standard deviation as the denominator, and use the gray value of each point as the numerator to form the weight value for that point. If the average gray value of the stable boundary points in the image is 76 and the standard deviation is 6.2, then the weight of a point with a gray value of 80 is 80 divided by 6.2, approximately equal to 12.9. A larger weight value indicates that the gray value of that point is relatively high among the stable boundary points. The greater the advantage, the stronger the influence on the center of gravity position. In the process of calculating the center of gravity coordinates, the x-coordinate of each point is multiplied by its weight and accumulated to obtain the sum of the horizontal weighted values. The y-coordinate is processed in the same way. These two values ​​are divided by the sum of all weight values ​​to obtain the horizontal and vertical center of gravity coordinate values. This operation needs to be performed separately on each independent region of the insect. Therefore, region segmentation processing needs to be completed in the insect boundary extraction stage to ensure that the stable boundary points of different insects are not mixed. After the center of gravity positions of all insects are calculated, they are summarized into a set of insect center of gravity coordinates and mapped back to the original image space to form the center of gravity image of the insect patch.

[0060] Please see Figure 3 The leaf vein occlusion marking module includes:

[0061] The main vein direction detection submodule detects the main vein direction line within the leaf area based on the centroid image of the insect patch, obtains the set of main vein pixels, calculates the direction value of each point of the set by calling the pixel texture direction contrast, extracts the continuous and consistent direction based on the difference of direction value, and generates the main vein direction parameter sequence.

[0062] First, the grayscale or channel data of the insect's plaque centroid image is retrieved to locate the leaf region. This location is then used as the center of an extended region to extract the leaf. Combining the color and shape features within this region, the distribution characteristics of the green channel are used to extract continuously distributed high grayscale areas. It is then determined whether the continuous pixels exhibit significant linear extension characteristics in the vertical or horizontal directions. To extract the pixel set in the main vein, a pixel intensity threshold is set. This threshold is determined based on the overall distribution of green channel grayscale values ​​within the leaf region. Typically, the mean and standard deviation of the pixels in this region are used as the calculation benchmark. If the mean is 100 and the standard deviation is 12, then the main vein image... The pixel intensity threshold is set to 112. Pixels with consecutive values ​​greater than this value are selected to form the main vein candidate region. Then, the direction is calculated point by point in this region. For each pixel, a 3×3 pixel window of its neighborhood is extracted with itself as the center. The gray level difference between the center point and the surrounding points is compared. The direction with the largest gray level change is determined as the texture direction value of the current pixel. All direction values ​​are combined into a direction value matrix according to their coordinate position and calculation order. Then, points with consecutive changes in direction value and a direction difference of less than 15 degrees are extracted from this matrix. It is further determined whether these consecutive segments exceed the preset minimum length, such as 20 consecutive pixels. Those that meet the minimum length are considered as valid main vein segments, and the direction data of each point are combined into a complete main vein direction parameter sequence.

[0063] The angle measurement and calculation submodule calls the direction vector of the patch in the centroid image of the worm patch according to the main vein direction parameter sequence, calculates the angle between the main vein direction and the patch direction one by one, judges the angle value with the set angle threshold range, filters the patch positions that meet the conditions, and obtains the set of angle measurement values.

[0064] First, the main vein direction information is extracted from the sequence. When calculating the direction, any two non-coincident direction points are taken to form a vector. Then, the origin of the vector is unified for subsequent angle calculation. In the centroid image of the worm patch, the center coordinates and distribution direction of each worm patch are obtained. Usually, the direction of the worm patch can be determined by the extension trend of the centroid point set in space. The major axis direction of the smallest bounding rectangle formed by the stable boundary points around the centroid is taken as the worm direction vector. Then, the main vein direction vector and the worm direction vector are compared and contrasted. The angle between the vectors is calculated to obtain the angle value, and all angle values ​​are recorded in a set. To determine which patches might have occlusion relationships, a threshold range for angle determination is set. This range is determined based on experience with the distribution of the occlusion angle between the worm and the main vein, typically between 20 and 70 degrees. This setting is derived from statistical analysis of actual images, which shows that worms within this angle range tend to have a spatial distribution relationship with the main vein that is offset and overlapped. All angles in the angle set are judged sequentially. If a certain angle value is within this range, it is judged as a worm patch that meets the conditions. The center coordinates of the corresponding worm patch are extracted and recorded. Finally, the positions of worm patches that meet the angle conditions are selected to form a set of angle measurement values.

[0065] The occlusion mark submodule calls the corresponding spatial coordinates for the set of included angle measurements, marks the area falling within the set angle range, generates an image mark layer based on the marked coordinate points, and superimposes the mark layer on the original insect patch centroid image to obtain the leaf vein occlusion mark image;

[0066] First, the center coordinates of each worm patch in the set are read one by one. These coordinates are then used to determine the actual pixel position in the image. Next, a marked region is generated for each coordinate point. The marked region is a circular area with a fixed radius centered on the coordinate point. The radius is set with reference to the average size of the worm's boundary dimensions, typically 50% of the diagonal length of the worm's smallest bounding rectangle. For example, if the diagonal of a worm patch's bounding box is 40 pixels, the radius of the marked region is set to 20 pixels. All pixel coordinates within this range are extracted as candidate marked points. Finally, an angle determination condition is added to each point, based on the previous angle. The angle value should fluctuate within a range of ±5 degrees. For example, if the angle threshold range is set to 20 degrees to 70 degrees, then only the markers with an angle between 15 degrees and 75 degrees are retained in the marking area, and the pixels in the remaining areas are excluded from the marker set, thus forming a set of valid markers. All valid markers are mapped onto a new layer to form an image marker layer. In this layer, all valid points are assigned a specified marker color, such as white or red, while other areas remain transparent. Then, this marker layer is superimposed on the centroid image of the insect patch at the pixel level, so that the corresponding pixel values ​​in the marker layer are superimposed on the corresponding positions in the original image, and finally, the leaf vein occlusion marker image is obtained.

[0067] Please see Figure 4 The confidence score generation module includes:

[0068] The boundary line detection submodule detects continuous boundary lines of the insect body region based on the leaf vein occlusion marker image, extracts the boundary pixel sequence, calls the gray values ​​of adjacent pixels, calculates the gradient change between adjacent pixels, sets and filters boundary line segments that meet the conditions, and obtains the boundary gradient change matrix.

[0069] First, the image of the leaf vein occlusion marker is preprocessed by reading its pixel matrix data and converting it to grayscale to facilitate subsequent boundary pixel extraction within a unified grayscale space. Then, based on the overlap between the occluded marker layer and the insect body region, the boundary contour information within that region is extracted. Boundary locations are identified through pixel value differences. Specifically, the grayscale values ​​of each pixel in the image are compared with the grayscale values ​​of its four adjacent pixels (upper, lower, left, and right) to determine if there are any abrupt changes. If the grayscale difference exceeds a set threshold, the point is considered a boundary point. The grayscale difference threshold is set based on the standard deviation of the entire image's grayscale values. For example, if the image standard deviation is 18, the threshold can be set to 80% of the standard deviation, i.e., 14.4, rounded to the nearest whole number. 15. Scan each pixel point by point and determine whether it meets the grayscale change condition. If it does, add it to the boundary pixel sequence. Then, extract adjacent boundary pixel pairs from the sequence and calculate the grayscale value change for each pair of pixels to form gradient change data. Record the gradient change value as the current pixel gradient change. Repeat this operation for all boundary pixels to build a complete gradient change matrix. Each record in the matrix corresponds to a pair of adjacent boundary pixels and their gradient values. Then set the boundary line segment filtering conditions. Usually, the region with stable continuous gradient change direction and change amount between 10 and 30 is set as the effective range of boundary line segments. Filter out continuous boundary line segments that meet the conditions. Finally, organize the filtering results into a boundary gradient change matrix.

[0070] The integrity rate calculation submodule detects the location of key points on the insect boundary based on the boundary gradient change matrix, counts the number of key points and compares it with the total number of all boundary points, calculates the hit point ratio, and generates the integrity rate value.

[0071] First, extract the coordinates and corresponding gradient values ​​of all identified boundary pixels. Within this data, locate key points on the worm's boundary by identifying regions with significant gradient changes or stable gradient values. These key points are typically located at points of curvature or orientation abrupt changes. During the identification process, a key point identification standard is set, which is determined jointly by the gradient abrupt change magnitude and the angle change of adjacent points. For example, if the gradient abrupt change is greater than 20, and the angle between this point and the preceding and following pixel segments exceeds 15 degrees, then this point is marked as a key point. Each time a boundary segment is detected, check the pixel sequence sequentially to see if it meets the key point determination criteria. Record all points that meet the criteria as key points. Then, count the number of all key points, denoted as N1, and simultaneously count the number of all boundary pixels on the entire boundary line, denoted as N2. Finally, compare and calculate the hit rate, i.e., the completeness rate. N1 / N2 represents the proportion of key points among boundary pixels. For example, if the total number of boundary pixels is 240 and the number of key points is 60, the integrity rate is 0.25. This value is recorded as the integrity rate of the current insect outline.

[0072] The symmetry fusion submodule calls the integrity rate value and extracts the coordinates of the corresponding symmetry points on the boundary. It calculates the coordinate difference between the symmetry points to obtain the symmetry value. The integrity rate value, the symmetry value, and the statistical values ​​in the boundary gradient change matrix are fused to generate a unified distribution matrix and establish a recognition confidence score image.

[0073] Simultaneously, the coordinates of the corresponding symmetrical points on the boundary are extracted. In the specific operation, a symmetrical mapping baseline is first established along the main axis of the set of pixels on the worm boundary. This baseline is taken from the major axis of the smallest bounding rectangle of the worm patch. Spatial coordinate mapping is performed on the symmetrical points of each boundary point on this baseline. The spatial coordinate difference between the original point and the mapped point is extracted. The distance difference between the two points on the x-axis and y-axis is calculated respectively, and the average value of all differences is used as the symmetry difference index. The symmetry judgment standard is set as a good symmetry when the average coordinate difference is less than 5 pixels. This setting refers to the overall length of the worm boundary and the image resolution. For example, if the average major axis length of the worm boundary is 120 pixels, then a difference of 5 pixels is a spatial deviation of 4.2%, which can be regarded as good symmetry. Finally, the integrity rate value, the symmetry difference value, and the average gradient value in the boundary gradient change matrix are extracted as fusion parameters. After the three parameters are uniformly normalized, a unified distribution matrix is ​​constructed. Each worm corresponds to a three-parameter vector. The unified distribution matrix is ​​used to generate an image through pixel position mapping, where each pixel value corresponds to the recognition confidence score of the point. Finally, a recognition confidence score image is established.

[0074] Please see Figure 5 The area supplementary identification module includes:

[0075] The confidence filtering submodule extracts the confidence value data of the insect body region based on the confidence score image, calls the set confidence threshold to filter the region confidence value, records the location of the pixel region with confidence value lower than the confidence threshold, and obtains the coordinate set of low confidence region.

[0076] First, confidence score data for all pixels is loaded from the image to be identified, and a two-dimensional confidence matrix of the same size as the original image is constructed. Then, the mask of the identified worm regions in the image is used to filter out all pixels corresponding to the worm regions, and their corresponding confidence values ​​are extracted to establish a set of worm region confidence values. Next, confidence value comparison processing is performed pixel by pixel within this set. To ensure the rationality of the selection, a confidence threshold needs to be set. This threshold should be set with reference to the statistical results of the overall confidence level within the worm region. Specifically, the confidence values ​​of all worm regions are calculated. The mean and standard deviation are used to determine which pixels belong to the low confidence range. Assuming the mean confidence value of the insect body region is 0.68 and the standard deviation is 0.10, the confidence threshold can be set to the mean value minus 0.8 times the standard deviation, i.e., the confidence threshold is 0.60. This value is used to determine which pixels belong to the low confidence range. Then, all pixels in the insect body region are traversed, and the positions of pixels with confidence values ​​less than 0.60 are recorded. Their coordinates in the image are extracted to form a low confidence region coordinate set. This coordinate set stores the positions of all insect pixels with insufficient confidence for subsequent supplementary identification processing, and finally, the low confidence region coordinate set is obtained.

[0077] The spatial distance calculation submodule collects two-dimensional spatial distance values ​​between the coordinates of the low-confidence region and the edge coordinates of the adjacent insect body region based on the low-confidence region coordinate set, and performs difference judgment by combining the set step size threshold, using the formula:

[0078] ;

[0079] The distance difference ratio of the region to be supplemented is calculated, and regions with a ratio lower than the unit threshold are included in the candidate recognition range to generate supplementary recognition intervals.

[0080] in, Indicates the first The low-confidence region and the first The distance ratio of each neighboring region; This indicates the spatial distance between the center points of two regions; This represents the mean distance between all regions in the current image; This represents the variance of the distances between all regions. Indicates the first Confidence value of each pixel; This represents the mean of all pixel confidence values; This is the image edge confidence value fluctuation adjustment coefficient, used to balance the unit consistency between the distance variance term and the pixel confidence fluctuation term (it is an adjustment constant term with units).

[0081] The spatial distance calculation submodule collects two-dimensional spatial distance values ​​between the low-confidence region coordinate set and the edge coordinates of neighboring worm regions, and performs difference judgment based on a set step size threshold. During execution, it calculates and judges the spatial distribution of the low-confidence region and the worm region. To reasonably assess the spatial correlation between the two, the following normalized distance difference ratio calculation formula is introduced:

[0082] ;

[0083] First, the difference between the distance and the mean is calculated in the numerator, and its absolute value is taken to represent the degree of local deviation. In the denominator, the distance variance and the confidence fluctuation term are added together, and then a square root operation is performed to represent the spatial-confidence composite dispersion level. This normalized ratio can be used to assess whether a low-confidence region is consistent with the spatial structure and confidence distribution of a normal worm region.

[0084] Actual parameter calculation process and assignment instructions:

[0085] To ensure the reasonableness of the numerical sources of the parameters in the formula, the following provides the parameter sampling values ​​and their sources from typical image sequences:

[0086] Extraction of the coordinates of the center point of the insect body region:

[0087] Area A Center: ;

[0088] Area B Center: ;

[0089] C Region Center: ;

[0090] Current low confidence region coordinates: ;

[0091] Calculation:

[0092] Distance of the low-confidence region from A:

[0093] ;

[0094] Calculation (for all combinations between regions A, B, and C):

[0095] AB: ;

[0096] AC: ;

[0097] BC: ;

[0098] average value: ;

[0099] Calculation:

[0100] ;

[0101] Confidence value set (Confidence level of sampling from a region of an insect body):

[0102] Its mean is ;

[0103] Sum of squared deviations:

[0104] ;

[0105] The settings are based on a survey of image structure complexity, and are selected accordingly. (Unit: pixels²), ensure the unit is consistent with the variance term and the magnitude is reasonable (refer to the experience that the standard deviation of image edge perturbation is in the range of 5~10 pixels, and multiply by when the fluctuation term is less than 0.01). (This has a perceptible impact on the outcome).

[0106] Table 1 Parameter Calculation and Value Table

[0107] ;

[0108] As shown in Table 1.

[0109] Final calculation and analysis explanation:

[0110] ;

[0111] The results indicate that the current low-confidence region and the adjacent worm region have a high degree of consistency in terms of spatial distribution and confidence fluctuation, with a normalized difference ratio of 1.396. If the candidate judgment threshold set by the system is 1.5 (the critical discrimination value for 95% overlapping worm structures is determined by referring to historical experience data), then the low-confidence region should be included in the supplementary identification candidate interval for subsequent contour structure reconstruction processing.

[0112] The advantage of the formula lies in its ability to jointly introduce the discreteness of spatial distribution. With confidence fluctuation discreteness Construct a composite normalization standard and use an adjustment coefficient By unifying the two types of indicator dimensions, standardized fusion judgment is achieved under the condition of multi-source data (spatial + semantic), making the screening results of low-confidence regions more robust and effectively improving the rationality and accuracy of candidate intervals in the supplementary identification step.

[0113] The supplementary region labeling submodule calls the spatial location index that has been determined in the supplementary recognition interval quantity, performs region labeling processing in the image, reconstructs the insect body contour structure according to the candidate interval connectivity, and obtains the supplementary insect body recognition image;

[0114] The original insect identification result layer is loaded into the image, and a point-by-point labeling operation is performed based on the pixel coordinates in the supplementary interval. First, a label is created for each pixel in the supplementary interval, and a four-neighbor check is performed with the pixel as the center to determine whether it is connected to adjacent supplementary pixels. If adjacent pixels already exist in the label set, they are classified into the same region. The connectivity determination of all supplementary pixels is completed recursively. Then, a closed boundary is constructed based on the boundary information of each connected region, the outer contour of the region is reconstructed, and the contour is spatially merged with the original insect identification result. Image overlay update is performed to structurally integrate the supplementary region with the original region to form a new complete insect structure. At the same time, a new image layer is generated to represent the latest insect identification result image, and finally, the supplementary insect identification image is obtained.

[0115] Please see Figure 6 The fluctuation detection module includes:

[0116] The confidence difference calculation submodule extracts the confidence scores of consecutive time frames from the supplementary insect identification image frame by frame, calls the confidence scores of corresponding positions in adjacent frames for subtraction, forms a difference sequence matrix, and obtains the time-series confidence difference matrix.

[0117] First, the sequence of insect identification images arranged chronologically is traversed frame-by-frame. In each frame, the confidence score of all pixels is extracted, constructing a three-dimensional dataset with the frame number as the time axis. The confidence score matrix of each frame is then superimposed on the time series as a two-dimensional plane, resulting in a complete confidence-time stack data structure. Next, starting from the second frame, frame-by-frame calculations are performed. The confidence value of the corresponding pixel in the current frame is subtracted from the confidence value of the pixel at the same position in the previous frame, yielding an inter-frame confidence difference matrix. This difference reflects the confidence fluctuation at the same spatial location across consecutive time frames; a positive difference indicates... An increase in confidence indicates a decrease in confidence, while a negative difference indicates a decrease in confidence. This calculation is performed on each pair of adjacent frames, forming a series of inter-frame difference matrices. By performing this operation on all consecutive frames in the entire time series, a set of three-dimensional difference sequence matrices is finally constructed, where each element records the difference in confidence score of the corresponding pixel between two time points. For example, if the confidence value of a certain insect region at coordinates (145, 88) decreases from 0.71 to 0.62 between frame 5 and frame 6, then its difference is -0.09. This type of calculation is performed on all frames and all pixels, ultimately generating a temporal confidence difference matrix.

[0118] The fluctuation threshold comparison submodule calls the set fluctuation threshold based on the temporal confidence difference matrix, compares the difference value with the threshold value item by item, determines the inter-frame pixel position that exceeds the threshold and records the index coordinates, and obtains the fluctuation trigger coordinate set.

[0119] The algorithm scans each pixel point by point according to the inter-frame difference matrix, extracting the difference value of each pixel. After absolute value conversion, the difference is compared with a set fluctuation threshold. The fluctuation threshold is determined based on the global confidence score trend and normal inter-frame fluctuations. A common approach is to first calculate the mean and standard deviation of the differences in non-edge regions across all inter-frame difference matrices. For example, analysis might reveal that the inter-frame confidence value fluctuation in most normal regions is ±0.03 with a standard deviation of 0.015. To avoid misjudgments due to normal fluctuations, the fluctuation threshold can be set to the mean plus twice the standard deviation, i.e., the fluctuation threshold is... To ensure versatility, this threshold can also be set to a dynamic value within a fixed range. In some videos where insect identification is unstable, the fluctuation threshold can be manually set between 0.05 and 0.08, and flexibly adjusted according to the target scene. After the threshold is set, all pixels in each difference matrix are traversed, and the confidence difference of each point is compared with the threshold. When the difference of a point exceeds the threshold, it is considered that its confidence fluctuation is abnormal. The frame number and spatial coordinate position of the pixel are recorded to construct a fluctuation marker data record. This operation is performed frame by frame, and the fluctuation trigger points of all frames are superimposed and sorted to finally form a complete fluctuation trigger coordinate set.

[0120] The dynamic range drawing submodule calls the wave-triggered coordinate set to mark the boundaries of the dynamic range on the continuous frame images, and draws them in overlapping layers to form a visual marker layer, which is then superimposed on the supplementary insect identification image to generate an identification wave image.

[0121] First, the corresponding wave trigger pixel position is loaded into each frame image, and all trigger points in that frame are spatially clustered. For each group of adjacent trigger points, a connected region is constructed using the four-neighbor determination method. Then, a minimum bounding rectangle is generated based on each connected region as the initial boundary of the dynamic change range. Next, a certain pixel margin is extended to this rectangular region to form a buffer zone to avoid missing the disturbance area near the boundary. The margin size is set according to the image resolution and the size of the insect, usually 10% of the minimum bounding size of the insect. For example, if the minimum side length of the insect is 60 pixels, then the margin is 6 pixels. After the extension is completed, multiple dynamic change boundary regions will be formed in each frame image. Then, a marker layer is superimposed on each frame image, and the above boundary regions are drawn in the layer with a preset color, such as using a red border or semi-transparent red fill to represent the wave region. Finally, the layer is combined and superimposed with the supplementary insect recognition image through image channel synthesis, so that the boundary of the wave region is displayed intuitively in the form of an image, and finally, a wave recognition image is generated.

[0122] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

Claims

1. A forest pest monitoring system based on image recognition, characterized in that, The system includes: The plaque centroid extraction module extracts the boundary pixels of the insect body, calculates gray-level differences to verify stable boundary points, performs spatial weighting to obtain the centroid coordinates, and connects them to form the centroid image of the insect body plaque. The leaf vein occlusion marking module detects the direction of the main vein based on the centroidal image of the insect patch, calculates the direction through texture direction contrast, measures the angle with the patch direction, and marks the occlusion mark when the angle is within a set range, generating a leaf vein occlusion marking image. The confidence score generation module detects the insect boundary lines through the leaf vein occlusion marker image, calculates pixel gradient changes, calculates the key point hit rate to obtain the integrity rate, extracts symmetrical points to calculate coordinate differences to obtain symmetry, and integrates the three to generate a recognition confidence score image. The region supplementary identification module, based on the identification confidence score image, filters regions with confidence scores below a confidence threshold, calculates the spatial distance to neighboring regions, and marks the supplementary identification range when the distance is below a step size threshold, thereby generating a supplementary insect identification image; The fluctuation detection module compares the confidence changes in the supplementary insect identification images frame by frame, calculates the difference between adjacent frames and compares it with the fluctuation threshold. If the difference exceeds the threshold, it draws the change range and generates an identification fluctuation image.

2. The forest pest monitoring system based on image recognition according to claim 1, characterized in that, The centroid image of the insect patch includes a set of stable boundary points, a weighted centroid coordinate set, and the insect distribution trajectory line. The leaf vein occlusion marking image includes the main vein direction information, angle measurement data, and occlusion area marking points. The recognition confidence score image includes boundary continuity index, key point hit ratio, and contour symmetry difference. The supplementary insect recognition image includes the low confidence region location, spatial proximity metric, and supplementary recognition region annotation. The recognition fluctuation image includes inter-frame confidence change value, fluctuation anomaly recognition region, and dynamic change annotation range.

3. The forest pest monitoring system based on image recognition according to claim 1, characterized in that, The included angle is within a set range, meaning that the included angle between the direction of the worm patch and the direction of the main vein is within a predetermined angle range; The confidence threshold refers to the lowest confidence value limit used to judge the recognition result.

4. The forest pest monitoring system based on image recognition according to claim 1, characterized in that, The step size threshold refers to the upper limit of spatial distance used to determine whether adjacent areas have sufficient space. The fluctuation threshold refers to the difference limit used to identify changes in confidence between frames.

5. The forest pest monitoring system based on image recognition according to claim 1, characterized in that, The plaque centroid extraction module includes: The boundary pixel detection submodule acquires the edge of the insect region in the monitoring image, detects the coordinates of the boundary pixels of the insect, records the spatial position and gray value of the pixels, establishes a boundary pixel coordinate set, and generates a boundary pixel coordinate matrix. The grayscale difference calculation submodule, based on the boundary pixel coordinate matrix, calls the grayscale values ​​of adjacent boundary pixels point by point, compares the grayscale difference with the set grayscale difference threshold, obtains the spatial coordinate set of stable points, and generates a stable boundary point sequence. The spatial weighted operation submodule calls the spatial coordinate values ​​according to the stable boundary point sequence, performs weighted operation on the coordinate points according to the weight factor, calculates the centroid position coordinates of each insect, connects the centroid position coordinates of multiple insects and integrates them into a unified set to obtain the centroid image of the insect patch.

6. The forest pest monitoring system based on image recognition according to claim 5, characterized in that, The leaf vein occlusion marking module includes: The main vein direction detection submodule detects the main vein direction line in the leaf area based on the centroid image of the insect patch, obtains the set of main vein pixels, calls the pixel texture direction contrast to calculate the direction value of the set point by point, extracts the continuous and consistent direction based on the difference of direction value, and generates the main vein direction parameter sequence. The angle measurement and calculation submodule calls the direction vector of the patch in the centroid image of the worm patch according to the main vein direction parameter sequence, calculates the angle between the main vein direction and the patch direction one by one, judges the angle value with the set angle threshold range, filters the patch positions that meet the conditions, and obtains the set of angle measurement values. The occlusion mark submodule calls the corresponding spatial coordinates for the set of included angle measurements, marks the area falling within the set angle range, generates an image mark layer based on the marked coordinate points, and superimposes the mark layer on the original insect patch centroid image to obtain the leaf vein occlusion mark image.

7. The forest pest monitoring system based on image recognition according to claim 6, characterized in that, The confidence score generation module includes: The boundary line detection submodule detects continuous boundary lines of the insect body region based on the leaf vein occlusion mark image, extracts the boundary pixel sequence, calls the gray values ​​of adjacent pixels, calculates the gradient change between adjacent pixels, sets and filters boundary line segments that meet the conditions, and obtains the boundary gradient change matrix. The integrity rate calculation submodule detects the key point positions on the insect body boundary based on the boundary gradient change matrix, counts the number of key points and compares them with the total number of all boundary points, calculates the hit point ratio, and generates an integrity rate value. The symmetry fusion submodule calls the integrity rate value, extracts the coordinates of the corresponding symmetry points on the boundary, calculates the coordinate differences between the symmetry points to obtain the symmetry value, and fuses the integrity rate value, the symmetry value, and the statistical values ​​in the boundary gradient change matrix to generate a unified distribution matrix and establish an identification confidence score image.

8. The forest pest monitoring system based on image recognition according to claim 7, characterized in that, The region supplementary identification module includes: The confidence filtering submodule extracts the confidence value data of the insect body region based on the recognition confidence score image, calls the set confidence threshold to filter the region confidence value, records the location of the pixel region with confidence value lower than the confidence threshold, and obtains the coordinate set of low confidence region. The spatial distance calculation submodule collects two-dimensional spatial distance values ​​between the coordinates of the low confidence region and the edge coordinates of the adjacent insect body region based on the coordinate set of the low confidence region, and performs difference judgment in combination with the set step size threshold, calculates the distance difference ratio of the region to be supplemented, and includes the region with the ratio lower than the unit threshold into the identification candidate range to generate the supplementary identification interval quantity. The supplementary region labeling submodule calls the spatial location index that has been determined in the supplementary recognition interval quantity, performs region labeling processing in the image, reconstructs the insect body contour structure according to the candidate interval connectivity, and obtains the supplementary insect body recognition image.

9. The forest pest monitoring system based on image recognition according to claim 8, characterized in that, The fluctuation detection module includes: The confidence difference calculation submodule extracts the confidence scores of consecutive time frames based on the supplementary insect identification image, and performs subtraction on the confidence scores of corresponding positions in adjacent frames to obtain the time-series confidence difference matrix. The fluctuation threshold comparison submodule calls the set fluctuation threshold according to the time series confidence difference matrix, compares the difference value with the threshold value item by item, determines the inter-frame pixel position that exceeds the threshold and records the index coordinates, and obtains the fluctuation trigger coordinate set. The dynamic range drawing submodule calls the wave trigger coordinate set to mark the boundaries of the dynamically changing range on the continuous frame images, and draws them in overlapping layers to form a visual marker layer, generating a wave recognition image.

Citation Information

Patent Citations

  • Agricultural pest image intelligent identification method based on neural network

    CN114782682A

  • Forestry disease and pest intelligent identification method and system based on image understanding

    CN115376032A