Fruit tree pest detection method and system based on machine vision

By analyzing metabolomic differences and extracting topological skeleton features, combined with mutual information value screening and community clustering, a multi-dimensional fusion feature system is constructed, which solves the problems of accuracy and efficiency in the detection of fruit tree diseases and pests in existing technologies, and achieves efficient identification of diseases and pests.

CN121811243APending Publication Date: 2026-04-07CHENGDE ACAD OF AGRI & FORESTRY
View PDF 0 Cites 1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-24
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing machine vision-based fruit tree pest and disease detection technologies suffer from limitations such as single feature extraction dimensions, weak anti-interference capabilities, prominent feature redundancy issues, and low recognition accuracy, making it difficult to meet the precise and efficient requirements of actual field detection.

Method used

A metabolomic differential analysis algorithm combined with a morphological representation mechanism was used to extract topological skeleton features. Strongly correlated features were screened by mutual information values, and community clustering and feature optimization were performed to construct a multi-dimensional fusion feature system. This system was then combined with a pest and disease feature database for identification and matching.

Benefits of technology

It enables accurate identification of fruit tree diseases and pests, reduces computational load, adapts to the computing power requirements of real-time field monitoring, and improves identification accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121811243A_ABST
    Figure CN121811243A_ABST
Patent Text Reader

Abstract

The invention relates to the field of fruit tree disease and insect pest detection, in particular to a fruit tree disease and insect pest detection method and system based on machine vision, and the method comprises the steps: obtaining an image metabolome feature matrix and a preliminary difference pixel based on a preprocessed multispectral image of an original machine vision image obtained by a camera, carrying out the topological skeleton extraction, and carrying out the dimension fusion; outputting a core focus feature set; each discrete feature is used as a network node, a mutual information value between any two discrete features is calculated, and a focus area is obtained; and based on a lesion region containing lesion boundary coordinates, area and morphological parameters, extracting the ROI of the lesion region from the multispectral image, and carrying out disease and pest identification matching to obtain a detection result. According to the method, the essential attributes of the lesion are comprehensively captured by fusing the multi-dimensional features of the spectrum, the texture, the space coordinates and the morphological topology, a multi-dimensional fusion feature system is formed, and the problems that similar pest and disease damage forms are difficult to distinguish, and early lesion features are weak and difficult to recognize are effectively solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fruit tree disease and pest detection, and specifically to a method and system for fruit tree disease and pest detection based on machine vision. Background Technology

[0002] Fruit tree diseases and pests are key factors affecting fruit yield and quality, and timely and accurate detection is the core prerequisite for prevention and control. Traditional detection methods mainly rely on manual inspections, which depend on the experience and judgment of staff. This is not only time-consuming and labor-intensive with limited coverage, but also suffers from strong subjectivity and a high rate of missed detections and misjudgments, especially when diseases and pests are in the early stages or when lesions are hidden.

[0003] With the application of machine vision technology in agriculture, some automated detection solutions have emerged, but they still have obvious limitations: the feature extraction dimension is singular, focusing on spectral grayscale or simple texture features, ignoring key information such as lesion morphology and topology, resulting in insufficient ability to distinguish between morphologically similar pests and diseases; and the anti-interference ability is weak, and factors such as field light fluctuations, shooting angle deviations, and image noise can easily affect feature stability, thereby reducing the accuracy of lesion localization.

[0004] Furthermore, the existing solution suffers from significant feature redundancy, failing to effectively filter and optimize extracted features. This increases computational load and may introduce invalid features that interfere with identification results. Additionally, the matching and identification methods are simplistic, relying heavily on a single difference metric, which fails to comprehensively characterize the differences between lesions and standard samples, resulting in limited accuracy and a lack of ability to identify new types of pests and diseases. These issues make the current solution inadequate for meeting the precise and efficient requirements of actual field testing. Summary of the Invention

[0005] This invention addresses the technical problems existing in the prior art by providing a method and system for detecting fruit tree diseases and pests based on machine vision.

[0006] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: A method for detecting fruit tree diseases and pests based on machine vision, comprising the following steps: Step 1: Based on the original machine vision image acquired by the camera, a preprocessed multispectral image is obtained and converted into an image metabolomics data format through a metabolomics difference analysis algorithm to obtain an image metabolomics feature matrix and preliminary difference pixels. The morphological representation mechanism embedded in the metabolomics difference analysis algorithm extracts the topological skeleton of the preliminary difference region obtained from the preliminary difference pixels. The topological skeleton feature set is obtained as a new morphological feature dimension and is dimensionally fused with the image metabolomics feature matrix to generate an enhanced feature matrix. The enhanced feature matrix and the multispectral image are purified by fusing a noise adaptation strategy through the metabolomics difference analysis algorithm to output a core lesion feature set. Step 2: Transform the features in the core lesion feature set into discrete features. Using each discrete feature as a network node, calculate the mutual information value between any two discrete features. Use the mutual information value as matrix elements to construct a two-dimensional correlation matrix and a feature correlation network. Perform community clustering on the feature correlation network. Output the optimized feature core set through validity verification. Add a multispectral image as the dual input of the localization link to obtain the lesion region containing lesion boundary coordinates, area, and morphological parameters. Step 3: Based on the lesion region containing the boundary coordinates, area, and morphological parameters of the lesion, extract the ROI of the lesion region from the multispectral image and form a fused lesion feature set. Use the standard pest and disease feature library as a reference to obtain the difference value of the fused lesion feature set. Use the fusion difference matrix obtained by fusion difference degree and the fused lesion feature set for decision-aid verification and pest and disease identification matching to obtain the detection results.

[0007] In a preferred embodiment, the original machine vision image acquired by the camera in step one includes an RGB image and a near-infrared multispectral image. The acquired original machine vision image is radiometrically corrected to eliminate the influence of light intensity fluctuations on grayscale values, and geometric correction is used to correct lens distortion and shooting angle deviation during the image acquisition process to obtain a corrected multispectral image. The metabolomic differential analysis algorithm uses each pixel in a multispectral image as the basic unit. The first dimension is the grayscale value of each spectral band within a single pixel. The second dimension is the texture feature value of a single pixel calculated using the gray-level co-occurrence matrix. The third dimension is the spatial coordinate feature of a single pixel's horizontal and vertical coordinates relative to the image center. This constructs a three-dimensional feature vector for each pixel. The three-dimensional feature vectors of all pixels are combined to form an initial feature matrix. The initial feature matrix is ​​then used to measure similarity using a kernel function that is a power of the square of the second norm of the difference between the multispectral feature matrices of two pixels, which is a negative dynamic coefficient of the natural constant e. Pixels with feature similarity lower than the mean of the dynamic coefficient are selected as initial differential pixels. Simultaneously, the initial feature matrix is ​​Z-score standardized. Based on the mean and standard deviation of the pixel features across the entire image, the standardized image metabolomic feature matrix is ​​automatically calculated and output.

