A machine vision intelligent diagnosis method for wheat canopy water loss

By optimizing the Otsu threshold segmentation algorithm and the improved deep forest model through HSV-bilateral filtering, combined with color space conversion and gray-level co-occurrence matrix method, the real-time and accurate diagnosis problem of wheat canopy water loss was solved, and efficient and accurate water monitoring was achieved.

CN120107656BActive Publication Date: 2025-09-12CHINA INST OF WATER RESOURCES & HYDROPOWER RES
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510102318.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-09-12
Estimated Expiration
2045-01-22

AI Technical Summary

Technical Problem

Existing technologies make it difficult to achieve real-time and accurate diagnosis of wheat canopy water loss, especially satellite remote sensing and drone spectral information collection, which have long cycles and high costs and cannot meet the needs of efficient and precise management of modern agriculture.

Method used

Wheat canopy images were segmented using the Otsu threshold segmentation algorithm optimized by HSV-bilateral filtering. The canopy phenotypic characteristics were extracted by combining color space conversion and gray-level co-occurrence matrix method. An improved deep forest model was used for training, and a multi-scale attention module and genetic algorithm were introduced to optimize the sliding window size and step size. A machine vision intelligent diagnosis model for wheat canopy water loss was constructed.

Benefits of technology

The accuracy and efficiency of wheat canopy water loss diagnosis were improved, the model structure was simplified, the dependence on large-scale training data was reduced, and the recognition performance and generalization ability of the model were enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120107656B_ABST
    Figure CN120107656B_ABST
Patent Text Reader

Abstract

The present invention discloses a machine vision intelligent diagnosis method for wheat canopy water loss, which includes the following steps: S1, collecting multiple wheat canopy images under suitable moisture, moderate drought and severe drought stress, and segmenting the wheat canopy images using an Otsu threshold segmentation algorithm optimized by HSV-bilateral filtering; S2, extracting canopy phenotypic features of the segmented wheat canopy images by combining color space conversion, statistical feature analysis and a gray-level co-occurrence matrix method, and using the canopy phenotypic features as a data set for model training; S3, training an improved deep forest model using the data set to obtain a machine vision intelligent diagnosis model for wheat canopy water loss; S4, obtaining a wheat canopy image to be classified, and obtaining the canopy phenotypic features using steps S1 to S2, and then inputting the canopy phenotypic features into the machine vision intelligent diagnosis model for classification to obtain the water loss type.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an intelligent recognition technology for agricultural drought conditions, and in particular to a machine vision intelligent diagnosis method for wheat canopy water deficiency. Background Art

[0002] With global climate change and the continued expansion of agricultural production, the rational use of agricultural water resources faces enormous challenges. Water shortages have become a key factor hindering sustainable agricultural development. As a major food crop, wheat requires a vital water supply during its growth. However, traditional wheat moisture monitoring methods have numerous shortcomings and are unable to meet the demands of efficient and precise management in modern agriculture.

[0003] With current technological developments, machine vision technology is increasingly being used in agriculture due to its non-destructive, efficient, and accurate characteristics. Machine vision diagnosis of crop drought conditions is rapidly developing. Currently, several approaches exist, but all have limitations. For example, while satellite remote sensing and drone-based spectral data collection can provide large-scale, high-precision crop information, they are limited by long satellite transit times, complex data processing procedures, and high operating costs, making them inadequate for real-time, rapid diagnosis.

[0004] Therefore, developing an efficient and accurate machine vision intelligent diagnosis method is of great significance for monitoring wheat canopy water loss. Summary of the Invention

[0005] In response to the above-mentioned deficiencies in the prior art, the present invention provides a machine vision intelligent diagnosis method for wheat canopy water loss, which solves the problem that remote sensing images are limited in acquisition and difficult to dynamically monitor and diagnose wheat drought in real time.

[0006] In order to achieve the above-mentioned object of the invention, the technical solution adopted by the present invention is:

[0007] A method for intelligent machine vision diagnosis of wheat canopy moisture loss is provided, which comprises the following steps:

[0008] S1. Collect multiple wheat canopy images under suitable water stress, moderate drought stress, and severe drought stress, and segment the wheat canopy images using the Otsu threshold segmentation algorithm optimized by HSV-bilateral filtering;

[0009] S2. The canopy phenotypic characteristics of the segmented wheat canopy images were extracted by combining color space conversion, statistical feature analysis, and gray-level co-occurrence matrix method, and used as the dataset for model training.

[0010] S3. Use the dataset to train the improved deep forest model to obtain a machine vision intelligent diagnosis model for wheat canopy water loss;

