Method for judging disease grade of ear rot of fresh corn ears based on picture recognition
By preprocessing corn ear pictures and constructing a CNN-LSTM neural network model, the instability problem of disease level judgment in image recognition technology is solved, and accurate automatic identification and evaluation of fresh corn ear rot disease levels are achieved. , improving diagnostic efficiency and accuracy.
Patent Information
- Application Number
- CN202410699346.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing image recognition technology used to determine the disease level of fresh corn ear rot is unstable. It is affected by factors such as lighting conditions, shooting angles, and image clarity, resulting in poor accuracy of disease grading results.
By collecting and labeling pictures of fresh corn ears with symptoms of ear rot, the images are cropped, enhanced and normalized. Combined with the sliding filter window denoising technology, a CNN-LSTM combined neural network model is constructed to preprocess and train the images. Generate a disease grade judgment model.
It improves image quality, reduces noise, improves model training and testing effects, achieves accurate automatic identification and assessment of fresh corn ear rot disease levels, and improves diagnostic efficiency and accuracy.
Smart Images

Figure CN118570795A
Abstract
Description
Technical Field
[0001] The invention relates to the field of image recognition, and in particular to a method for judging the disease grade of ear rot of fresh corn based on image recognition. Background Art
[0002] Ear rot is an important disease that affects the yield and quality of fresh corn, and has a serious impact on farmers' economic benefits. Traditional methods for determining ear rot disease grade mainly rely on manual detection, which is inefficient and easily affected by subjective factors. With the development of image processing and machine learning technology, using image recognition technology for disease detection has become a new development direction.
[0003] The invention patent with application number CN202010330319.6 discloses a method, system and computer device for grading corn disease conditions, and the method includes: S1 obtaining normal corn leaf images and diseased corn leaf images; S2 building a disease classification neural network, using transfer learning to initialize the parameters of the convolution layer and the fully connected layer; S3 building an area segmentation neural network, using transfer learning to initialize the parameters of the first two layers of the network; S4 inputting the original image of the leaf to be detected into the corn disease classification neural network to obtain disease classification information; inputting the original image into the area segmentation neural network to obtain binary images of the diseased area and the main area of the leaf and calculating the area ratio of the diseased area; S5 grading the disease condition according to the disease classification information and the area ratio. It provides a method for automatically grading the common leaf diseases of corn based on pictures taken in real environments without picking corn leaves, laying the foundation for graded identification of corn diseases, especially early diagnosis and prediction and early warning. However, its neural network model is sensitive to the quality and interference of input data. In practical applications, factors such as lighting conditions, shooting angle, and image clarity may affect the model, leading to instability and poor accuracy of disease grading results.
[0004] Based on this, it is necessary to propose a more accurate method for determining the disease grade of ear rot of fresh corn. Summary of the invention
[0005] In order to overcome the deficiencies of the prior art, the object of the present invention is to provide a method for determining the disease grade of ear rot of fresh corn based on image recognition.
[0006] To achieve the above object, the present invention provides the following solutions:
[0007] A method for judging the disease grade of ear rot of fresh corn based on image recognition, comprising:
[0008] Collecting fresh corn ear images containing ear rot symptoms, and annotating each of the fresh corn ear images with a disease grade to obtain an annotated data set;
[0009] Performing image cropping, image enhancement and image normalization on the images in the labeled data set in sequence to obtain a preprocessed data set;
[0010] Perform sliding filter window denoising on the preprocessed data set to obtain a denoised data set;
[0011] The initial network is trained according to the denoised data set to obtain a trained disease level judgment model;
[0012] The disease level judgment model is used to judge the disease level of the image to be tested, and a disease level prediction result is obtained.
[0013] Preferably, performing sliding filter window denoising on the preprocessed data set to obtain a denoised data set includes:
[0014] Using a preset filter window to detect noise points on the image in the preprocessed data set to obtain a noise mean;
[0015] When the noise mean in the filtering window is greater than a preset threshold, denoising the image in the preprocessed data set in the corresponding filtering window;
[0016] Slide the filter window and return to the step of "using the preset filter window to detect noise points on the image in the preprocessed data set to obtain the noise mean" until the images in the entire preprocessed data set are traversed to obtain the denoised data set.
[0017] Preferably, using a preset filter window to detect noise points on the image in the preprocessed data set to obtain a noise mean value includes:
[0018] A noise point detection model is constructed based on the mean and median of each image point in the filtering window; the noise point detection model is: ; Where f(x) represents the similar noise value of pixel x, u(x) represents the gray value of pixel x, represents the mean gradient of pixel x, u mean (x) represents the grayscale mean of all pixels in the filter window centered on pixel x. represents the mean gradient of pixel x, is the grayscale median of all pixels in the filter window centered on pixel x, Represents the gradient value of pixel x in the horizontal direction. Represents the gradient value of pixel x in the vertical direction;
[0019] Detecting each image point in the filtering window using the noise point detection model to obtain a similar noise value for each image point;
[0020] The corresponding image points with a value greater than the similar noise value are regarded as noise points;
[0021] The noise mean is obtained according to the number of noise points and the number of each image point in the filter window.
[0022] Preferably, when the noise mean value in the filtering window is greater than a preset threshold, denoising the image in the preprocessed data set in the corresponding filtering window comprises:
[0023] The pseudo pixel variance is calculated according to the grayscale median of all pixels in the filter window; wherein the pseudo pixel variance calculation formula is: in, represents the pseudo pixel variance of the pixel point (a, b) in the area of the filter window with a size of (2n+1)×(2n+1), mean(a, b) represents the grayscale median of the pixel point (a, b) in the filter window, and x(k, l) represents the grayscale value of the pixel point at the position (k, l);
[0024] A window denoising model is constructed using the pseudo pixel variance; the formula of the window denoising model is: Among them, f(a,b) represents the gray value of the pixel (a,b) after denoising, D is the adjustable coefficient, and x(a,b) represents the gray value of the pixel (a,b) in the filter window.
[0025] Preferably, the adjustable coefficient is obtained by:
[0026] For each pixel, calculating the local variance of the grayscale value within the filtering window of the pixel;
[0027] For the entire image in the preprocessed data set, calculating the overall variance of the grayscale values of the image in the preprocessed data set;
[0028] The adjustable coefficient is calculated using the local variance and the overall variance; the calculation formula of the adjustable coefficient is: in, represents the overall variance, Denotes the local variance.
[0029] Preferably, the initial network is a CNN-LSTM combined neural network model; the CNN-LSTM combined neural network model includes a CNN subnetwork and an LSTM network connected to the CNN subnetwork.
[0030] Preferably, the CNN subnetwork includes two stacked convolutional layers, a ReLU activation function and a pooling layer arranged in sequence; the CNN neural network model is used to output feature-extracted data.
[0031] Preferably, the LSTM network is used to receive the data after feature extraction, and obtain the predicted disease level result through the LSTM unit update and transmission process and the linear layer conversion process.
[0032] According to the specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0033] The present invention provides a method for judging the disease grade of ear rot of fresh corn cobs based on image recognition, comprising: collecting pictures of fresh corn cobs containing symptoms of ear rot, and annotating the disease grade of each picture of the fresh corn cobs to obtain an annotated data set; performing image cropping, image enhancement and image normalization on the images in the annotated data set in sequence to obtain a preprocessed data set; performing sliding filter window denoising on the preprocessed data set to obtain a denoised data set; training an initial network according to the denoised data set to obtain a trained disease grade judgment model; using the disease grade judgment model to judge the disease grade of the image to be tested to obtain a disease grade prediction result. The present invention performs preprocessing operations such as cropping, enhancement and normalization on the image, which helps to improve the image quality and reduce noise, thereby improving the effect of subsequent processing and model training, and the use of sliding filter window denoising technology can effectively reduce the noise in the image and improve the quality of the image, which is conducive to the training and testing of subsequent models. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0035] Figure 1 A flow chart of a method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] Figure 1 A flow chart of a method provided by an embodiment of the present invention, such as Figure 1As shown, the present invention provides a method for judging the disease grade of ear rot of fresh corn based on image recognition, comprising:
[0039] Step 100: collecting fresh corn ear images containing ear rot symptoms, and annotating each of the fresh corn ear images with a disease grade to obtain an annotated data set;
[0040] Step 200: performing image cropping, image enhancement and image normalization on the images in the annotated data set in sequence to obtain a preprocessed data set;
[0041] Step 300: performing sliding filter window denoising on the preprocessed data set to obtain a denoised data set;
[0042] Step 400: training the initial network according to the denoised data set to obtain a trained disease level judgment model;
[0043] Step 500: Use the disease level judgment model to judge the disease level of the image to be tested, and obtain a disease level prediction result.
[0044] Specifically, this embodiment collects a large number of fresh corn ear pictures containing ear rot symptoms, and labels each picture to indicate its disease level, such as level 1, level 3, level 5, level 7, and level 9.
[0045] Furthermore, level 1 corresponds to a diseased area of 0% to 1% of the total area of the ear; level 3 corresponds to a diseased area of 2% to 10% of the total area of the ear; level 5 corresponds to a diseased area of 11% to 25% of the total area of the ear; level 7 corresponds to a diseased area of 26% to 50% of the total area of the ear; level 9 corresponds to a diseased area of 51% to 100% of the total area of the ear.
[0046] Optionally, the image preprocessing process of this embodiment includes:
[0047] 1. Image cropping: crop the corn ears in the image and remove the background.
[0048] 2. Image enhancement: enhance the image data by rotation, translation, scaling, etc. to increase the diversity of training data.
[0049] 3. Image normalization: Normalize the image to make the model input consistent.
[0050] Preferably, performing sliding filter window denoising on the preprocessed data set to obtain a denoised data set includes:
[0051] Using a preset filter window to detect noise points on the image in the preprocessed data set to obtain a noise mean;
[0052] When the noise mean in the filtering window is greater than a preset threshold, denoising the image in the preprocessed data set in the corresponding filtering window;
[0053] Slide the filter window and return to the step of "using the preset filter window to detect noise points on the image in the preprocessed data set to obtain the noise mean" until the images in the entire preprocessed data set are traversed to obtain the denoised data set.
[0054] Specifically, the present invention constructs a noise point detection model based on the mean, median and gradient mean of each image point in the filtering window, which can detect the difference between noise points and original pixel points from multiple aspects, thereby making the detection of noise points more accurate.
[0055] Preferably, using a preset filter window to detect noise points on the image in the preprocessed data set to obtain a noise mean value includes:
[0056] A noise point detection model is constructed based on the mean and median of each image point in the filtering window; the noise point detection model is: Among them, f(x) represents the similar noise value of pixel x, u(x) represents the gray value of pixel x, represents the mean gradient of pixel x, u mean (x) represents the grayscale mean of all pixels in the filter window centered on pixel x. represents the mean gradient of pixel x, is the grayscale median of all pixels in the filter window centered on pixel x, Represents the gradient value of pixel x in the horizontal direction. Represents the gradient value of pixel x in the vertical direction;
[0057] Detecting each image point in the filtering window using the noise point detection model to obtain a similar noise value for each image point;
[0058] The corresponding image points with a value greater than the similar noise value are regarded as noise points;
[0059] The noise mean is obtained according to the number of noise points and the number of each image point in the filter window.
[0060] Furthermore, the original filtering algorithm, such as the mean filtering algorithm, performs mean processing on the pixels in each neighborhood of the original image (regardless of whether there are noise points), so the processed image will become blurred. The present invention can find the noise points on the original image by using the noise point detection model, and then filter the corresponding noise points to smooth out the noise points in the image while maintaining the original pixel information of the original image. In the actual agricultural application link, the present invention can set the corresponding detection interval value according to the actual scenario.
[0061] Preferably, when the noise mean value in the filtering window is greater than a preset threshold, denoising the image in the preprocessed data set in the corresponding filtering window comprises:
[0062] The pseudo pixel variance is calculated according to the grayscale median of all pixels in the filter window; wherein the pseudo pixel variance calculation formula is: in, represents the pseudo pixel variance of the pixel point (a, b) in the area of the filter window with a size of (2n+1)×(2n+1), mean(a, b) represents the grayscale median of the pixel point (a, b) in the filter window, and x(k, l) represents the grayscale value of the pixel point at the position (k, l);
[0063] A window denoising model is constructed using the pseudo pixel variance; the formula of the window denoising model is: Among them, f(a,b) represents the gray value of the pixel (a,b) after denoising, D is the adjustable coefficient, and x(a,b) represents the gray value of the pixel (a,b) in the filter window.
[0064] Specifically, the present invention is based on a window denoising model. By denoising the image within the corresponding filter window, the problem of disappearance of certain characteristic gradients in the corn ear image caused by existing denoising methods (such as median filtering denoising, mean filtering denoising and wavelet denoising, etc.) can be alleviated. The original pixel information of the image can be retained to the greatest extent, thereby improving the image interpretation effect.
[0065] Preferably, the adjustable coefficient is obtained by:
[0066] For each pixel, calculating the local variance of the grayscale value within the filtering window of the pixel;
[0067] For the entire image in the preprocessed data set, calculating the overall variance of the grayscale values of the image in the preprocessed data set;
[0068] The adjustable coefficient is calculated using the local variance and the overall variance; the calculation formula of the adjustable coefficient is: in, represents the overall variance, Denotes the local variance.
[0069] Specifically, in this embodiment, an adjustable coefficient algorithm is applied, and by combining the local variance and the overall variance to calculate the adjustable coefficient, adaptive denoising can be performed on images in different regions, which can better preserve the image details and effectively reduce the impact of noise.
[0070] Furthermore, this embodiment uses the statistical information of local and overall variance to calculate the adjustable coefficient, so that the denoising algorithm can make corresponding processing adjustments according to the noise level of different regions, thereby improving the denoising effect and image quality. By comprehensively considering the local and overall variance, the instability of the denoising result caused by local noise fluctuations can be reduced. In this way, the denoising algorithm can be more stable and reliable in different image scenes.
[0071] In addition, this embodiment calculates the adjustable coefficient through a formula, avoiding the tedious process of manually adjusting the parameters, improving the automation and practicality of the algorithm, thus saving manpower and time costs.
[0072] Preferably, the initial network is a CNN-LSTM combined neural network model; the CNN-LSTM combined neural network model includes a CNN subnetwork and an LSTM network connected to the CNN subnetwork.
[0073] Preferably, the CNN subnetwork includes two stacked convolutional layers, a ReLU activation function and a pooling layer arranged in sequence; the CNN neural network model is used to output feature-extracted data.
[0074] Preferably, the LSTM network is used to receive the data after feature extraction, and obtain the predicted disease level result through the LSTM unit update and transmission process and the linear layer conversion process.
[0075] Specifically, in this embodiment, the convolutional neural network can be used to realize the intelligent prediction of the disease level of ear rot of fresh corn, and the convolutional neural network is trained through training data. This embodiment also tests the trained model on the test set to measure its performance on unseen data. The model effect is evaluated by indicators such as confusion matrix and accuracy. If the effect is not ideal, return to adjust the model and retrain.
[0076] As an optional implementation, this embodiment uses a camera or mobile device to take pictures of fresh corn ears, inputs the taken pictures into the model, and the model outputs the judgment result of the ear rot disease level; finally, the judgment result is displayed on the device screen, or the data is stored in a database for subsequent analysis.
[0077] During actual field use, the disease grade judgment results output by the model are verified, and feedback data is collected for further optimization of the model. Based on the performance of the model in actual application, continuous improvement and iteration are carried out.
[0078] The beneficial effects of the present invention are as follows:
[0079] (1) The present invention utilizes image processing and machine learning techniques to realize automatic recognition and evaluation of the disease stage of ear rot of fresh corn, thereby improving the efficiency and accuracy of diagnosis.
[0080] (2) The present invention constructs a rich annotated dataset by collecting and annotating a large number of corn ear images containing symptoms of ear rot, which can improve the generalization ability and accuracy of the model.
[0081] (3) The present invention performs preprocessing operations such as cropping, enhancement and normalization on the image, which can improve image quality and reduce noise, thereby improving the effect of subsequent processing and model training.
[0082] (4) The present invention adopts the sliding filter window denoising technology to effectively reduce the noise in the image and improve the image quality, which is beneficial to the subsequent model training and testing.
[0083] (5) The present invention uses a denoised data set to train the initial network, and can obtain a disease grade judgment model optimized for the task of identifying the disease grade of fresh corn ear rot, thereby improving the performance and accuracy of the model.
[0084] (6) The present invention uses a trained disease grade judgment model to judge the disease grade of the image to be tested, which can quickly and accurately predict the disease grade of the ear, and helps to take corresponding prevention and treatment measures in time to improve the yield and quality of crops.
[0085] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0086] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for judging the disease grade of ear rot of fresh corn based on image recognition, characterized in that: include: Collecting fresh corn ear images containing ear rot symptoms, and annotating each of the fresh corn ear images with a disease grade to obtain an annotated data set; Performing image cropping, image enhancement and image normalization on the images in the labeled data set in sequence to obtain a preprocessed data set; Perform sliding filter window denoising on the preprocessed data set to obtain a denoised data set; The initial network is trained according to the denoised data set to obtain a trained disease level judgment model; The disease level judgment model is used to judge the disease level of the image to be tested, and a disease level prediction result is obtained.
2. The method for judging the disease stage of fresh corn ear rot based on image recognition according to claim 1, characterized in that: The preprocessed data set is subjected to sliding filter window denoising to obtain a denoised data set, including: Using a preset filter window to detect noise points on the image in the preprocessed data set to obtain a noise mean; When the noise mean in the filtering window is greater than a preset threshold, denoising the image in the preprocessed data set in the corresponding filtering window; Slide the filter window and return to step "using the preset filter window to detect noise points on the image in the preprocessed data set to obtain the noise mean" until the images in the entire preprocessed data set are traversed to obtain the denoised data set.
3. The method for judging the disease stage of fresh corn ear rot based on image recognition according to claim 2 is characterized in that: Using a preset filter window to detect noise points on the image in the preprocessed data set to obtain a noise mean value includes: A noise point detection model is constructed based on the mean and median of each image point in the filter window; the noise point detection model is: Among them, f(x) represents the similar noise value of pixel x, u(x) represents the gray value of pixel x, represents the mean gradient of pixel x, u mean (x) represents the grayscale mean of all pixels in the filter window centered on pixel x. represents the mean gradient of pixel x, is the grayscale median of all pixels in the filter window centered on pixel x, Represents the gradient value of pixel x in the horizontal direction. Represents the gradient value of pixel x in the vertical direction; Detecting each image point in the filtering window using the noise point detection model to obtain a similar noise value for each image point; The corresponding image points with a value greater than the similar noise value are regarded as noise points; The noise mean is obtained according to the number of noise points and the number of each image point in the filter window.
4. The method for judging the disease stage of ear rot of fresh corn based on image recognition according to claim 3 is characterized in that: When the noise mean value in the filtering window is greater than a preset threshold, denoising the image in the preprocessed data set in the corresponding filtering window includes: The pseudo pixel variance is calculated according to the grayscale median of all pixels in the filter window; wherein the pseudo pixel variance calculation formula is: in, represents the pseudo pixel variance of the pixel point (a, b) in the area of the filter window with a size of (2n+1)×(2n+1), mean(a, b) represents the grayscale median of the pixel point (a, b) in the filter window, and x(k, l) represents the grayscale value of the pixel point at the position (k, l); A window denoising model is constructed using the pseudo pixel variance; the formula of the window denoising model is: Among them, f(a,b) represents the gray value of the pixel (a,b) after denoising, D is the adjustable coefficient, and x(a,b) represents the gray value of the pixel (a,b) in the filter window.
5. The method for judging the disease stage of ear rot of fresh corn based on image recognition according to claim 4, characterized in that: The method for obtaining the adjustable coefficient includes: For each pixel, calculating the local variance of the grayscale value within the filtering window of the pixel; For the entire image in the preprocessed data set, calculating the overall variance of the grayscale values of the image in the preprocessed data set; The adjustable coefficient is calculated using the local variance and the overall variance; the calculation formula of the adjustable coefficient is: in, represents the overall variance, Denotes the local variance.
6. The method for judging the disease grade of ear rot of fresh corn based on image recognition according to claim 1, characterized in that: The initial network is a CNN-LSTM combined neural network model; the CNN-LSTM combined neural network model includes a CNN subnetwork and an LSTM network connected to the CNN subnetwork.
7. The method for judging the disease stage of ear rot of fresh corn based on image recognition according to claim 6, characterized in that: The CNN subnetwork includes two stacked convolutional layers, a ReLU activation function and a pooling layer arranged in sequence; the CNN neural network model is used to output feature-extracted data.
8. The method for judging the disease grade of ear rot of fresh corn based on image recognition according to claim 7, characterized in that: The LSTM network is used to receive the data after feature extraction, and obtain the predicted disease level result through the LSTM unit update and transmission process and the linear layer conversion process.