[0008] In some other specific embodiments, based on the kernel function replacement and optimization strategy of the metabolomics difference analysis algorithm, this application replaces the Mahalanobis distance kernel function originally used for metabolite difference calculation with a multispectral difference kernel function to adapt to the distance measurement requirements of image features. The kernel function is calculated as: the negative dynamic coefficient of the natural constant e multiplied by the square of the L2 norm of the difference between the multispectral feature matrices of two pixels. The multispectral feature matrices of the two pixels correspond to the local matrices formed by the three-dimensional feature vectors of the two target pixels. The value of the dynamic coefficient is determined by the reciprocal of the standard deviation of the pixel features across the entire image. The standard deviation of the pixel features across the entire image is automatically calculated through statistical analysis of the three-dimensional feature vectors of all pixels. This dynamic coefficient is used to adaptively match the feature distribution density of different images.

[0009] In a preferred embodiment, the obtained preliminary difference pixels are marked with an 8-neighbor connectivity method to identify the preliminary difference region. After removing isolated difference regions with an area less than 0.005% of the total number of pixels in the multispectral image, this threshold is automatically calculated by the image resolution to avoid interference from small noise regions in morphological extraction. Based on the boundary pixels of the preliminary difference region, the shortest Euclidean distance from each pixel in the preliminary difference region to the boundary is calculated based on the embedded morphological representation mechanism. The average of the shortest Euclidean distances from all pixels in the preliminary difference region to the boundary is also calculated. The larger the distance value, the closer the pixel is to the center of the region, and the more likely it is to be the core pixel of the skeleton. The purpose of calculating the shortest distance from each pixel in the region to the boundary is to find the central axis of the region. Therefore, the shortest Euclidean distance of each pixel is calculated, and pixels with a shortest Euclidean distance greater than the average of the shortest Euclidean distances are marked as initial skeleton pixels. Pixels that are not skeleton endpoints and have 2 skeleton pixels in their 8-neighborhood are deleted. The 8-neighborhood refers to the 8 adjacent pixels around a pixel in the vertical, horizontal, and diagonal directions. The skeleton endpoint refers to a pixel with only 1 skeleton pixel in its 8-neighborhood. The endpoints of the lines are key nodes of the skeleton and cannot be deleted. Therefore, the deleted pixels are redundant pixels at the edges. Deletion does not affect the connectivity of the skeleton. The lesion topology skeleton lines are constructed using the undeleted initial skeleton pixels. The lines are composed of connected pixels, preserving the overall morphological features of the difference region, such as the bending direction and branch distribution. Pixels with more than two connections in the lesion topology skeleton lines constructed from the initial skeleton pixels are marked as branch points. The branch length is obtained by accumulating the number of pixels from the branch point to the skeleton endpoint. With the branch point as the origin, pixel coordinate vectors of two adjacent branches are constructed respectively. The vector direction is from the branch point to the branch extension direction. The branch angle between the pixel coordinate vectors of two adjacent branches is calculated using the vector dot product formula. Continuous pixels are fitted into a two-dimensional curve. The mean curvature of the curve is calculated to obtain the skeleton curvature. The connection relationship between branches is represented by encoding, such as the hierarchical encoding of main branch-first-level branch-second-level branch, reflecting the overall structural complexity of the lesion. The initial extraction of the topology skeleton of the difference region is completed, and a topology skeleton feature set containing the number of branches, branch length, branch angle, and skeleton curvature is obtained. After normalizing the topological skeleton feature set and the image metabolomics feature matrix, the numerical range of the newly added dimension is consistent with that of the original feature dimension. The resulting matrix is ​​then fused to generate an enhanced feature matrix. The feature vector of each pixel in this matrix contains the original multispectral, texture, and spatial features as well as the newly added morphological and topological features, thus achieving the synchronous extraction and unified representation of differential and morphological features.

[0010] In a preferred embodiment, step one calculates the energy density value for each pixel based on all feature dimensions in the generated enhanced feature matrix. This includes squaring the difference between the pixel's feature value and the mean of the corresponding feature dimension in each feature dimension, summing the squaring results for all feature dimensions, and dividing the sum by the total number of feature dimensions, which is the number of columns in the enhanced feature matrix, including multispectral, texture, spatial, and morphological feature dimensions, to obtain the energy density value. This energy density value comprehensively reflects the feature saliency and stability of the pixel, and pixels significantly lower than the mean are noise points. The mean and standard deviation of the energy density of the entire multispectral image signal are calculated. The mean minus 1.5 times the standard deviation is used as a temporary threshold. This multiple is adjusted by the 3σ criterion commonly used in signal processing. Through automatic adaptation of the energy distribution of the entire image, pixels with energy density values ​​less than the temporary threshold are marked as potential noise points and removed from the enhanced feature matrix to complete feature purification. Finally, the core lesion feature set is output in step one.

[0011] In a preferred embodiment, step two involves converting the features in the core lesion feature set into discrete features using equal-width discretization. The number of discrete intervals is determined by the interquartile range of the feature values. Each discrete feature is used as a network node. The joint probability distribution of all possible combinations of values ​​for two discrete features is calculated, and then the marginal probability distribution of each of the two discrete features is calculated. The logarithm of the ratio of the product of the joint probability distribution and the marginal probability distribution is calculated. The product of the joint probability distribution and the corresponding logarithm is accumulated to obtain the mutual information value. The joint probability distribution is the number of occurrences of a combination / the total number of samples, and the marginal probability distribution is the number of occurrences of a single value / the total number of samples. The larger the obtained mutual information value, the stronger the correlation between the two features. A two-dimensional correlation matrix is ​​constructed using the mutual information value as matrix elements and the features in the core lesion feature set as rows and columns. Discrete feature pairs with mutual information values ​​greater than the mean mutual information value of the entire matrix are marked as strongly correlated, and their connections in the correlation network are marked as edges. Isolated network nodes and edges that only connect to network nodes at one end are removed from the feature correlation network to form the feature correlation network.

[0012] In a preferred embodiment, step two involves community clustering of the feature association network, including: assigning a unique initial community to each network node of the feature association network, i.e., in the initial state, each feature is treated as a separate community; migrating each network node in the feature association network to the initial community of an adjacent node; using the reciprocal of twice the total number of edges in the feature association network, multiplied by the sum of the calculation results of all network node pairs, as the change in modularity of each network node after migration; wherein the calculation result of a single network node pair is the ratio of the product of the degrees of the corresponding elements in the two-dimensional association matrix minus the degree of the two network nodes to twice the total number of edges; when the change in modularity of the overall feature association network does not increase after at least three consecutive migrations; using the average mutual information value of all edges in each initial community as the internal association degree; using the average mutual information value of the edges between each initial community and other initial communities as the external association degree; and taking the initial communities with internal association degree exceeding external association degree as valid feature clusters to complete the validity verification and output the set of valid feature clusters. The signal-to-noise ratio (SNR) is calculated by comparing the ratio of the mean to the standard deviation of multispectral, texture, spatial, and morphological features in the obtained effective feature cluster set. Weights are then assigned using the SNR as the weight, and features in the effective feature cluster set with weights less than the mean of all feature weights are removed. The remaining effective feature cluster sets undergo recursive feature elimination. The resulting weights are then sorted using the SNR as the weight, and features with the smallest weights are removed sequentially. The classification accuracy of the effective feature cluster set is cross-validated based on historical lesion data. Removal is stopped when the accuracy decreases by more than 5%, and the remaining effective feature cluster set is used as the feature core set.