[0011] S4. Obtain a wheat canopy image to be classified, and obtain canopy phenotypic characteristics using steps S1 to S2. Then, input the image into a machine vision intelligent diagnosis model for classification to obtain the water deficiency type.

[0012] The improved deep forest model includes a multi-granularity scanning part, a multi-scale attention module and a cascade forest part connected in sequence.

[0013] The beneficial effects of the present invention are as follows: this scheme optimizes the Otsu threshold segmentation algorithm by combining the HSV-bilateral filtering algorithm for image segmentation, effectively separating the wheat canopy area from the background area, and ensuring the accuracy of subsequent analysis; adopts color space conversion, statistical feature analysis and gray-level co-occurrence matrix method to extract wheat phenotypic characteristics, so that the extracted wheat canopy characteristics are more comprehensive and accurate, and the recognition performance of the model is improved; adopts the improved deep forest model for recognition, further improving the recognition accuracy and generalization ability of the model, and greatly improving the accuracy and efficiency of image analysis and water loss diagnosis.

[0014] Furthermore, the method of using the dataset to train the improved deep forest model includes:

[0015] S31, dividing the data set into a training set and a test set, inputting the training set into the multi-granularity scanning part for multi-scale scanning to extract multi-granularity features, and splicing them in the horizontal direction to obtain a high-dimensional feature matrix;

[0016] S32. Input the high-dimensional feature matrix into the multi-scale attention module, perform horizontal pooling and vertical pooling on the high-dimensional feature matrix through the pooling layer, and then use the splicing layer to splice the two pooled features;

[0017] S33, input the spliced ​​features into the convolution layer for two-dimensional convolution operation, and then convert the features after the two-dimensional convolution operation into attention weights through the group normalization layer and the Sigmoid activation function in sequence;

[0018] S34, using a multi-branch convolution module of a multi-scale attention module to perform dimensionality reduction processing on the high-dimensional feature matrix to obtain a feature matrix after dimensionality reduction;

[0019] S35, fusing the feature matrix after dimensionality reduction with the attention weight to obtain a fused feature matrix corresponding to each canopy phenotypic feature;

[0020] S36. All fused feature matrices are used as inputs of the cascade forest of the deep forest, and trained through the random forest and the completely random forest of the first layer of the cascade forest;

[0021] S37: Test the generated deep forest using the test set and determine whether the test accuracy is lower than the accuracy of the previous layer. If so, proceed to step S39; otherwise, proceed to step S38.

[0022] S38, adding one layer to the cascade forest, and concatenating the output of the previous layer with the fused feature matrix as the input of the added layer, continuing training, and then returning to step S37;

[0023] S39. Complete model training and obtain a machine vision intelligent diagnosis model for wheat canopy moisture deficiency.

[0024] The beneficial effect of the above technical solution is that when faced with high-dimensional feature spaces, traditional deep forests may suffer from low training efficiency and overfitting due to interference from redundant and irrelevant features. To address these problems, this solution introduces an innovative high-performance multi-scale attention module into the traditional deep forest model, aiming to enhance the model's ability to focus on local important information. The high-performance multi-scale attention module can adaptively adjust the feature weights of different regions or granularities, fully utilize the sliding window size and step size of the multi-granularity scanning part, and automatically learn the importance of the input features. In this way, in the multi-level feature extraction process, it can highlight important features, suppress the interference of irrelevant information, and improve the performance of the overall model.

[0025] The core concept of Deep Forest is to automate feature learning and classification tasks by cascading and connecting multiple ensemble learners, such as random forests. This approach not only simplifies the model structure and reduces the reliance on large-scale training data, but also improves classification efficiency. The improved Deep Forest introduces a high-performance multi-scale attention module, enhancing its ability to focus on image classification features, thereby improving classification performance.

[0026] Furthermore, when performing multi-scale scanning, the method for obtaining the sliding window size and step size includes:

[0027] S311. Randomly generate several sliding window sizes and step lengths, take each sliding window size and step length as a chromosome, and use several chromosomes to form an initial population;

[0028] S312, evaluating the classification accuracy of individuals in the population on the validation set, and using it as the fitness value of the individual;

[0029] S313, using a roulette wheel selection method to select parent individuals, and randomly selecting two parent individuals from all parent individuals to perform a crossover operation;

[0030] S314: Randomly select an individual from the population to perform mutation operation, and then determine whether the iteration termination condition is met. If so, proceed to step S315; otherwise, return to step S312;

[0031] S315. Output the individual with the largest fitness value in the population as the sliding window size and step size.

