A method, device and storage medium for identifying crop leaf diseases
By segmenting crop leaf lesions using semantic segmentation and image enhancement techniques, a lesion dataset was established and classification training was conducted. This solved the problems of accuracy and efficiency in identifying crop leaf diseases in complex backgrounds, and achieved efficient and automated identification.
Patent Information
- Application Number
- CN202110419951.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-19
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2041-04-19
AI Technical Summary
Existing technologies struggle to accurately identify crop leaf diseases in complex environments, making manual identification time-consuming, labor-intensive, and with low accuracy.
A pre-defined semantic segmentation model is used to segment crop leaf images. By combining image enhancement and color space conversion techniques, lesions are segmented, a lesion image dataset is established, and disease identification is performed using lesion feature vectors and a classifier.
It improves the accuracy of crop leaf disease identification, reduces the labor intensity of manual identification, and achieves high-precision disease identification in complex backgrounds.
Smart Images

Figure CN113269191B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of agricultural disease identification, and in particular to a crop leaf disease identification method, device and storage medium. Background Art
[0002] During the growth of crops, various diseases may occur, which seriously affect the yield and quality of crops and pose a certain threat to food safety. In the case of large-scale planting, relying solely on manual identification of diseases will be time-consuming and laborious, and it is impossible to detect and prevent the development of the disease in time. The technical methods currently used are all aimed at studying and testing the characteristics of lesions on independent leaves picked manually. For example, individual leaves are spread in a single color and the background is not disturbed. Under ideal conditions, however, in real scenes such as the actual planting environment of crops, the original leaf image obtained during monitoring cannot be a single leaf. It is generally multiple leaves in different postures and contains other complex backgrounds, which makes it difficult to segment the leaf and its lesion image, making the subsequent feature extraction method ineffective. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method, device and storage medium for identifying crop leaf diseases in view of the above problems, accurately segment crop leaves under complex backgrounds, and classify and train a classifier through disease spot feature vectors and disease type labels to realize disease identification, thereby avoiding the use of manual identification, greatly reducing labor rates and improving identification accuracy.
[0004] The technical solution of the present invention to solve the above technical problem is as follows: a method for identifying crop leaf diseases, the method comprising:
[0005] The preset semantic segmentation model is used to segment the crop leaf images under the real background to obtain the images of each leaf;
[0006] Performing disease spot segmentation on each leaf image according to image enhancement technology and color space conversion technology to obtain each disease spot image;
[0007] Setting a disease type label for each lesion image and establishing a data set for each lesion image;
[0008] Extracting a lesion feature vector of a lesion image in the lesion image data set;
[0009] Performing classification training on a classifier according to the disease spot feature vector and the disease type label corresponding to the disease spot image data set;
[0010] Crop leaf diseases can be identified based on the trained classifier.
[0011] The beneficial effects of the present invention are as follows: the semantic segmentation module is used to segment the crop leaves under the complex background with high segmentation accuracy, which solves the problem of extracting the crop leaf images under the complex background; the local contrast enhancement and color space conversion technology are used to effectively segment the disease spot images, a disease spot image data set is established, and the disease spot feature vectors corresponding to the disease spot image data set are calculated according to the disease spot type, the characteristics of various different diseases are subdivided and fully covered, and the classifier is trained through the disease spot feature vector and the disease type label to realize the recognition of the disease, avoiding the use of manual recognition, greatly reducing the labor rate, and improving the recognition accuracy.
[0012] On the basis of the above technical solution, the present invention can also be improved as follows:
[0013] Furthermore, the method of using a preset semantic segmentation model to segment the crop leaf images under the real background to obtain each leaf image includes:
[0014] Acquire crop leaf images under real background through on-site shooting;
[0015] Performing data enhancement processing on the crop leaf images to obtain an expanded data set, and dividing the data set into a training set, a validation set, and a test set;
[0016] The crop leaf regions in the training set and the validation set are marked as 1, the background regions are marked as 0, and the marked images are converted into files conforming to the format of the semantic segmentation model;
[0017] The semantic segmentation model is trained according to the training set and the file to obtain the preset semantic segmentation model.
[0018] The beneficial effects of adopting the above further scheme are: by performing data enhancement processing on crop leaf images under real backgrounds, the diversity of images is enhanced, and the accuracy and robustness of subsequent model training are improved; at the same time, the leaves of agricultural objects and the background are labeled to ensure the accuracy of semantic segmentation model training.
[0019] Furthermore, the preset semantic segmentation model includes a Deeplab v3+ model.
[0020] The beneficial effect of adopting the above further solution is that the Deeplab v3+ model further integrates the underlying features with the high-level features to improve the accuracy of the segmentation boundary.
[0021] Furthermore, the preset semantic segmentation model is used to segment the crop leaf images under the real background, and each leaf image is obtained including:
[0022] Inputting the test set into the preset semantic segmentation model to obtain a mask image in which the leaf and background are segmented;
[0023] The mask image is flipped to obtain a binary image with a background area pixel grayscale value of 0 and a leaf area pixel grayscale value of 255, and then the binary image is added to the image of the test set to obtain each leaf image after removing the background.
[0024] The beneficial effect of adopting the above further scheme is: by inverting the mask image after the leaf and background segmentation, the background area and the leaf area can be better distinguished, and then by adding it to the original image, the leaf image after the background is removed can be clearly and effectively obtained.
[0025] Further, the lesion segmentation is performed on each leaf image according to the image enhancement operation and the color space conversion operation to obtain each lesion image, including:
[0026] Obtaining a local mean value and a standard deviation of the leaf image within a local window size;
[0027] Determine an image of the leaf image after local contrast enhancement according to the local mean value and the standard deviation;
[0028] Performing color space conversion on the complement image of the image after local contrast enhancement, from an RGB image to a Lab image, and dividing the Lab image into three color component images of L, a, and b;
[0029] Select the b component image, calculate the average pixel value of the b component image, set the pixels whose b component pixel value is greater than the average pixel value to 0, and the rest to 1, to obtain a preliminary lesion image;
[0030] Morphological operations are performed on the preliminary lesion image to obtain each lesion image.
[0031] The beneficial effect of adopting the above further scheme is: by performing local contrast enhancement processing on the leaf image and then performing image color space conversion, the leaf image is divided into three color component images of L, a, and b, the lesions are extracted through the b component image, the lesion image is determined through morphological operations, and the lesion image is accurately and effectively segmented.
[0032] Further, setting a disease type label for each lesion image and establishing each lesion image data set includes:
[0033] According to the expert database of crop leaf disease types, the disease type of the lesion image is annotated and the disease type label is set;
[0034] Each lesion image is classified according to the disease type, and a lesion image dataset of different disease types is established.
[0035] The beneficial effect of adopting the above further scheme is: by labeling the disease category of the lesion images, a large number of lesion images are generated into a collection according to the disease type, so that the image sets that have been given classification labels can be used to calculate their feature vectors and classify them according to the classification to achieve disease recognition.
[0036] Further, the extracting of the lesion feature vector of the lesion image in the lesion image data set includes:
[0037] Calculating eigenvalues of texture statistical features of the run-length matrix of the lesion image, and using a vector formed by the eigenvalues as a first eigenvector;
[0038] The lesion image is trained by x times of 3*3 convolution, y times of 1*1 convolution and x times of maximum pooling to obtain a second eigenvector, where x, y and z are positive integers;
[0039] The first feature vector and the second feature vector are concatenated to obtain the lesion feature vector.
[0040] The beneficial effect of adopting the above further scheme is: first manually extract the lesions according to the texture features of the lesions, then extract the features of the data of the lesion image through 3*3 convolution and 1*1 convolution, generate a feature map, reduce the size of the feature map through maximum pooling, thereby reducing the amount of parameter data and network calculation, and complete the automatic extraction of features. By manually and automatically extracting the feature information of the lesions, the amount of information is large, which is conducive to the subdivision and full coverage of the features of various different diseases.
[0041] Further, the classifying training of the classifier according to the disease type label corresponding to the disease spot feature vector and the disease spot image data set includes:
[0042] The lesion feature vector is input into a fully connected layer, and the data output by the fully connected layer and the disease type label are input into the classifier for training, and the classifier is a softmax classifier.
[0043] The beneficial effect of adopting the above further scheme is: according to the obtained feature vector and the known classification category after the full connection layer, the classifier is used to complete the model training to realize the identification of the disease, avoiding the use of manual identification, greatly reducing the labor rate and improving the recognition accuracy.
[0044] In order to solve the above technical problems, the present invention also provides a crop leaf disease identification device, the crop leaf disease identification device comprises: a processor and a memory;
[0045] The processor is used to execute one or more computer programs stored in the memory to implement the steps of the crop leaf disease identification method as described above.
[0046] In order to solve the above technical problems, the present invention also provides a storage medium, characterized in that the storage medium stores one or more computer programs, and the one or more computer programs can be executed by one or more processors to implement the steps of the crop leaf disease identification method as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 A flow chart of a crop leaf disease identification method provided by an embodiment of the present invention;
[0048] Figure 2 A leaf diagram of a potato growth environment provided by an embodiment of the present invention;
[0049] Figure 3 A schematic diagram of a single potato leaf mask provided by an embodiment of the present invention;
[0050] Figure 4 A schematic diagram of a potato leaf obtained by segmentation provided by an embodiment of the present invention;
[0051] Figure 5 A schematic diagram of a leaf spot extracted according to an embodiment of the present invention;
[0052] Figure 6 A schematic diagram of a disease identification result provided by an embodiment of the present invention;
[0053] Figure 7 This is a diagram showing the implementation effect of a crop leaf disease identification method provided by one embodiment of the present invention. DETAILED DESCRIPTION
[0054] The principles and features of the present invention are described below in conjunction with the accompanying drawings. The examples given are only used to explain the present invention and are not used to limit the scope of the present invention.
[0055] like Figure 1 As shown, Figure 1 A flow chart of a crop leaf disease identification method provided by an embodiment of the present invention, the crop leaf disease identification method comprising:
[0056] S1. Segment the crop leaf image under the real background using a preset semantic segmentation model to obtain each leaf image;
[0057] S2. Segmenting the lesion on each leaf image according to the image enhancement technology and the color space conversion technology to obtain each lesion image;
[0058] S3, setting a disease type label for each lesion image, and establishing a data set for each lesion image;
[0059] S4, extracting the lesion feature vector of the lesion image in the lesion image dataset;
[0060] S5, performing classification training on a classifier according to the disease spot feature vector and the disease type label corresponding to the disease spot image data set;
[0061] S6. Identify crop leaf diseases based on the trained classifier.
[0062] In this embodiment, the semantic segmentation module is used to segment the crop leaves under the complex background with high segmentation accuracy, which solves the problem of extracting the crop leaf images under the complex background. The local contrast enhancement and color space conversion technology are used to effectively segment the disease spot image, and a disease spot image data set is established. The disease spot feature vectors corresponding to the disease spot image data set are calculated according to the disease spot type, and the characteristics of various different diseases are subdivided and fully covered. The classifier is trained through the disease spot feature vector and the disease type label to realize the recognition of the disease, avoiding the use of manual recognition, greatly reducing the labor rate, and improving the recognition accuracy.
[0063] In this embodiment, the crop leaf image under the real background refers to an image captured by an on-site camera or camera in the farmland, including the crop leaves and the background in which the leaves are located, that is, non-picked independent leaves; wherein the crop leaf image under the real background includes images of healthy crop leaves and images of leaves with disease spots, and the crops include but are not limited to potatoes, cucumbers, corn, etc.
[0064] It can be understood that the semantic segmentation model refers to labeling each pixel of the image with a corresponding category without distinguishing individuals; this embodiment uses the semantic segmentation model to segment the leaves and the background. Specifically, the training of the semantic segmentation model needs to be completed in advance, and before S1, it also includes:
[0065] S01. Acquire crop leaf images under real background by on-site shooting;
[0066] S02, performing a data enhancement operation on the crop leaf image to obtain an expanded data set, and dividing the data set into a training set, a validation set, and a test set;
[0067] S03, marking the area of the crop leaves in the training set and the validation set as 1, marking the background area as 0, and converting the marked images into files that conform to the format of the semantic segmentation model;
[0068] S04. Train the semantic segmentation model according to the training set and the file to obtain the preset semantic segmentation model.
[0069] In this embodiment, data enhancement processing is performed on the crop leaf image to expand the image to obtain a data set, thereby ensuring the diversity of the data set; wherein the data enhancement processing includes image flipping, rotation, translation, brightness adjustment, chroma adjustment and contrast adjustment; wherein flipping can be horizontal and vertical flipping of the crop leaf image, and rotation can be random rotation of the crop leaf image at a certain angle, such as 60°, 90° or 180° rotation of the image; rotation and translation translate the image in a certain manner on the image plane; the translation range and translation step can be specified in a random or manually defined manner, and the image content is translated in the horizontal or vertical direction to change the position of the image content; brightness adjustment is to keep the saturation S and hue H unchanged in the HSV color space of the image and change the brightness V component; chroma adjustment is to keep the saturation S and brightness V unchanged and change the hue H component; contrast adjustment is to change the saturation S and brightness V components in the HSV color space of the image, keep the hue H unchanged, and perform exponential operation (the exponential factor is between 0.25 and 4) on the S and V components of each pixel to increase the illumination change. After the data set is passed, it is divided into training set, validation set and test set in a certain ratio, for example, in a ratio of 3:1:1, or in a ratio of 4:2:1.
[0070] The leaves in the training set and the validation set include both healthy leaves and leaves with various diseased spots. The area of the crop leaves in the training set and the validation set is marked as 1, and the background area is marked as 0. Since the images need to be labeled, the labeled images need to be converted into files that conform to the format of the semantic segmentation model, and then the relevant parameters of the semantic segmentation model are set, and the training of the semantic segmentation model is completed through the training set and the file.
[0071] Preferably, in this embodiment, the Deeplab v3+ model is used as the semantic segmentation model, and Xception-65 is specifically selected as the backbone network in the Deeplab v3+ semantic segmentation model, and the model training is completed through operations such as feature extraction and feature compression.
[0072] In this embodiment, S1 specifically includes:
[0073] S11, inputting the test set into the preset semantic segmentation model to obtain a mask image in which the leaf and background are segmented;
[0074] S12, flipping the mask image to obtain a binary image with a background area pixel grayscale value of 0 and a leaf area pixel grayscale value of 255, and then adding the binary image to the image of the test set to obtain each leaf image after removing the background.
[0075] like Figure 2As shown in , the test image of the test set is a potato leaf image with disease spots under a real background. The mask image of the background and potato leaf segmentation is obtained by the preset semantic segmentation model, and the inversion operation is performed, as shown in Figure 3 As shown, the pixel value of the background area of the image is 0, and the pixel value of the leaf area is 255. Figure 3 and Figure 2 The addition operation obtains the leaf image separated from the background, such as Figure 4 shown.
[0076] It is worth noting that in this embodiment, S2 includes:
[0077] S21, obtaining the local mean value and standard deviation of the leaf image within the local window size;
[0078] S22, determining an image of the leaf image after local contrast enhancement according to the local mean value and the standard deviation;
[0079] S23, performing color space conversion on the complement image of the image after local contrast enhancement, from an RGB image to a Lab image, and further dividing the Lab image into three color component images of L, a, and b;
[0080] S24, selecting a b component image, calculating an average pixel value of the b component image, setting pixels whose b component pixel values are greater than the average pixel value to 0, and setting the rest to 1, to obtain a preliminary lesion image;
[0081] S25, performing morphological operations on the preliminary lesion image to obtain each lesion image.
[0082] Specifically, the image enhancement operation includes: setting the leaf image to w(u,v), and performing local contrast enhancement on the image, which requires the following formula:
[0083]
[0084]
[0085]
[0086] C(u,v)=1-P(G(u,v))
[0087] Where n is the local window size in pixels; m(u,v) and σ represent the local mean and standard deviation of the image in the n×n window, respectively; μ represents the global mean of the image w(u,v), β represents the parameter value in the interval [0,1], preferably, β=0.2; G(u,v) is the image after local contrast enhancement of w(u,v); C(u,v) is the complement of the image G(u,v);
[0088] Then, the image color space conversion operation includes: converting the obtained C(u,v) image into a Lab image by color space conversion, and further dividing the Lab image into three color component images: L (illuminance), a (range from red to green), and b (range from blue to yellow); since the color of the lesion is in the range from blue to yellow, the b component image is selected, and the obtained binary image of the b color component is segmented into a preliminary lesion image on the leaf by pixel definition. Since there may be small isolated spots around the obtained lesion outline, the preliminary lesion image is binarized and erosion and dilation operations are performed to obtain a continuous lesion outline. The result is shown in the figure. Figure 5 shown.
[0089] In this embodiment, S3 specifically includes: according to the crop leaf disease type expert database, the disease type of the disease spot image is marked, and the disease type label is set; wherein the crop leaf disease type expert database stores the corresponding relationship between the presentation characteristics of different crop disease spot images and the disease type, for example, the presentation characteristics of potato early blight are some scattered brown spots in the early stage, which then expand and become irregular, concentric rings, and surrounded by narrow faded rings; the presentation characteristics of potato anthracnose are that the leaf color becomes lighter in the early stage, the top leaves curl slightly, and then the whole plant wilts, turns brown and dies; the presentation characteristics of cucumber downy mildew are that round bright yellow spots appear on the front of the cotyledons, reaching a peak in the peak period of cucumber. The leaves initially have water-soaked spots, which then expand and connect into large spots. In severe cases, the diseased leaves curl and become yellow-brown and dry, and the spots on the back of the leaves grow dense purple-gray to purple-black mold. According to the expert database of crop leaf disease types, the disease type labels of the lesion images are given. After marking which type of disease each lesion image belongs to, each lesion image is classified according to the disease type, and a lesion image dataset of different disease types is established.
[0090] It is understandable that lesions of different disease types have different characteristics. Automatic identification of disease types is based on lesion characteristics. In this embodiment, in the established lesion image data set of known disease types, lesion characteristics are extracted for each lesion and then classified for training.
[0091] Specifically, step S4 specifically includes:
[0092] S41, calculating the eigenvalues of the texture statistical features of the run-length matrix of the lesion image, and taking the vector formed by the eigenvalues as the first eigenvector;
[0093] S42, training the lesion image by x times of 3*3 convolution, y times of 1*1 convolution and z times of maximum pooling to obtain a second feature vector, where x, y and z are positive integers;
[0094] S43, concatenating the first feature vector and the second feature vector to obtain the lesion feature vector.
[0095] In this embodiment, the texture statistical features of the run matrix include short run advantage (SRE), long run advantage (LRE), gray level non-uniformity (GLN), long run non-uniformity (RLN), run percentage (RP), low gray level run advantage (LGLRE), high gray level run advantage (HGLRE), short run low gray level advantage (SRLGLE), short run high gray level advantage (SRHGLE), long run low gray level advantage (LRLGLE) and long run high gray level advantage (LRHGLE):
[0096]
[0097]
[0098]
[0099]
[0100]
[0101]
[0102]
[0103]
[0104]
[0105]
[0106]
[0107] Where i represents the pixel value, j represents the number of consecutive neighbors, θ represents the direction, p(i,j|θ) represents the probability of j consecutive i values in the θ direction, and Np is the number of elements in the grayscale run matrix.
[0108] Preferably, θ is taken as 0 degrees, 45 degrees, 90 degrees and 135 degrees in turn, and is substituted into the above 11 characteristic calculation formulas respectively, 44 eigenvalues are calculated, and the vector composed of these 44 eigenvalues is recorded as the first eigenvector M.
[0109] The lesion image is trained by x times of 3*3 convolution, y times of 1*1 convolution and z times of maximum pooling to complete automatic feature extraction, and the constructed feature vector is recorded as the second feature vector N. Preferably, the lesion image is trained by 7 times of 3*3 convolution, 1 time of 1*1 convolution and 3 times of maximum pooling to obtain a more miniaturized second feature vector; in other embodiments, the lesion image can also be trained by 5 times of 3*3 convolution, 1 time of 1*1 convolution and 2 times of maximum pooling; the features of the data are extracted by 3*3 convolution and 1*1 convolution to generate a feature map, and the size of the feature map is reduced by maximum pooling, thereby reducing the amount of parameter data and network calculation, and completing the automatic feature extraction; the feature vectors M and N are spliced to obtain a one-dimensional feature vector X, which is recorded as the extracted lesion feature vector.
[0110] In this embodiment, step S5 specifically includes: inputting the disease spot feature vector into the fully connected layer, and inputting the data output by the fully connected layer and the disease type label into the classifier for training. Preferably, the classifier is a softmax classifier, and then the crop leaf disease recognition is realized according to the trained classifier, such as extracting Figure 5 The disease feature vector in is sent to the trained softmax classifier to complete the disease identification. The result is as follows Figure 6 As shown, the identification result is late blight.
[0111] For ease of understanding, the effectiveness of the present invention is further described below in conjunction with an example of potato lesion segmentation in the context of a potato growth environment:
[0112] In order to avoid loss of generality, potato leaf images with other diseases under complex backgrounds (i.e., non-picked diseased leaves are placed on a pure color background for identification) are selected. First, the data preparation before semantic segmentation model training is completed according to steps S01 to S03, and then the semantic segmentation model training is performed according to S03. The present invention preferentially uses the Deeplab v3+ model, selects Xception-65 as the backbone network in the Deeplab v3+ semantic segmentation model, and completes the model training through operations such as feature extraction and feature compression to obtain the model weight. The test image is passed through S11 to obtain a mask image of the background and potato leaf segmentation, wherein the pixel value of the image background area is 0 and the pixel value of the leaf area is 255, and further through S12 to obtain the segmented potato leaf image. Further, it is necessary to extract the diseased spots on the segmented leaves. After S2, the segmented potato leaf image is subjected to local contrast enhancement and color space conversion operations, and the obtained binary image of the b color component is segmented to obtain the diseased spots on the leaves through pixel definition, and the noise is removed through morphological operations to extract the potato diseased spots. The label setting of the lesion image was completed according to the S3 potato leaf disease expert database, and the lesion dataset was established. Then, the feature vector was extracted using the S4 manual and automatic methods. Finally, the feature vector was sent to the softmax classifier to complete the disease identification according to the deep learning method. The results are shown in the figure below. Figure 7 As shown, the identification result is early blight.
[0113] Example 2
[0114] This embodiment provides a crop leaf disease identification device, the crop leaf disease identification device comprising: a processor and a memory;
[0115] The processor is used to execute one or more computer programs stored in the memory to implement the steps of the crop leaf disease identification method as described in the above embodiment, which will not be repeated here.
[0116] This embodiment also provides a computer-readable storage medium, which stores one or more computer programs. The one or more computer programs can be executed by one or more processors to implement the steps of the crop leaf disease identification method described in the above embodiment, which will not be repeated here one by one.
[0117] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0118] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0119] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0120] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0122] The technical solutions provided by the embodiments of the present invention are introduced in detail above. Specific examples are used in this patent to illustrate the principles and implementation methods of the embodiments of the present invention. The description of the above embodiments is only applicable to help understand the principles of the embodiments of the present invention. The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for identifying crop leaf diseases, characterized in that: The crop leaf disease identification method comprises: The preset semantic segmentation model is used to segment the crop leaf images under the real background to obtain the images of each leaf; The lesion spots of each leaf image are segmented according to the image enhancement technology and the color space conversion technology to obtain each lesion spot image, including: Obtaining a local mean value and a standard deviation of the leaf image within a local window size; Determine an image of the leaf image after local contrast enhancement according to the local mean value and the standard deviation; Performing color space conversion on the complement image of the image after local contrast enhancement, from an RGB image to a Lab image, and dividing the Lab image into three color component images of L, a, and b; Select the b-component image, calculate the average pixel value of the b-component image, set the pixels whose b-component pixel values are greater than the average pixel value to 0, and the rest to 1, to obtain a preliminary lesion image; Performing morphological operations on the preliminary lesion image to obtain each lesion image; Setting a disease type label for each lesion image and establishing a data set for each lesion image; Extracting a lesion feature vector of a lesion image in the lesion image data set; Performing classification training on a classifier according to the disease spot feature vector and the disease type label corresponding to the disease spot image data set; Identify crop leaf diseases based on the trained classifier; The step of setting a disease type label for each lesion image and establishing each lesion image data set comprises: According to the expert database of crop leaf disease types, the disease type of the lesion image is marked and a disease type label is set; Classify each lesion image according to the disease type and establish a lesion image dataset of different disease types; The step of extracting the lesion feature vector of the lesion image in the lesion image dataset comprises: Calculating eigenvalues of texture statistical features of the lesion image, and using a vector formed by the eigenvalues as a first eigenvector; The lesion image is trained by x times of 3*3 convolution, y times of 1*1 convolution and z times of maximum pooling to obtain a second feature vector, where x, y and z are positive integers; Concatenating the first feature vector and the second feature vector to obtain the lesion feature vector; The classifying and training the classifier according to the disease spot feature vector and the disease type label corresponding to the disease spot image data set includes: The lesion feature vector is input into a fully connected layer, and the data output by the fully connected layer and the disease type label are input into the classifier for training, and the classifier is a softmax classifier.
2. The crop leaf disease identification method according to claim 1, characterized in that: The method of using a preset semantic segmentation model to segment the crop leaf images under the real background to obtain each leaf image includes: Acquire crop leaf images under real background through on-site shooting; Performing data enhancement processing on the crop leaf images to obtain an expanded data set, and dividing the data set into a training set, a validation set, and a test set; The crop leaf regions in the training set and the validation set are marked as 1, the background regions are marked as 0, and the marked images are converted into files conforming to the format of the semantic segmentation model; The semantic segmentation model is trained according to the training set and the file to obtain the preset semantic segmentation model.
3. The crop leaf disease identification method according to claim 2, characterized in that: The preset semantic segmentation model includes the Deeplab v3+ model.
4. The crop leaf disease identification method according to claim 2, characterized in that: The preset semantic segmentation model is used to segment the crop leaf images under the real background, and each leaf image is obtained including: Inputting the test set into the preset semantic segmentation model to obtain a mask image in which the leaf and background are segmented; The mask image is flipped to obtain a binary image with a background area pixel grayscale value of 0 and a leaf area pixel grayscale value of 255, and then the binary image is added to the image of the test set to obtain each leaf image after removing the background.
5. A device for identifying crop leaf diseases, characterized in that: The crop leaf disease identification device comprises: a processor and a memory; the processor is used to execute one or more computer programs stored in the memory to implement the steps of the crop leaf disease identification method according to any one of claims 1 to 4.
6. A storage medium, characterized in that: The storage medium stores one or more computer programs, and the one or more computer programs can be executed by one or more processors to implement the steps of the crop leaf disease identification method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Grape disease and pest identification method and device based on deep learning
CN111105393A