[0013] In a preferred embodiment, step three uses the optimized feature core set and the multispectral image as dual inputs to the localization link. The localization link includes: calculating the absolute value of the difference between the target pixel feature value and the feature value of the normal vegetation feature template for each feature in the optimized core feature set, multiplying it by the weight of the corresponding feature, summing the results, and then dividing by the total number of features to obtain the matching degree. This completes the matching degree calculation between the full-image pixels of the multispectral image and the normal vegetation feature template. The normal vegetation feature template is generated statistically from the pixel features of lesion-free areas in the corrected multispectral image and is initially segmented using adaptive thresholding. Normal regions are extracted, and the mean value of features is calculated as a template. In the matching degree calculation between the full-image pixels of the multispectral image and the normal vegetation feature template, the smaller the matching degree, the more likely the pixel belongs to the lesion region. Target pixels with a matching degree less than the mean matching degree of the full-image pixels are marked as preliminary lesion features, and connected regions are marked. After all connected regions are marked, the roundness and extensibility of each connected region are calculated, where the roundness is 4π×area / perimeter², and the extensibility is the major axis / minor axis. Regions whose roundness and extensibility exceed the normal lesion morphology range are removed to obtain candidate lesion regions. The Canny edge detection algorithm is used to extract edge pixels of candidate lesion regions. The gradient energy of the edge pixels is calculated, which is the square root of the sum of the squares of the gray-level change rates in the horizontal and vertical directions. After removing weak edge pixels whose gradient energy is less than the average gradient energy of the edge pixels, morphological closing operations are performed on the edge pixels to fill the edge holes, i.e., the holes after removing weak edge pixels. Then, opening operations are performed to eliminate edge spurs. The size of the structuring element of the closing and opening operations is automatically calculated from the average radius of the lesion region to complete the optimization of the edge pixels of the candidate lesion region. Combined with the near-infrared band features of the multispectral image, because the near-infrared reflectance of lesions and normal vegetation is significantly different, blurred edge pixels are re-judged to complete pixel correction. Finally, the lesion region containing the boundary coordinates, area, and morphological parameters of the lesion is output.

[0014] In a preferred embodiment, step three is based on the lesion region containing the lesion boundary coordinates, area, and morphological parameters. The ROI of the lesion region is extracted from the multispectral image. Bilinear interpolation is used to standardize all ROIs to a uniform size to eliminate the influence of different lesion sizes on feature extraction. The color features, texture features, and morphological features of the ROI are extracted to form a fused lesion feature set. The coefficient of variation is obtained by dividing the standard deviation of each feature in the fusion lesion feature set by the mean. The acquisition of the coefficient of variation includes calculating the coefficient of variation for each feature in the fusion lesion feature set, calculating the CV of each feature such as near-infrared gray value and texture contrast separately, calculating the mean value of a single feature in the valid data samples, calculating the standard deviation of the value based on the valid data samples of the same feature, and using the feature standard deviation divided by the feature mean as the coefficient of variation. High-discrimination features with a coefficient of variation greater than the mean of the coefficients of variation of all features in the fusion lesion feature set are retained. Outliers are removed from all retained features, and a normalized fusion lesion feature set is output. Based on the normalized feature set of all samples in each category of the standard pest and disease feature library and the standard feature template vector in the normalized feature set, the feature covariance matrix of each category is calculated. The matrix element is the covariance of any two features. The distance between the feature vector of the normalized fused lesion feature set and the standard feature template vector in the feature covariance matrix of each category is calculated using the Mahalanobis distance formula to obtain the Mahalanobis distance difference. The topological skeleton of the normalized fused lesion feature set is spatially aligned with standard samples in the standard pest and disease feature library. Procrustes analysis is used to eliminate translation, rotation, and scaling differences. The forward distance is the maximum of the minimum distances from all pixels of the skeleton to be detected to the standard skeleton, and the reverse distance is the maximum of the minimum distances from all pixels of the standard skeleton to the skeleton to be detected. The average of the two is taken as the basic morphological distance difference value. The bidirectional Hausdorff distance between the two skeletons after alignment is calculated. The relative error between the topological skeleton and the standard sample is calculated using branch length, branch angle, skeleton curvature, and number of branches as parameters. The entropy weight method is used to calculate the weight of each parameter and the weighted sum is used to obtain the parameter difference value of the topological skeleton.

[0015] In a preferred embodiment, the obtained basic morphological distance difference value and parameter difference value are respectively used as the criterion layer, and the accuracy of fusion difference is the target layer. An AHP hierarchical structure is constructed. The criterion layer judgment matrix is ​​established by sum-product method and manual assignment. Cross-validation is used to select the weight combination with the highest accuracy as the weighted summation coefficient. The basic morphological distance difference value and parameter difference value are weighted and summed to obtain the fusion difference between the lesion to be detected and a certain category of standard sample. All categories of the standard pest and disease feature library are traversed to form a fusion difference matrix. The skeleton matching rate is the ratio of the number of overlapping skeleton pixels between the lesion area in the fusion lesion feature set and the standard sample in the standard pest and disease feature library to the total number of skeleton pixels. This is divided by the maximum size of the standard sample to obtain the morphological similarity score. The higher the score, the stronger the morphological consistency. The morphological complexity is the ratio of the square of the perimeter of the lesion area to its area. Based on the fusion difference of samples from each category in the standard sample library, a probability distribution model of the difference of each type of pest and disease is constructed. The mean, standard deviation, and 95% confidence interval of the difference of each category of samples are calculated. The difference of each category in the fusion difference matrix is ​​standardized. The first round is based on the basic morphological distance difference value and parameter difference value to screen, retaining the categories with standardized difference values ​​less than 1.2 and automatically derived from the 93% confidence interval as initial candidates. The second round is based on morphological similarity score and morphological complexity to screen the initial candidates, and select the initial candidates with morphological similarity scores and morphological complexity greater than 0.5 to obtain secondary candidates. K-means clustering is used to determine the distance between the category samples in the secondary candidates and the existing category samples in the standard library. If the distance is greater than 1.5 times the average distance between existing category samples, it is determined to be a new type. If the distance is less than or equal to 1.5 times the average distance between existing category samples, the existing category samples matched by the secondary candidates are output as the pest and disease detection results.