[0032] The beneficial effects of the above technical solution are: the introduction of the genetic algorithm in this solution enables the optimization of hyperparameters such as the size and step size of the sliding window, which can further shorten the training time of the optimal model, further improve the recognition accuracy and generalization ability of the model, and greatly improve the efficiency of image analysis and water loss diagnosis.

[0033] Furthermore, the expressions of horizontal pooling and vertical pooling are:

[0034]

[0035] Among them, B h (c) and B v (c) are the average values ​​of the cth channel in the horizontal and vertical directions respectively; H and W are the height and width of the high-dimensional feature matrix respectively; c is the number of channels; w is the index in the horizontal direction; X h,w,c is the element of the high-dimensional feature matrix at the position of height h, width w, and channel c; σ1 is the Gaussian function in the horizontal direction width; e is the natural logarithm; σ2 is the Gaussian function in the vertical direction width.

[0036] Furthermore, the method for the group normalization layer to process the features after the two-dimensional convolution operation includes:

[0037] Compute the mean and variance of a high-dimensional feature matrix:

[0038]

[0039] Among them, X is the high-dimensional feature matrix; μ is the feature mean; σ t 2 is the characteristic variance; |·| is the absolute value;

[0040] According to the mean and variance, the features after the input two-dimensional convolution operation are normalized:

[0041]

[0042] in, is the normalized feature; y is the feature after two-dimensional convolution operation; X concat is the concatenated feature; K is the weight of the two-dimensional convolution kernel; K h and K w are the height and width of the two-dimensional convolution kernel respectively; i and j are variables; d is the channel index; C is the total number of channels.

[0043] Furthermore, the multi-branch convolution module performs dimensionality reduction processing on the high-dimensional feature matrix, including:

[0044] Use 1×1 convolution kernel K 1×1 , 3×3 convolution kernel K 3×3 and 5×5 convolution kernel K 5×5 Perform convolution operation on high-dimensional feature matrix:

[0045]

[0046]

[0047] Among them, K 1×1 is a 1×1 convolution kernel; K 3×3 is a 3×3 convolution kernel; K 5×5 is a 5×5 convolution kernel; X is a high-dimensional feature matrix; H and W are the height and width of the high-dimensional feature matrix respectively; c is the number of channels, are row index and column index respectively; d is the channel number index; C is the total number of channels;

[0048] Concatenate the feature matrices of different convolution kernels along the channel direction:

[0049] Y concat =Concat(Y 1×1 (h,w,c),Y 3×3 (h,w,c),Y 5×5 (h,w,c))

[0050] Among them, Y concat is the concatenated feature; Concat(·) is the concatenation function;

[0051] Use 1×1 convolution kernel to reduce the dimension of the concatenated features:

[0052]

[0053] Among them, Y residual is the feature matrix after dimensionality reduction; The number of channels for branch output; K is the channel number variable of the branch output; reduce To reduce the weight of the convolution kernel.

[0054] Furthermore, the Sigmoid activation function converts the normalized features into the expression of attention weight:

[0055]

[0056] in, is the normalized feature; is the attention weight; e is the natural logarithm.

[0057] Furthermore, the method for segmenting the wheat canopy image includes:

[0058] S11. Convert the wheat canopy image from RGB space to HSV space:

[0059]

[0060] V=max(R,G,B)

[0061] in, and V are the H, S, and V components of the wheat canopy image respectively; R, G, and B are the R, G, and B components of the wheat canopy image respectively; max and min are the maximum and minimum values ​​respectively;

[0062] S12. Use bilateral filtering algorithm to filter the image converted to HSV space:

[0063]

[0064] Among them, I p is the value of pixel p after filtering; S is the set of pixels in the filtering window; W p is the normalization coefficient; σ d is the spatial domain standard deviation; is the spatial domain Gaussian function; σ r is the standard deviation of the range; is the range Gaussian function; ‖pq‖ is the Euclidean distance between pixels p and q; I(p) and I(q) are the ranges of pixels p and q, respectively; exp(·) is the exponential function; ‖·‖ is the Euclidean distance;

[0065] S13, converting the filtered image into a grayscale image, counting the number of pixels at each grayscale level, and dividing the number of pixels at each grayscale level by the total number of pixels to obtain a normalized grayscale histogram;

[0066] S14. Use the Otsu algorithm to perform threshold segmentation on the grayscale histogram to obtain the segmented wheat canopy image.

[0067] Furthermore, step S2 further includes:

[0068] S21, converting the segmented wheat canopy image from RGB space to HSV space using color space conversion, traversing the R, G, B, and V channel values ​​of all pixels in the wheat canopy image respectively; and calculating the mean and variance of the four channels according to the pixel values ​​of the R, G, B, and V channels respectively;

[0069] S22, converting the segmented wheat canopy image into a grayscale image, and scanning the grayscale image by selecting a set pixel spacing and a set direction, counting the frequency of the preset pixel grayscale value at point (i, j) in the set direction, and generating a grayscale co-occurrence matrix;

[0070] S23, normalizing the frequencies of elements in a gray-level symbiosis matrix so that the sum of all elements in the gray-level symbiosis matrix is ​​1; the gray-level symbiosis matrix uses four-dimensional parameters of energy, uniformity, contrast, and correlation to represent the texture characteristics of wheat;

[0071] S24. Construct a feature vector as the canopy phenotypic feature based on the mean and variance of the four channels R, G, B and V and the energy, uniformity, contrast and correlation of the gray-level co-occurrence matrix:

[0072]

[0073] Among them, r mean is the R mean; r var is the R variance; g mean is the mean value of G; g var is the variance of G; b mean is the B mean; b var is the variance of B; v mean is the mean value of V; v var V is the variance; texture feature part: E is energy; U is uniformity, For contrast, For relevance.

[0074] The beneficial effects of the above technical solution are as follows: When processing wheat canopy images, this solution introduces the HSV color space. Before performing bilateral filtering on the image, the image is converted from RGB space to HSV space, fully utilizing the independence of the luminance and chrominance components in HSV space for optimization. The HSV color space can more intuitively reflect the color changes of the wheat canopy, especially in the case of water loss. By introducing the HSV color space, the algorithm can more specifically process the color information in the image, improving the accuracy of segmentation. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] Figure 1 Flowchart of the machine vision intelligent diagnosis method for wheat canopy water loss.

[0076] Figure 2 Schematic diagram of the multi-granularity scanning stage.

[0077] Figure 3 The principle block diagram of the multi-scale attention module.

[0078] Figure 4 This is the principle block diagram of the cascade forest stage. DETAILED DESCRIPTION

[0079] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.

[0080] refer to Figure 1 , Figure 1 The flowchart of the machine vision intelligent diagnosis method for wheat canopy moisture loss is shown; Figure 1 As shown, the method S includes steps S1 to S4.

[0081] In step S1, multiple wheat canopy images under suitable water stress, moderate drought stress, and severe drought stress are collected, and the wheat canopy images are segmented using the Otsu threshold segmentation algorithm optimized by HSV-bilateral filtering;

[0082] In one embodiment of the present invention, a method for segmenting a wheat canopy image includes:

[0083] S11. Convert the wheat canopy image from RGB space to HSV space:

[0084]

[0085] V=max(R,G,B)

[0086] in, and V are the H, S, and V components of the wheat canopy image respectively; R, G, and B are the R, G, and B components of the wheat canopy image respectively; max and min are the maximum and minimum values ​​respectively;

[0087] S12. Use bilateral filtering algorithm to filter the image converted to HSV space:

[0088]

[0089] Among them, I p is the value of pixel p after filtering; S is the set of pixels in the filtering window; W p is the normalization coefficient; σ d is the spatial domain standard deviation; is the spatial domain Gaussian function; σ r is the standard deviation of the range; is the range Gaussian function; ‖pq‖ is the Euclidean distance between pixels p and q; I(p) and I(q) are the ranges of pixels p and q, respectively; exp(·) is the exponential function; ‖·‖ is the Euclidean distance;

[0090] Using the above formula for filtering can smooth long-distance pixels and remove noise from pixels of different colors, weaken the smoothing effect of edge area pixels to retain the image edge, and achieve the best effect of noise reduction and edge preservation.

[0091] S13. Convert the filtered image into a grayscale image, count the number of pixels at each grayscale level, and divide the number of pixels at each grayscale level by the total number of pixels to obtain a normalized grayscale histogram; normalization formula:

[0092]

[0093] Among them, p i is the probability of gray level i, n i is the number of pixels at gray level i, and N is the total number of all pixels in the image.

[0094] S14. Use the Otsu algorithm to perform threshold segmentation on the grayscale histogram to obtain the segmented wheat canopy image. The detailed implementation process is as follows:

[0095] Assume that the grayscale level of the image ranges from 0 to L-1, record the image with grayscale value in the range of [0, T-1] as background, and the image with grayscale value in the range of [T, L-1] as foreground, then traverse all possible thresholds T, calculate the inter-class variance under different thresholds, select the threshold that maximizes the inter-class variance, and thus find the optimal threshold T.

[0096] Between-class variance formula:

[0097] σ 2 (T)=w1(T)·w2(T)·(μ1(T)-μ2(T)) 2