[0016] This invention also provides a machine vision-based fruit tree pest and disease detection system, the system comprising: The image acquisition and feature preprocessing module is used to acquire raw machine vision images and perform preliminary feature extraction and purification. It acquires RGB and near-infrared multispectral images of fruit trees via a camera, corrects the raw images, and outputs standardized multispectral images. Based on a metabolomics difference analysis algorithm, it constructs a three-dimensional feature vector using pixels as units to form an initial feature matrix. An adaptive kernel function is used to filter out initially differing pixels and standardize them to obtain the image metabolomics feature matrix. A morphological representation mechanism is then embedded to extract the topological skeleton feature set of the initially differing regions. This feature set is then fused with the image metabolomics feature matrix using normalization to generate an enhanced feature matrix. Finally, an energy density threshold is used to filter and remove noise points, completing feature purification and outputting the core lesion feature set. Feature optimization and association analysis module: This module is used to refine and effectively screen core features in the core lesion feature set. It transforms the core lesion feature set into discrete features through equal-width discretization, calculates the mutual information values ​​between features to construct a two-dimensional association matrix, marks strongly correlated feature pairs and removes isolated nodes to form a feature association network. Then, it performs community clustering on the association network, verifies and screens effective feature clusters through module degree change, assigns weights based on the signal-to-noise ratio, removes redundant features through recursive feature elimination, and finally outputs the optimized core feature set. The lesion localization and fusion feature construction module is used for precise lesion area localization and multi-dimensional feature fusion. It takes a feature core set and a multispectral image as dual inputs. It calculates the matching degree between pixels and normal vegetation feature templates, filters connected region morphology, and outputs a precise lesion area containing boundary coordinates, area, and morphological parameters. Then, it extracts the lesion area ROI, extracts color, texture, and morphological features to form a fused lesion feature set, and calculates the difference between the fused feature set and the standard sample in Mahalanobis distance, bidirectional Hausdorff distance, and topological skeleton parameters, providing a quantitative basis for identification and matching. The pest and disease identification, matching, and result output module is used to complete the final decision and result output based on the standard feature library. By constructing an AHP hierarchical structure, it calculates the fusion difference between the lesion to be detected and the standard sample and forms a matrix. It obtains secondary candidates through two rounds of screening and judges the distance between the secondary candidates and the existing category samples in the standard library based on K-means clustering, and completes the output of pest and disease detection results.

[0017] The beneficial effects of this invention are: by integrating multi-dimensional features such as spectrum, texture, spatial coordinates and morphological topology, it comprehensively captures the essential attributes of lesions and forms a multi-dimensional fusion feature system, which effectively solves the problems of difficulty in distinguishing similar pest and disease morphologies and difficulty in identifying weak early lesion features. Furthermore, it filters strongly correlated features through mutual information values, then filters effective feature clusters through modularity verification, and finally eliminates redundant features based on cross-validation, retaining core features with high discriminative power and significantly reducing the computational load caused by invalid features, thus adapting to the computing power requirements of real-time field detection. Attached Figure Description

[0018] Figure 1 This is a flowchart of the present invention. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the stated features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0021] In the description of this application, the term "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0022] As attached Figure 1 As shown, this embodiment provides a method for detecting fruit tree diseases and pests based on machine vision, the method comprising the following steps: Step 1: The original machine vision image acquired by the camera is preprocessed into a multispectral image and converted into an image metabolomics data format using a metabolomics difference analysis algorithm. This process yields the image metabolomics feature matrix and preliminary difference pixels. The morphological representation mechanism embedded in the metabolomics difference analysis algorithm extracts the topological skeleton of the preliminary difference region obtained from the preliminary difference pixels. The topological skeleton feature set is then used as a new morphological feature dimension and fused with the image metabolomics feature matrix to generate an enhanced feature matrix. The enhanced feature matrix and the multispectral image are then purified using a noise adaptation strategy fused with the metabolomics difference analysis algorithm to output the core lesion feature set. In step one, the original machine vision image acquired by the camera includes RGB image and near-infrared multispectral image. The acquired original machine vision image is radiometrically corrected to eliminate the influence of light intensity fluctuation on gray value. Geometric correction is used to correct lens distortion and shooting angle deviation during image acquisition to obtain the corrected multispectral image. The metabolomic differential analysis algorithm uses each pixel in a multispectral image as the basic unit. The first dimension is the grayscale value of each spectral band within a single pixel. The second dimension is the texture feature value of a single pixel calculated using the gray-level co-occurrence matrix. The third dimension is the spatial coordinate feature of a single pixel's horizontal and vertical coordinates relative to the image center. This constructs a three-dimensional feature vector for each pixel. The three-dimensional feature vectors of all pixels are combined to form an initial feature matrix. The initial feature matrix is ​​then used to measure similarity using a kernel function that is a power of the square of the second norm of the difference between the multispectral feature matrices of two pixels, which is a negative dynamic coefficient of the natural constant e. Pixels with feature similarity lower than the mean of the dynamic coefficient are selected as initial differential pixels. Simultaneously, the initial feature matrix is ​​Z-score standardized. Based on the mean and standard deviation of the pixel features across the entire image, the standardized image metabolomic feature matrix is ​​automatically calculated and output.

[0023] In some other specific embodiments, based on the kernel function replacement and optimization strategy of the metabolomics difference analysis algorithm, this application replaces the Mahalanobis distance kernel function originally used for metabolite difference calculation with a multispectral difference kernel function to adapt to the distance measurement requirements of image features. The kernel function is calculated as: the negative dynamic coefficient of the natural constant e multiplied by the square of the L2 norm of the difference between the multispectral feature matrices of two pixels. The multispectral feature matrices of the two pixels correspond to the local matrices formed by the three-dimensional feature vectors of the two target pixels. The value of the dynamic coefficient is determined by the reciprocal of the standard deviation of the pixel features across the entire image. The standard deviation of the pixel features across the entire image is automatically calculated through statistical analysis of the three-dimensional feature vectors of all pixels. This dynamic coefficient is used to adaptively match the feature distribution density of different images.

[0024] The obtained initial difference pixels are marked into initial difference regions using the 8-neighbor connectivity method. After removing isolated difference regions with an area less than 0.005% of the total number of pixels in the multispectral image (this threshold is automatically calculated by the image resolution to avoid interference from small noise regions in morphological extraction), the boundary pixels of the initial difference regions are used as a benchmark. Based on the embedded morphological representation mechanism, the shortest Euclidean distance from each pixel in the initial difference region to the boundary is calculated, and the average of the shortest Euclidean distances from all pixels in the initial difference region to the boundary is calculated. The larger the distance value, the closer the pixel is to the center of the region, and the more likely it is to be the core pixel of the skeleton. The purpose of calculating the shortest distance from each pixel in the region to the boundary is to find the central axis of the region. Therefore, the shortest Euclidean distance of each pixel is calculated, and pixels with a shortest Euclidean distance greater than the average of the shortest Euclidean distances are marked as initial skeleton pixels. Pixels that are not skeleton endpoints and have 2 skeleton pixels in their 8-neighborhood are deleted. The 8-neighborhood refers to the 8 adjacent pixels around a pixel in the vertical, horizontal, and diagonal directions. The skeleton endpoint refers to a pixel with only 1 skeleton pixel in its 8-neighborhood, similar to the endpoint of a line. These are key nodes in the skeleton and cannot be deleted. Therefore, the deleted pixels are redundant pixels at the edges. Deletion does not affect the connectivity of the skeleton. The lesion topology skeleton lines are constructed using the undeleted initial skeleton pixels. The lines are composed of connected pixels, preserving the overall morphological features of the difference region, such as the curvature direction and branch distribution. Pixels with more than two connections in the lesion topology skeleton lines constructed from the initial skeleton pixels are marked as branch points. The branch length is obtained by accumulating the number of pixels from the branch point to the skeleton endpoint. With the branch point as the origin, pixel coordinate vectors of two adjacent branches are constructed respectively. The vector direction is from the branch point to the branch extension direction. The branch angle between the pixel coordinate vectors of two adjacent branches is calculated using the vector dot product formula. Continuous pixels are fitted into a two-dimensional curve, and the mean curvature of the curve is calculated to obtain the skeleton curvature. The connection relationship between branches is represented by encoding, such as the hierarchical encoding of main branch-first-level branch-second-level branch, reflecting the overall structural complexity of the lesion. The initial extraction of the topology skeleton of the difference region is completed, and a topology skeleton feature set containing the number of branches, branch length, branch angle, and skeleton curvature is obtained. After normalizing the topological skeleton feature set and the image metabolomics feature matrix, the numerical range of the newly added dimension is consistent with that of the original feature dimension. The resulting matrix is ​​then fused to generate an enhanced feature matrix. The feature vector of each pixel in this matrix contains the original multispectral, texture, and spatial features as well as the newly added morphological and topological features, thus achieving the synchronous extraction and unified representation of differential and morphological features.

[0025] Step one calculates the energy density value for each pixel based on all feature dimensions in the generated enhanced feature matrix. This includes squaring the difference between the pixel's feature value and the mean of the corresponding feature dimension in each feature dimension, summing the squaring results for all feature dimensions, and dividing the sum by the total number of feature dimensions, which is the number of columns in the enhanced feature matrix, including multispectral, texture, spatial, and morphological feature dimensions, to obtain the energy density value. This energy density value comprehensively reflects the feature saliency and stability of the pixel, and pixels significantly lower than the mean are noise points. The mean and standard deviation of the energy density of the entire multispectral image signal are calculated. The mean minus 1.5 times the standard deviation is used as a temporary threshold. This multiple is adjusted by the 3σ criterion commonly used in signal processing. Through automatic adaptation of the energy distribution of the entire image, pixels with energy density values ​​less than the temporary threshold are marked as potential noise points and removed from the enhanced feature matrix to complete feature purification. Finally, the core lesion feature set is output in step one.

[0026] Step 2: Transform the features in the core lesion feature set into discrete features. Using each discrete feature as a network node, calculate the mutual information value between any two discrete features. Use the mutual information value as matrix elements to construct a two-dimensional correlation matrix and a feature correlation network. Perform community clustering on the feature correlation network. Output the optimized feature core set through validity verification. Add a multispectral image as the dual input of the localization link to obtain the lesion region containing lesion boundary coordinates, area, and morphological parameters. Step two involves converting the features in the core lesion feature set into discrete features using equal-width discretization. The number of discrete intervals is determined by the interquartile range of the feature values. Each discrete feature is used as a network node. The joint probability distribution of all combinations of values ​​for two discrete features is calculated, and then the marginal probability distribution of each discrete feature is calculated. The logarithm of the ratio of the product of the joint probability distribution and the marginal probability distribution is calculated. The product of the joint probability distribution and the corresponding logarithm is accumulated to obtain the mutual information value. The joint probability distribution is the number of occurrences of the combination / the total number of samples, and the marginal probability distribution is the number of occurrences of a single value / the total number of samples. The larger the mutual information value, the stronger the correlation between the two features. A two-dimensional correlation matrix is ​​constructed using the mutual information value as matrix elements and the features in the core lesion feature set as rows and columns. Discrete feature pairs with mutual information values ​​greater than the mean mutual information value of the entire matrix are marked as strongly correlated, and their connections in the correlation network are marked as edges. Isolated network nodes and edges that only connect network nodes at one end are removed from the feature correlation network to form the feature correlation network.

[0027] Step two involves community clustering of the feature association network, including: assigning a unique initial community to each network node of the feature association network, i.e., in the initial state, each feature is treated as a separate community; migrating each network node in the feature association network to the initial community of the adjacent node; using the reciprocal of twice the total number of edges in the feature association network, multiplied by the sum of the calculation results of all network node pairs, as the change in modularity of each network node after migration; where the calculation result of a single network node pair is the ratio of the product of the degrees of the corresponding elements in the two-dimensional association matrix minus the degree of the two network nodes to twice the total number of edges; when the overall modularity of the feature association network does not increase after at least three consecutive migrations; using the average mutual information value of all edges in each initial community as the internal association degree; using the average mutual information value of the edges between each initial community and other initial communities as the external association degree; and taking the initial communities where the internal association degree exceeds the external association degree as valid feature clusters to complete the validity verification and output the set of valid feature clusters. The signal-to-noise ratio (SNR) is calculated by comparing the ratio of the mean to the standard deviation of multispectral, texture, spatial, and morphological features in the obtained effective feature cluster set. Weights are then assigned using the SNR as the weight, and features in the effective feature cluster set with weights less than the mean of all feature weights are removed. The remaining effective feature cluster sets undergo recursive feature elimination. The resulting weights are then sorted using the SNR as the weight, and features with the smallest weights are removed sequentially. The classification accuracy of the effective feature cluster set is cross-validated based on historical lesion data. Removal is stopped when the accuracy decreases by more than 5%, and the remaining effective feature cluster set is used as the feature core set.

[0028] Step 3: Based on the lesion region containing the boundary coordinates, area, and morphological parameters of the lesion, extract the ROI of the lesion region from the multispectral image and form a fused lesion feature set. Use the standard pest and disease feature library as a reference to obtain the difference value of the fused lesion feature set. Use the fusion difference matrix obtained by fusion difference degree and the fused lesion feature set for decision-aid verification and pest and disease identification matching to obtain the detection results.

[0029] Step three uses the optimized feature core set and the multispectral image as the dual inputs to the localization link. The localization link includes: calculating the absolute value of the difference between the target pixel feature value of each feature in the optimized core feature set and the feature value of the normal vegetation feature template, multiplying it by the weight of the corresponding feature, summing the results, and then dividing by the total number of features to obtain the matching degree. This completes the matching degree calculation between the entire pixel of the multispectral image and the normal vegetation feature template. The normal vegetation feature template is generated by statistically analyzing the pixel features of the lesion-free areas in the corrected multispectral image, and the normal area is initially extracted through adaptive threshold segmentation. The mean value of the calculated features is used as a template. In the matching degree calculation between the full-image pixels of the multispectral image and the normal vegetation feature template, the smaller the matching degree, the more likely the pixel belongs to the lesion area. Target pixels with a matching degree less than the mean matching degree of the full-image pixels are marked as preliminary lesion features, and connected regions are marked. After all connected regions are marked, the roundness and extensibility of each connected region are calculated, where the roundness is 4π×area / perimeter², and the extensibility is the major axis / minor axis. Regions whose roundness and extensibility exceed the normal lesion morphology range are removed to obtain candidate lesion areas. The Canny edge detection algorithm is used to extract edge pixels of candidate lesion regions. The gradient energy of the edge pixels is calculated, which is the square root of the sum of the squares of the gray-level change rates in the horizontal and vertical directions. After removing weak edge pixels whose gradient energy is less than the average gradient energy of the edge pixels, morphological closing operations are performed on the edge pixels to fill the edge holes, i.e., the holes after removing weak edge pixels. Then, opening operations are performed to eliminate edge spurs. The size of the structuring element of the closing and opening operations is automatically calculated from the average radius of the lesion region to complete the optimization of the edge pixels of the candidate lesion region. Combined with the near-infrared band features of the multispectral image, because the near-infrared reflectance of lesions and normal vegetation is significantly different, blurred edge pixels are re-judged to complete pixel correction. Finally, the lesion region containing the boundary coordinates, area, and morphological parameters of the lesion is output.