[0098] The background weight formula is:

[0099]

[0100] The background weight formula is:

[0101]

[0102] The formula for the average gray value of the background is:

[0103]

[0104] The formula for the average gray value of the background is:

[0105]

[0106] Among them, w1(T) is the background weight of the wheat canopy image, w2(T) is the foreground weight of the wheat canopy image, μ1(T) is the average gray value of the background of the wheat canopy image, and μ2(T) is the average gray value of the foreground of the wheat canopy image.

[0107] The grayscale histogram is binarized using the calculated threshold T, with the foreground area being white and the background area being black. The binarized image is then used as a mask to process the original RGB image (wheat canopy image). When the masked pixel value is 0, the corresponding pixel in the original RGB image is set to black; when the masked pixel value is 255, the corresponding pixel value in the original RGB image remains unchanged, thus preserving the foreground color and texture information.

[0108] This scheme uses the mask obtained by threshold segmentation to process the color image processed by the HSV-bilateral filtering algorithm, thereby extracting the target area that retains color and texture information and effectively completing the segmentation of foreground and background.

[0109] In step S2, the canopy phenotypic features of the segmented wheat canopy image are extracted by combining color space conversion, statistical feature analysis and gray-level co-occurrence matrix method, and used as the dataset for model training;

[0110] During implementation, the detailed implementation steps of the preferred step S2 of this solution are as follows:

[0111] S21, using color space conversion to convert the segmented wheat canopy image from RGB space to HSV space, respectively traverse the R, G, B and V channel values ​​of all pixels in the wheat canopy image; according to the pixel values ​​of the R, G, B and V channels, respectively calculate the four-channel mean μ td and variance σ td :

[0112]

[0113] Among them, I i is the value of the i-th pixel, N is the total number of pixels in the wheat canopy image; the mean represents the average distribution of image color, and the variance reflects the degree of discreteness of the image color distribution.

[0114] This scheme preferably selects channels (R, G, B, V) with a coefficient of variation greater than 10% to calculate their means and variances, which provides quantitative characteristics for the color distribution of wheat canopy images and reflects the overall characteristics of image colors and the degree of color variation.

[0115] S22, converting the segmented wheat canopy image into a grayscale image, and scanning the grayscale image at a set pixel spacing and set direction (0°, 45°, 90°, 135°), counting the frequency of the preset pixel grayscale value at point (i, j) in the set direction, and generating a grayscale co-occurrence matrix;

[0116] S23, normalizing the frequencies of elements in a gray-level symbiosis matrix so that the sum of all elements in the gray-level symbiosis matrix is ​​1; the gray-level symbiosis matrix uses four-dimensional parameters of energy, uniformity, contrast, and correlation to represent the texture characteristics of wheat;

[0117] The expressions of energy, uniformity, contrast and correlation are:

[0118]

[0119] Contrast=∑ i,j=0 (ij) 2 p(i, j),

[0120] Among them, Energy, Homogeneity, Contrast and Correlation are energy, homogeneity, contrast and correlation respectively; p(i, j) is the pixel value of point (i, j); u gm and σ gm 2 are the mean and standard deviation of the grayscale values, respectively.

[0121] S24. Construct a feature vector as the canopy phenotypic feature based on the mean and variance of the four channels R, G, B and V and the energy, uniformity, contrast and correlation of the gray-level co-occurrence matrix:

[0122]

[0123] Among them, r mean is the R mean; r var is the R variance; g mean is the mean value of G; g var is the variance of G; b mean is the B mean; b var is the variance of B; v mean is the mean value of V; v var V is the variance; texture feature part: E is energy; U is uniformity, For contrast, For relevance.

[0124] In step S3, the improved deep forest model is trained using the dataset to obtain a machine vision intelligent diagnosis model for wheat canopy moisture loss; the improved deep forest model includes a multi-granularity scanning part, a multi-scale attention module, and a cascade forest part connected in sequence. The schematic diagram of the multi-granularity scanning part can be referred to Figure 2 , the schematic diagram of the multi-scale attention module can be referred to Figure 3 , the schematic diagram of the cascade forest part can be referred to Figure 4 .

[0125] In one embodiment of the present invention, a method for training an improved deep forest model using a dataset includes:

[0126] S31, dividing the data set into a training set and a test set, inputting the training set into the multi-granularity scanning part for multi-scale scanning to extract multi-granularity features, and splicing them in the horizontal direction to obtain a high-dimensional feature matrix;