[0030] Step 3 is based on the lesion region containing the lesion boundary coordinates, area, and morphological parameters. The ROI of the lesion region is extracted from the multispectral image. Bilinear interpolation is used to standardize all ROIs to a uniform size to eliminate the influence of different lesion sizes on feature extraction. The color features, texture features, and morphological features of the ROI are extracted to form a fused lesion feature set. The coefficient of variation is obtained by dividing the standard deviation of each feature in the fusion lesion feature set by the mean. The acquisition of the coefficient of variation includes calculating the coefficient of variation for each feature in the fusion lesion feature set, calculating the CV of each feature such as near-infrared gray value and texture contrast separately, calculating the mean value of a single feature in the valid data samples, calculating the standard deviation of the value based on the valid data samples of the same feature, and using the feature standard deviation divided by the feature mean as the coefficient of variation. High-discrimination features with a coefficient of variation greater than the mean of the coefficients of variation of all features in the fusion lesion feature set are retained. Outliers are removed from all retained features, and a normalized fusion lesion feature set is output. Based on the normalized feature set of all samples in each category of the standard pest and disease feature library and the standard feature template vector in the normalized feature set, the feature covariance matrix of each category is calculated. The matrix element is the covariance of any two features. The distance between the feature vector of the normalized fused lesion feature set and the standard feature template vector in the feature covariance matrix of each category is calculated using the Mahalanobis distance formula to obtain the Mahalanobis distance difference. The topological skeleton of the normalized fused lesion feature set is spatially aligned with standard samples in the standard pest and disease feature library. Procrustes analysis is used to eliminate translation, rotation, and scaling differences. The forward distance is the maximum of the minimum distances from all pixels of the skeleton to be detected to the standard skeleton, and the reverse distance is the maximum of the minimum distances from all pixels of the standard skeleton to the skeleton to be detected. The average of the two is taken as the basic morphological distance difference value. The bidirectional Hausdorff distance between the two skeletons after alignment is calculated. The relative error between the topological skeleton and the standard sample is calculated using branch length, branch angle, skeleton curvature, and number of branches as parameters. The entropy weight method is used to calculate the weight of each parameter and the weighted sum is used to obtain the parameter difference value of the topological skeleton.

[0031] The obtained basic morphological distance difference value and parameter difference value are used as the criteria layer, and the accuracy of fusion difference is the target layer. An AHP hierarchical structure is constructed. The criteria layer judgment matrix is ​​established by sum-product method and manual assignment. Cross-validation is used to select the weight combination with the highest accuracy as the weighted summation coefficient. The basic morphological distance difference value and parameter difference value are weighted and summed to obtain the fusion difference between the lesion to be detected and a certain category of standard sample. All categories of the standard pest and disease feature library are traversed to form a fusion difference matrix. The skeleton matching rate is the ratio of the number of overlapping skeleton pixels between the lesion area in the fusion lesion feature set and the standard sample in the standard pest and disease feature library to the total number of skeleton pixels. This is divided by the maximum size of the standard sample to obtain the morphological similarity score. The higher the score, the stronger the morphological consistency. The morphological complexity is the ratio of the square of the perimeter of the lesion area to its area. Based on the fusion difference of samples from each category in the standard sample library, a probability distribution model of the difference of each type of pest and disease is constructed. The mean, standard deviation, and 95% confidence interval of the difference of each category of samples are calculated. The difference of each category in the fusion difference matrix is ​​standardized. The first round is based on the basic morphological distance difference value and parameter difference value to screen, retaining the categories with standardized difference values ​​less than 1.2 and automatically derived from the 93% confidence interval as initial candidates. The second round is based on morphological similarity score and morphological complexity to screen the initial candidates, and select the initial candidates with morphological similarity scores and morphological complexity greater than 0.5 to obtain secondary candidates. K-means clustering is used to determine the distance between the category samples in the secondary candidates and the existing category samples in the standard library. If the distance is greater than 1.5 times the average distance between existing category samples, it is determined to be a new type. If the distance is less than or equal to 1.5 times the average distance between existing category samples, the existing category samples matched by the secondary candidates are output as the pest and disease detection results.

[0032] This invention also provides a machine vision-based fruit tree pest and disease detection system, comprising: an image acquisition and feature preprocessing module; used to acquire raw machine vision images and perform preliminary feature extraction and purification, by acquiring RGB and near-infrared multispectral images of fruit trees through a camera, correcting the raw images, outputting standardized multispectral images, constructing a three-dimensional feature vector based on a metabolomics difference analysis algorithm, forming an initial feature matrix, filtering preliminary difference pixels through an adaptive kernel function and standardizing them to obtain an image metabolomics feature matrix; then embedding a morphological representation mechanism to extract the topological skeleton feature set of the preliminary difference region, normalizing and fusing it with the image metabolomics feature matrix to generate an enhanced feature matrix, and finally filtering out noise points through an energy density threshold to complete feature purification and output a core lesion feature set; Feature optimization and association analysis module: This module is used to refine and effectively screen core features in the core lesion feature set. It transforms the core lesion feature set into discrete features through equal-width discretization, calculates the mutual information values ​​between features to construct a two-dimensional association matrix, marks strongly correlated feature pairs and removes isolated nodes to form a feature association network. Then, it performs community clustering on the association network, verifies and screens effective feature clusters through module degree change, assigns weights based on the signal-to-noise ratio, removes redundant features through recursive feature elimination, and finally outputs the optimized core feature set. The lesion localization and fusion feature construction module is used for precise lesion area localization and multi-dimensional feature fusion. It takes a feature core set and a multispectral image as dual inputs. It calculates the matching degree between pixels and normal vegetation feature templates, filters connected region morphology, and outputs a precise lesion area containing boundary coordinates, area, and morphological parameters. Then, it extracts the lesion area ROI, extracts color, texture, and morphological features to form a fused lesion feature set, and calculates the difference between the fused feature set and the standard sample in Mahalanobis distance, bidirectional Hausdorff distance, and topological skeleton parameters, providing a quantitative basis for identification and matching. The pest and disease identification, matching, and result output module is used to complete the final decision and result output based on the standard feature library. By constructing an AHP hierarchical structure, it calculates the fusion difference between the lesion to be detected and the standard sample and forms a matrix. It obtains secondary candidates through two rounds of screening and judges the distance between the secondary candidates and the existing category samples in the standard library based on K-means clustering, and completes the output of pest and disease detection results.

[0033] It should be noted that the descriptions of each embodiment in the above embodiments have different focuses. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0034] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0035] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0036] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0037] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0038] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the invention.

[0039] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A machine vision-based method for detecting fruit tree diseases and pests, characterized in that, The method includes the following steps: Step 1: The original machine vision image acquired by the camera is preprocessed into a multispectral image and converted into an image metabolomics data format using a metabolomics difference analysis algorithm. This process yields the image metabolomics feature matrix and preliminary difference pixels. The morphological representation mechanism embedded in the metabolomics difference analysis algorithm extracts the topological skeleton of the preliminary difference region obtained from the preliminary difference pixels. The topological skeleton feature set is then used as a new morphological feature dimension and fused with the image metabolomics feature matrix to generate an enhanced feature matrix. The enhanced feature matrix and the multispectral image are then purified using a noise adaptation strategy fused with the metabolomics difference analysis algorithm to output the core lesion feature set. Step 2: Transform the features in the core lesion feature set into discrete features. Using each discrete feature as a network node, calculate the mutual information value between any two discrete features. Use the mutual information value as matrix elements to construct a two-dimensional correlation matrix and a feature correlation network. Perform community clustering on the feature correlation network. Output the optimized feature core set through validity verification. Add a multispectral image as the dual input of the localization link to obtain the lesion region containing lesion boundary coordinates, area, and morphological parameters. Step 3: Based on the lesion region containing the boundary coordinates, area, and morphological parameters of the lesion, extract the ROI of the lesion region from the multispectral image and form a fused lesion feature set. Use the standard pest and disease feature library as a reference to obtain the difference value of the fused lesion feature set. Use the fusion difference matrix obtained by fusion difference degree and the fused lesion feature set for decision-aid verification and pest and disease identification matching to obtain the detection results.

2. The method for detecting fruit tree diseases and pests based on machine vision according to claim 1, characterized in that, In step one, the original machine vision image acquired by the camera includes RGB image and near-infrared multispectral image. The acquired original machine vision image is radiometrically corrected to eliminate light intensity fluctuations, and geometrically corrected to correct lens distortion and shooting angle deviation during the image acquisition process, so as to obtain the corrected multispectral image. The metabolomic differential parsing algorithm uses each pixel in a multispectral image as the basic unit. The first dimension is the gray value of each spectral band in a single pixel. The second dimension is the texture feature value of a single pixel calculated through the gray-level co-occurrence matrix. The third dimension is the spatial coordinate feature of a single pixel in the multispectral image relative to the image center. These three-dimensional feature vectors of all pixels are combined to form an initial feature matrix. The similarity of the initial feature matrix is ​​measured by a kernel function that is the power of the square of the difference between the multispectral feature matrices of two pixels, which is a negative dynamic coefficient multiple of the natural constant e. Pixels with feature similarity lower than the mean dynamic coefficient are selected as preliminary differential pixels. At the same time, the initial feature matrix is ​​Z-score normalized to output the normalized image metabolomic feature matrix.

3. The method for detecting fruit tree diseases and pests based on machine vision according to claim 2, characterized in that, The obtained initial difference pixels are labeled with the initial difference region using the 8-neighbor connectivity method. After removing isolated difference regions with an area less than 0.005% of the total number of pixels in the multispectral map, the boundary pixels of the initial difference region are used as the benchmark. Based on the embedded morphological representation mechanism, the shortest Euclidean distance from each pixel in the initial difference region to the boundary is calculated, and the average of the shortest Euclidean distances from all pixels in the initial difference region to the boundary is calculated. Pixels with a shortest Euclidean distance greater than the average of the shortest Euclidean distances are marked as initial skeleton pixels. Pixels that are not skeleton endpoints and have 2 skeleton pixels in their 8-neighborhood are deleted. The initial skeleton without deletion is used as the basis for the calculation. The topological skeleton lines of the lesion are constructed from pixels. In the initial skeleton pixel construction of the topological skeleton lines of the lesion topological skeleton lines, the number of connected pixels with more than 2 pixels is marked as branch points. The number of pixels from the branch point to the skeleton endpoint is accumulated to obtain the branch length. With the branch point as the origin, the pixel coordinate vectors of two adjacent branches are constructed respectively. The branch angle between the pixel coordinate vectors of two adjacent branches is calculated by the vector dot product formula. Continuous pixels are taken to fit a two-dimensional curve. The mean curvature of the curve is calculated to obtain the skeleton curvature. The topological skeleton of the preliminary difference region is extracted, and a topological skeleton feature set containing the number of branches, branch length, branch angle, and skeleton curvature is obtained. After performing feature normalization on the topological skeleton feature set and the image metabolomics feature matrix, they are fused to generate an enhanced feature matrix.

4. The method for detecting fruit tree diseases and pests based on machine vision according to claim 1, characterized in that, Step one calculates the energy density value for each pixel based on all feature dimensions in the generated enhanced feature matrix, including: In each feature dimension, the difference between the feature value of the pixel and the mean of the corresponding feature dimension is squared, and the squared results of all feature dimensions are summed. The sum is then divided by the total number of feature dimensions to obtain the energy density value. The mean and standard deviation of the energy density of the full-image signal in the multispectral image are calculated. The mean minus 1.5 times the standard deviation is used as a temporary threshold. Pixels with energy density values ​​less than the temporary threshold are marked as potential noise points and removed from the enhanced feature matrix to complete feature purification. Finally, the core lesion feature set is output in step one.

5. The method for detecting fruit tree diseases and pests based on machine vision according to claim 1, characterized in that, Step two involves converting the features in the core lesion feature set into discrete features using equal-width discretization. Each discrete feature is then used as a network node. The joint probability distribution of all possible combinations of values ​​for two discrete features is calculated, followed by the marginal probability distribution of each feature. The logarithm of the ratio of the product of the joint probability distribution and the marginal probability distribution is calculated. The product of the joint probability distribution and the corresponding logarithm is accumulated to obtain the mutual information value. Using the mutual information value as matrix elements, a two-dimensional association matrix is ​​constructed with the features in the core lesion feature set as rows and columns. Discrete feature pairs with mutual information values ​​greater than the mean mutual information of the entire matrix are marked as strongly associated, and their connections in the association network are designated as edges. Isolated network nodes and edges connecting only one end of a network node are removed from the feature association network to form the feature association network.

6. The method for detecting fruit tree diseases and pests based on machine vision according to claim 5, characterized in that, Step two involves community clustering of the feature association network, including: assigning a unique initial community to each network node in the feature association network; migrating each network node in the feature association network to the initial community of an adjacent node; using the reciprocal of twice the total number of edges in the feature association network, multiplied by the sum of the calculation results of all network node pairs, as the change in modularity of each network node after migration; if the change in modularity of the overall feature association network does not increase after at least three consecutive migrations; using the average mutual information value of all edges in each initial community as the internal association degree; using the average mutual information value of the edges between each initial community and other initial communities as the external association degree; and taking the initial communities with internal association degree exceeding external association degree as valid feature clusters to complete the validity verification and output the set of valid feature clusters. The signal-to-noise ratio (SNR) is calculated by comparing the ratio of the mean of the features to the standard deviation of the features in the obtained effective feature cluster set. Weights are then assigned using the SNR as the weight, and features in the effective feature cluster set with weights less than the mean of all feature weights are removed. The remaining effective feature cluster set features are then recursively eliminated. The resulting weights are then sorted using the SNR as the weight, and features with the smallest weights are removed sequentially according to the sorted list. The classification accuracy of the effective feature cluster set is then cross-validated based on historical lesion data. If the accuracy decreases by more than 5%, the removal process stops, and the remaining effective feature cluster set is used as the feature core set.