[0127] S32. Input the high-dimensional feature matrix into the multi-scale attention module, perform horizontal pooling and vertical pooling on the high-dimensional feature matrix through the pooling layer, and then use the splicing layer to splice the two pooled features;

[0128] During implementation, the preferred expressions for horizontal pooling and vertical pooling in this solution are:

[0129]

[0130] Among them, B h (c) and B v (c) are the average values ​​of the cth channel in the horizontal and vertical directions respectively; H and W are the height and width of the high-dimensional feature matrix respectively; c is the number of channels; w is the index in the horizontal direction; X h,w,c is the element of the high-dimensional feature matrix at the position of height h, width w, and channel c; σ1 is the Gaussian function in the horizontal direction width; e is the natural logarithm; σ2 is the Gaussian function in the vertical direction width.

[0131] S33, input the spliced ​​features into the convolution layer for two-dimensional convolution operation, and then convert the features after the two-dimensional convolution operation into attention weights through the group normalization layer and the Sigmoid activation function in sequence;

[0132] Among them, the method for the group normalization layer to process the features after the two-dimensional convolution operation includes:

[0133] Compute the mean and variance of a high-dimensional feature matrix:

[0134]

[0135] Among them, X is the high-dimensional feature matrix; μ is the feature mean; σ t 2 is the characteristic variance; |·| is the absolute value;

[0136] According to the mean and variance, the features after the input two-dimensional convolution operation are normalized:

[0137]

[0138] in, is the normalized feature; y is the feature after two-dimensional convolution operation; X concat is the concatenated feature; K is the weight of the two-dimensional convolution kernel; K h and K w are the height and width of the two-dimensional convolution kernel respectively; i and j are variables; d is the channel index; C is the total number of channels.

[0139] The Sigmoid activation function converts the normalized features into the expression of attention weight:

[0140]

[0141] in, is the normalized feature; is the attention weight; e is the natural logarithm.

[0142] S34. Use the multi-branch convolution module of the multi-scale attention module to reduce the dimensionality of the high-dimensional feature matrix to obtain the reduced-dimensional feature matrix:

[0143] Use 1×1 convolution kernel K 1×1 , 3×3 convolution kernel K 3×3 and 5×5 convolution kernel K 5×5 Perform convolution operation on high-dimensional feature matrix:

[0144]

[0145] Among them, K 1×1 is a 1×1 convolution kernel; K 3×3 is a 3×3 convolution kernel; K 5×5 is a 5×5 convolution kernel; X is a high-dimensional feature matrix; H and W are the height and width of the high-dimensional feature matrix respectively; c is the number of channels, are row index and column index respectively; d is the channel number index; C is the total number of channels;

[0146] Concatenate the feature matrices of different convolution kernels along the channel direction:

[0147] Y concat =Concat(Y1×1 (h,w,c),Y 3×3 (h,w,c),Y 5×5 (h,w,c))

[0148] Among them, Y concat is the concatenated feature; Concat(·) is the concatenation function;

[0149] Use 1×1 convolution kernel to reduce the dimension of the concatenated features:

[0150]

[0151] Among them, Y residual is the feature matrix after dimensionality reduction; The number of channels for branch output; K is the channel number variable of the branch output; reduce To reduce the weight of the convolution kernel.

[0152] S35, fusing the feature matrix after dimensionality reduction with the attention weight to obtain a fused feature matrix corresponding to each canopy phenotypic feature;

[0153] S36. All fused feature matrices are used as inputs of the cascade forest of the deep forest, and trained through the random forest and the completely random forest of the first layer of the cascade forest;

[0154] S37: Test the generated deep forest using the test set and determine whether the test accuracy is lower than the accuracy of the previous layer. If so, proceed to step S39; otherwise, proceed to step S38.

[0155] S38, adding one layer to the cascade forest, and concatenating the output of the previous layer with the fused feature matrix as the input of the added layer, continuing training, and then returning to step S37;

[0156] S39. Complete model training and obtain a machine vision intelligent diagnosis model for wheat canopy moisture deficiency.

[0157] In step S4, the wheat canopy image to be classified is obtained, and the canopy phenotypic characteristics are obtained using steps S1 to S2. The canopy phenotypic characteristics are then input into the machine vision intelligent diagnosis model for classification to obtain the water deficiency type (suitable water, moderate drought or severe drought).

[0158] In one embodiment of the present invention, when performing multi-scale scanning, a method for obtaining the sliding window size and step length includes:

[0159] S311. Randomly generate several sliding window sizes and step lengths, take each sliding window size and step length as a chromosome, and use several chromosomes to form an initial population;

[0160] S312, evaluating the classification accuracy of individuals in the population on the validation set, and using it as the fitness value of the individual;