7. The method for detecting fruit tree diseases and pests based on machine vision according to claim 1, characterized in that, Step 3 uses the optimized feature core set and the multispectral image as the dual inputs of the localization link. The localization link includes: calculating the absolute value of the difference between the target pixel feature value of each feature in the optimized core feature set and the feature value of the normal vegetation feature template, multiplying it by the weight of the corresponding feature, summing it, and then dividing it by the total number of features to obtain the matching degree. This completes the matching degree calculation between the full-image pixels of the multispectral image and the normal vegetation feature template. Target pixels with a matching degree less than the average matching degree of the full-image pixels are marked as preliminary lesion features, and connected regions are marked. After marking all connected regions, the roundness and extensibility of each connected region are calculated. Regions with roundness and extensibility exceeding the normal lesion morphology range are removed to obtain candidate lesion regions. The Canny edge detection algorithm is used to extract edge pixels of candidate lesion regions. The gradient energy of the edge pixels is calculated. Weak edge pixels with gradient energy less than the average gradient energy of the edge pixels are removed. Morphological closing operation is performed on the edge pixels to fill edge holes, and then opening operation is performed to eliminate edge spurs. This completes the optimization of edge pixels of candidate lesion regions. Combined with the near-infrared band features of multispectral images, blurred edge pixels are re-judged to complete pixel correction. Finally, the lesion region containing lesion boundary coordinates, area, and morphological parameters is output.

8. The method for detecting fruit tree diseases and pests based on machine vision according to claim 1, characterized in that, Step three involves extracting the Region of Interest (ROI) of the lesion region from the multispectral image based on the lesion region including the lesion boundary coordinates, area, and morphological parameters. Bilinear interpolation is then used to standardize all ROIs to a uniform size, and the color, texture, and morphological features of the ROIs are extracted to form a fused lesion feature set. The coefficient of variation is obtained by dividing the standard deviation of each feature in the fusion lesion feature set by the mean. The acquisition of the coefficient of variation includes calculating the coefficient of variation for each feature in the fusion lesion feature set, retaining high-discrimination features whose coefficient of variation is greater than the mean of the coefficients of variation of all features in the fusion lesion feature set, removing outliers from all retained features, and outputting a normalized fusion lesion feature set. Based on the normalized feature set and the standard feature template vector in the normalized feature set of all samples in each category of the standard pest and disease feature library, the feature covariance matrix of each category is calculated. The distance between the feature vector of the normalized fused lesion feature set and the standard feature template vector in the feature covariance matrix of each category is calculated using the Mahalanobis distance formula to obtain the Mahalanobis distance difference. The topological skeleton of the normalized fused lesion feature set is spatially aligned with standard samples in the standard pest and disease feature library. Procrustes analysis is used to eliminate translation, rotation, and scaling differences. The forward distance is the maximum of the minimum distances from all pixels of the skeleton to be detected to the standard skeleton, and the reverse distance is the maximum of the minimum distances from all pixels of the standard skeleton to the skeleton to be detected. The average of the two is taken as the basic morphological distance difference value. The bidirectional Hausdorff distance between the two skeletons after alignment is calculated. The relative error between the topological skeleton and the standard sample is calculated using branch length, branch angle, skeleton curvature, and number of branches as parameters. The entropy weight method is used to calculate the weight of each parameter and the weighted sum is used to obtain the parameter difference value of the topological skeleton.

9. The method for detecting fruit tree diseases and pests based on machine vision according to claim 8, characterized in that, The obtained basic morphological distance difference value and parameter difference value are used as the criteria layer, and the accuracy of fusion difference is the target layer. An AHP hierarchical structure is constructed. The criteria layer judgment matrix is ​​established by sum-product method and manual assignment. Cross-validation is used to select the weight combination with the highest accuracy as the weighted summation coefficient. The basic morphological distance difference value and parameter difference value are weighted and summed to obtain the fusion difference between the lesion to be detected and a certain category of standard sample. All categories of the standard pest and disease feature library are traversed to form a fusion difference matrix. The skeleton matching rate is the ratio of the number of overlapping skeleton pixels between the lesion area in the fusion lesion feature set and the standard sample in the standard pest and disease feature library to the total number of skeleton pixels. The morphological similarity score is obtained by dividing the skeleton matching rate by the maximum size of the standard sample. The morphological complexity is the ratio of the square of the perimeter of the lesion area to its area. Based on the fusion difference of samples from each category in the standard sample library, a probability distribution model of the difference of each type of pest and disease is constructed. The mean, standard deviation, and confidence interval of the difference of each category of samples are calculated. The difference of each category in the fusion difference matrix is ​​standardized. The first round is based on the basic morphological distance difference value and parameter difference value to obtain the initial candidates. The second round is based on the morphological similarity score and morphological complexity to obtain the secondary candidates. K-means clustering is used to determine the distance between the category samples in the secondary candidates and the existing category samples in the standard library. If the distance is greater than 1.5 times the average distance between existing category samples, it is determined to be a new type. If the distance is less than or equal to 1.5 times the average distance between existing category samples, the existing category sample matched by the secondary candidate is output as the pest and disease detection result.

10. A machine vision-based fruit tree pest and disease detection system, applied to the machine vision-based fruit tree pest and disease detection method as described in any one of claims 1-9, characterized in that, The system includes: The image acquisition and feature preprocessing module is used to acquire raw machine vision images and perform preliminary feature extraction and purification. It acquires RGB and near-infrared multispectral images of fruit trees via a camera, corrects the raw images, and outputs standardized multispectral images. Based on a metabolomics difference analysis algorithm, it constructs a three-dimensional feature vector using pixels as units to form an initial feature matrix. An adaptive kernel function is used to filter out initially differing pixels and standardize them to obtain the image metabolomics feature matrix. A morphological representation mechanism is then embedded to extract the topological skeleton feature set of the initially differing regions. This feature set is then fused with the image metabolomics feature matrix using normalization to generate an enhanced feature matrix. Finally, an energy density threshold is used to filter and remove noise points, completing feature purification and outputting the core lesion feature set. Feature optimization and association analysis module: This module is used to refine and effectively screen core features in the core lesion feature set. It transforms the core lesion feature set into discrete features through equal-width discretization, calculates the mutual information values ​​between features to construct a two-dimensional association matrix, marks strongly correlated feature pairs and removes isolated nodes to form a feature association network. Then, it performs community clustering on the association network, verifies and screens effective feature clusters through module degree change, assigns weights based on the signal-to-noise ratio, removes redundant features through recursive feature elimination, and finally outputs the optimized core feature set. The lesion localization and fusion feature construction module is used for precise lesion area localization and multi-dimensional feature fusion. It takes a feature core set and a multispectral image as dual inputs. It calculates the matching degree between pixels and normal vegetation feature templates, filters connected region morphology, and outputs a precise lesion area containing boundary coordinates, area, and morphological parameters. Then, it extracts the lesion area ROI, extracts color, texture, and morphological features to form a fused lesion feature set, and calculates the difference between the fused feature set and the standard sample in Mahalanobis distance, bidirectional Hausdorff distance, and topological skeleton parameters, providing a quantitative basis for identification and matching. The pest and disease identification, matching, and result output module is used to complete the final decision and result output based on the standard feature library. By constructing an AHP hierarchical structure, it calculates the fusion difference between the lesion to be detected and the standard sample and forms a matrix. It obtains secondary candidates through two rounds of screening and judges the distance between the secondary candidates and the existing category samples in the standard library based on K-means clustering, and completes the output of pest and disease detection results.

Citation Information

Cited By

  • Watermelon fusarium wilt identification method fusing leaf image features and storage medium

    CN122023997A