[0161] S313, using a roulette wheel selection method to select parent individuals, and randomly selecting two parent individuals from all parent individuals to perform a crossover operation;

[0162] S314: Randomly select an individual from the population to perform mutation operation, and then determine whether the iteration termination condition is met. If so, proceed to step S315; otherwise, return to step S312;

[0163] S315. Output the individual with the largest fitness value in the population as the sliding window size and step size.

[0164] When the number of iterations is greater than or equal to a preset number of iterations (preferably 50 times) or the fitness value no longer increases significantly, it indicates that the iteration termination condition is met.

[0165] In summary, this scheme uses the improved deep forest model to classify wheat canopy images, which can improve the recognition accuracy and generalization ability of the model and greatly improve the efficiency of image analysis and water loss diagnosis.

Claims

1. A machine vision intelligent diagnosis method for wheat canopy water loss, characterized in that: Including steps: S1. Collect multiple wheat canopy images under suitable water stress, moderate drought stress, and severe drought stress, and segment the wheat canopy images using the Otsu threshold segmentation algorithm optimized by HSV-bilateral filtering; The methods for segmenting wheat canopy images include: S11. Convert the wheat canopy image from RGB space to HSV space: in, 、 and V are the H, S, and V components of the wheat canopy image, respectively; are the R, G, and B components of the wheat canopy image, respectively; max and min Take the maximum and minimum values ​​respectively; S12. Use bilateral filtering algorithm to filter the image converted to HSV space: , in, is the filtered pixel The value of is the set of pixels within the filter window; is the normalization coefficient; is the spatial domain standard deviation; is the Gaussian function in the spatial domain; is the standard deviation of the range; is the range Gaussian function; Pixels and The Euclidean distance between and Pixels p and pixels q The value range of is an exponential function; is the Euclidean distance; S13, converting the filtered image into a grayscale image, counting the number of pixels at each grayscale level, and dividing the number of pixels at each grayscale level by the total number of pixels to obtain a normalized grayscale histogram; S14, using the Otsu algorithm to perform threshold segmentation on the grayscale histogram to obtain the segmented wheat canopy image; S2, extracting canopy phenotypic features of the segmented wheat canopy image by combining color space conversion, statistical feature analysis, and gray-level co-occurrence matrix method, and using the extracted features as a dataset for model training; step S2 further includes: S21, converting the segmented wheat canopy image from RGB space to HSV space using color space conversion, traversing the R, G, B, and V channel values ​​of all pixels in the wheat canopy image respectively; and calculating the mean and variance of the four channels according to the pixel values ​​of the R, G, B, and V channels respectively; S22, converting the segmented wheat canopy image into a grayscale image, and scanning the grayscale image by selecting a set pixel spacing and a set direction, and counting the grayscale values ​​of the preset pixels in the set direction at point ( i , j ) to generate the gray-level co-occurrence matrix; S23, normalizing the frequencies of elements in a gray-level symbiosis matrix so that the sum of all elements in the gray-level symbiosis matrix is ​​1; the gray-level symbiosis matrix uses four-dimensional parameters of energy, uniformity, contrast, and correlation to represent the texture characteristics of wheat; S24. Construct a feature vector as the canopy phenotypic feature based on the mean and variance of the four channels R, G, B, and V and the energy, uniformity, contrast, and correlation of the gray-level co-occurrence matrix: in, is the R mean; is the R variance; is the G mean; is the G variance; is the B mean; is the variance of B; is the mean value of V; V is the variance; texture feature part: for energy; For uniformity, For contrast, For relevance; S3. Use the dataset to train the improved deep forest model to obtain a machine vision intelligent diagnosis model for wheat canopy water loss; S4. Obtain a wheat canopy image to be classified, and use steps S1 to S2 to obtain canopy phenotypic characteristics, which are then input into a machine vision intelligent diagnosis model for classification to obtain a water deficiency type; The improved deep forest model includes a multi-granularity scanning part, a multi-scale attention module and a cascade forest part connected in sequence.

2. The machine vision intelligent diagnosis method for wheat canopy moisture loss according to claim 1, characterized in that: Methods for training the improved deep forest model using datasets include: S31, dividing the data set into a training set and a test set, inputting the training set into the multi-granularity scanning part for multi-scale scanning to extract multi-granularity features, and splicing them in the horizontal direction to obtain a high-dimensional feature matrix; S32. Input the high-dimensional feature matrix into the multi-scale attention module, perform horizontal pooling and vertical pooling on the high-dimensional feature matrix through the pooling layer, and then use the splicing layer to splice the two pooled features; S33, input the spliced ​​features into the convolution layer for two-dimensional convolution operation, and then convert the features after the two-dimensional convolution operation into attention weights through the group normalization layer and the Sigmoid activation function in sequence; S34, using a multi-branch convolution module of a multi-scale attention module to perform dimensionality reduction processing on the high-dimensional feature matrix to obtain a feature matrix after dimensionality reduction; S35, fusing the feature matrix after dimensionality reduction with the attention weight to obtain a fused feature matrix corresponding to each canopy phenotypic feature; S36. All fused feature matrices are used as inputs of the cascade forest of the deep forest, and trained through the random forest and the completely random forest of the first layer of the cascade forest; S37: Test the generated deep forest using the test set and determine whether the test accuracy is lower than the accuracy of the previous layer. If so, proceed to step S39; otherwise, proceed to step S38. S38, adding one layer to the cascade forest, and concatenating the output of the previous layer with the fused feature matrix as the input of the added layer, continuing training, and then returning to step S37; S39. Complete model training and obtain a machine vision intelligent diagnosis model for wheat canopy moisture deficiency.

3. The machine vision intelligent diagnosis method for wheat canopy moisture loss according to claim 2, characterized in that: When performing multi-scale scanning, the methods for obtaining the sliding window size and step length include: S311. Randomly generate several sliding window sizes and step lengths, take each sliding window size and step length as a chromosome, and use several chromosomes to form an initial population; S312, evaluating the classification accuracy of individuals in the population on the validation set, and using it as the fitness value of the individual; S313, using a roulette wheel selection method to select parent individuals, and randomly selecting two parent individuals from all parent individuals to perform a crossover operation; S314: Randomly select an individual from the population to perform mutation operation, and then determine whether the iteration termination condition is met. If so, proceed to step S315; otherwise, return to step S312; S315. Output the individual with the largest fitness value in the population as the sliding window size and step size.

4. The machine vision intelligent diagnosis method for wheat canopy moisture loss according to claim 2, characterized in that: The expressions for horizontal pooling and vertical pooling are: , in, and Respectively c The average value of each channel in the horizontal and vertical directions; H and W are the height and width of the high-dimensional feature matrix respectively; c is the number of channels; w is the horizontal index; For a high-dimensional feature matrix with a height of h , width is w , channel is c Elements of position; is the Gaussian function in the horizontal direction width; e is the natural logarithm; is the Gaussian function in the vertical direction width.

5. The machine vision intelligent diagnosis method for wheat canopy moisture loss according to claim 2, characterized in that: The group normalization layer processes the features after the two-dimensional convolution operation in the following ways: Compute the mean and variance of a high-dimensional feature matrix: , in, X is a high-dimensional feature matrix; μ is the characteristic mean; is the characteristic variance; To take the absolute value; According to the mean and variance, the features after the input two-dimensional convolution operation are normalized: , in, is the normalized feature; y It is the feature after two-dimensional convolution operation; is the feature after splicing; K is the weight of the two-dimensional convolution kernel; and are the height and width of the two-dimensional convolution kernel respectively; i 、 j All are variables; d is the channel number index; C is the total number of channels.

6. The machine vision intelligent diagnosis method for wheat canopy moisture loss according to claim 2, characterized in that: The multi-branch convolution module performs dimensionality reduction on high-dimensional feature matrices in the following ways: Use 1×1 convolution kernel respectively , 3×3 convolution kernel and 5×5 convolution kernel Perform convolution operation on high-dimensional feature matrix: in, is a 1×1 convolution kernel; is a 3×3 convolution kernel; is a 5×5 convolution kernel; X is a high-dimensional feature matrix; H and W are the height and width of the high-dimensional feature matrix respectively; c is the number of channels, and are row and column indices respectively; d is the channel number index; C is the total number of channels; Concatenate the feature matrices of different convolution kernels along the channel direction: in, is the feature after splicing; is the splicing function; Use 1×1 convolution kernel to reduce the dimension of the concatenated features: in, is the feature matrix after dimensionality reduction; The number of channels for branch output; The variable for the number of channels output by the branch; To reduce the weight of the convolution kernel.

7. The machine vision intelligent diagnosis method for wheat canopy moisture loss according to claim 2, characterized in that: The Sigmoid activation function converts the normalized features into the expression of attention weight: in, is the normalized feature; is the attention weight; e is the natural logarithm.

Citation Information

Patent Citations

  • Wheat plant nitrogen content estimation method based on unmanned aerial vehicle image fusion characteristics

    CN112418073A

  • Strong pulsed light skin beauty local area identification method and system

    CN119339149A