Method and device for detecting wheat scab and electronic equipment
1. A method for detecting wheat scab is characterized by comprising the following steps:
acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
calculating a target spectral index based on the reflectivities of different wavelengths in the hyperspectral image to be detected;
extracting texture features of a target scale from the hyperspectral image to be detected; the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
inputting the plurality of spectral indexes and the texture characteristics of the target scale into a second gibberellic disease detection model to obtain the severity of wheat infected with gibberellic disease; the gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through a plurality of spectral indexes and texture features of preset scales extracted from a second training sample set, the gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat suffering from gibberellic disease.
2. The method of claim 1, further comprising:
acquiring a third training sample set; the third training sample set is a plurality of hyperspectral images containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the relation between the plurality of spectral indexes and the ear disease rate of wheat and the sensitivity of each spectral index to scab, and screening a target spectral index from the plurality of spectral indexes.
3. The method of claim 1, further comprising:
determining a first target waveband based on the sensitivity of different wavebands to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavebands;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing all the correlations, and screening out a plurality of texture parameters meeting a first preset condition;
and taking texture parameters corresponding to the plurality of texture parameters meeting the second preset condition as texture features.
4. The method of claim 1, further comprising:
acquiring a fifth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat infected with early stage of gibberellic disease;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the fifth training sample set;
extracting a plurality of texture features with different scales from the hyperspectral image;
respectively training the gibberellic disease detection models to be trained through each feature by taking the target spectral index and the texture feature of one scale as a feature pair to obtain a plurality of trained first gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a plurality of preset first indexes;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
5. The method of claim 1, further comprising:
acquiring a sixth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat at the later stage of scab;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the sixth training sample set;
extracting a plurality of texture features of different scales from the hyperspectral images in the sixth training sample set;
taking the target spectral index and the texture features of one scale as a feature pair, and training the gibberellic disease detection models to be trained respectively through each feature to obtain a plurality of trained second gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a preset second index;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
6. The method according to claim 1, wherein the extracting the texture feature of the target scale from the hyperspectral image comprises:
if the hyperspectral image to be detected is an image infected with gibberellic disease in the early stage, extracting texture features with the scale of 5 windows from the hyperspectral image to be detected;
and if the hyperspectral image to be detected is an image at the later stage of scab infection, extracting texture features with the scale of 17 windows from the hyperspectral image to be detected.
7. A detection device for wheat scab is characterized by comprising:
the acquisition unit is used for acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
the calculation unit is used for calculating a target spectral index based on the reflectivity of different wavelengths in the hyperspectral image to be detected;
the extraction unit is used for extracting texture features of a target scale from the hyperspectral image to be detected; the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
the detection unit is used for inputting the plurality of spectral indexes and the texture characteristics of the target scale into a second gibberellic disease detection model to obtain the severity of wheat infected with gibberellic disease; the gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through a plurality of spectral indexes and texture features of preset scales extracted from a second training sample set, the gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat suffering from gibberellic disease.
8. The apparatus of claim 7, further comprising: a target spectral index screening unit for:
acquiring a third training sample set; the third training sample set is a plurality of hyperspectral images containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the relation between the plurality of spectral indexes and the ear disease rate of wheat and the sensitivity of each spectral index to scab, and screening a target spectral index from the plurality of spectral indexes.
9. The apparatus of claim 7, further comprising: a texture feature screening unit configured to:
determining a first target waveband based on the sensitivity of different wavebands to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavebands;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing all the correlations, and screening out a plurality of texture parameters meeting a first preset condition;
and taking texture parameters corresponding to the plurality of texture parameters meeting the second preset condition as texture features.
10. An electronic device, comprising:
a processor and a memory;
the memory stores a program, and the processor is used for executing the method for detecting wheat scab according to any one of claims 1 to 6 when the program in the memory is executed.
Background
Wheat scab is also called wheat head withering, wheat head rotting and red wheat head and is one of the main diseases of wheat, and wheat scab randomly occurs in the field at the early stage and is distributed scattered; if no effective treatment is available, infection and spread can be achieved in a short time. In order to avoid spread of head blight, early detection of early treatment is effective, and thus monitoring head blight is an effective means for detecting head blight.
In the prior art, only the change of a spectral index caused by disease occurrence is generally considered for monitoring the gibberellic disease, but researches show that the accuracy of monitoring the incidence of the gibberellic disease only through the spectral index is not high.
Disclosure of Invention
In view of the above, the embodiment of the invention discloses a method and a device for detecting wheat scab and an electronic device, which not only consider the influence of spectral indexes and image texture characteristics on the wheat scab, but also consider the optimal scale required by the detection of the wheat scab, thereby greatly improving the accuracy of the detection of the wheat scab.
The embodiment of the invention discloses a method for detecting wheat scab, which comprises the following steps:
acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
calculating a target spectral index based on the reflectivities of different wavelengths in the hyperspectral image to be detected;
extracting texture features of a target scale from the hyperspectral image to be detected; the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
inputting the plurality of spectral indexes and the texture characteristics of the target scale into a second gibberellic disease detection model to obtain the severity of wheat infected with gibberellic disease; the gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through a plurality of spectral indexes and texture features of preset scales extracted from a second training sample set, the gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat suffering from gibberellic disease.
Optionally, the method further includes:
acquiring a third training sample set; the third training sample set is a plurality of hyperspectral images containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the relation between the plurality of spectral indexes and the ear disease rate of wheat and the sensitivity of each spectral index to scab, and screening a target spectral index from the plurality of spectral indexes.
Optionally, the method further includes:
determining a first target waveband based on the sensitivity of different wavebands to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavebands;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing all the correlations, and screening out a plurality of texture parameters meeting a first preset condition;
and taking texture parameters corresponding to the plurality of texture parameters meeting the second preset condition as texture features.
Optionally, the method further includes:
acquiring a fifth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat infected with early stage of gibberellic disease;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the fifth training sample set;
extracting a plurality of texture features with different scales from the hyperspectral image;
respectively training the gibberellic disease detection models to be trained through each feature by taking the target spectral index and the texture feature of one scale as a feature pair to obtain a plurality of trained first gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a plurality of preset first indexes;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
Optionally, the method further includes:
acquiring a sixth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat at the later stage of scab;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the sixth training sample set;
extracting a plurality of texture features of different scales from the hyperspectral images in the sixth training sample set;
taking the target spectral index and the texture features of one scale as a feature pair, and training the gibberellic disease detection models to be trained respectively through each feature to obtain a plurality of trained second gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a preset second index;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
Optionally, the extracting the texture feature of the target scale from the hyperspectral image includes:
if the hyperspectral image to be detected is an image infected with gibberellic disease in the early stage, extracting texture features with the scale of 5 windows from the hyperspectral image to be detected;
and if the hyperspectral image to be detected is an image at the later stage of scab infection, extracting texture features with the scale of 17 windows from the hyperspectral image to be detected.
The embodiment of the invention discloses a detection device for wheat scab, which comprises:
the acquisition unit is used for acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
the calculation unit is used for calculating a target spectral index based on the reflectivity of different wavelengths in the hyperspectral image to be detected;
the extraction unit is used for extracting texture features of a target scale from the hyperspectral image to be detected; the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
the detection unit is used for inputting the plurality of spectral indexes and the texture characteristics of the target scale into a second gibberellic disease detection model to obtain the severity of wheat infected with gibberellic disease; the gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through a plurality of spectral indexes and texture features of preset scales extracted from a second training sample set, the gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat suffering from gibberellic disease.
Optionally, the method further includes: a target spectral index screening unit for:
acquiring a third training sample set; the third training sample set is a plurality of hyperspectral images containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the relation between the plurality of spectral indexes and the ear disease rate of wheat and the sensitivity of each spectral index to scab, and screening a target spectral index from the plurality of spectral indexes.
Optionally, the method further includes: a texture feature screening unit configured to:
determining a first target waveband based on the sensitivity of different wavebands to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavebands;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing all the correlations, and screening out a plurality of texture parameters meeting a first preset condition;
and taking texture parameters corresponding to the plurality of texture parameters meeting the second preset condition as texture features.
The embodiment of the invention discloses an electronic device, which comprises:
a processor and a memory;
the memory stores programs, and the processor is used for executing the detection method of wheat scab when the programs in the memory are executed.
The embodiment of the invention discloses a method for detecting wheat scab, which comprises the following steps: acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat; calculating a target spectral index based on the reflectivity of different wavelengths in the hyperspectral image to be detected; extracting texture features of a target scale from a hyperspectral image to be detected; the texture features of the target scale are determined by analyzing a plurality of first scab detection models obtained by training scab detection models to be trained respectively through a plurality of texture features of different scales; inputting the multiple spectral indexes and the texture features of the target scale into a second gibberellic disease detection model to obtain the severity of wheat scab infection, wherein the second gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through the multiple spectral indexes and the texture features of the target scale, which are extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease. Therefore, the spectral index and the textural features of the image are combined, and the target scale (the optimal scale) is determined in advance, so that the gibberellic disease detection is performed through the second gibberellic disease detection model trained by the textural features of the target scale and the spectral index, and the accuracy of the gibberellic disease detection is greatly improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a schematic flow chart of a method for detecting wheat scab according to embodiment 1 of the present invention;
FIG. 2 is a schematic flow chart of a screening method for a target scale according to embodiment 2 of the present invention;
FIG. 3 is a schematic flow chart of a screening method for target dimensions provided in embodiment 2 of the present invention;
FIG. 4 is a schematic structural diagram of a wheat scab detection device disclosed in embodiment 4 of the present invention;
fig. 5 shows a schematic structural diagram of an electronic device provided in embodiment 5 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
As can be seen from the above description, in the prior art, the gibberellic disease of wheat is usually monitored based on the spectral index, but the detection accuracy of the gibberellic disease is low in this way.
In order to improve the detection precision of the gibberellic disease, the gibberellic disease is detected in a mode of combining various characteristics, and a technician discovers that the textural characteristics of the image can change besides the spectral index after wheat is infected with the gibberellic disease through research, so that in the embodiment, the gibberellic disease is detected in a mode of combining the spectral index and the textural characteristics, and experiments prove that the mode greatly improves the detection precision compared with a single method adopting the spectral index.
However, the applicant has also found that the accuracy of the detection of head blight is not stable with different scales of textural features. Based on the above problems, the applicant found through research that the infection of field scab has obvious spatial aggregation and different distribution patterns in the early and later stages, namely, wheat scab is distributed in a linear point at the early stage and then begins to spread, and the scab is distributed in a flaky manner at the later stage. In order to further improve the accuracy of detecting the gibberellic disease, in this embodiment, the gibberellic disease detection models to be trained are trained through a plurality of texture features of different scales to obtain a plurality of first gibberellic disease detection models, and the plurality of first gibberellic disease detection models are analyzed to determine the optimal scale of the texture features. Based on this, the embodiment discloses a method for detecting wheat scab, which includes:
acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat; calculating a target spectral index based on the reflectivity of different wavelengths in the hyperspectral image to be detected; extracting texture features of a target scale from a hyperspectral image to be detected; the texture features of the target scale are determined by analyzing a plurality of first scab detection models obtained by training scab detection models to be trained respectively through a plurality of texture features of different scales; inputting the multiple spectral indexes and the texture features of the target scale into a second gibberellic disease detection model to obtain the severity of wheat scab infection, wherein the second gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through the multiple spectral indexes and the texture features of the target scale, which are extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease.
Therefore, in the embodiment, the spectral index and the textural features of the image are combined, and the target scale (the optimal scale) is determined in advance, so that the gibberellic disease detection is performed through the second gibberellic disease detection model trained by the textural features of the target scale and the spectral index, and the accuracy of the gibberellic disease detection is greatly improved.
The following will specifically describe a specific method for detecting wheat scab:
referring to fig. 1, a schematic flow chart of a method for detecting wheat scab provided in embodiment 1 of the present invention is shown, and in this embodiment, the method includes:
s101: acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
in this embodiment, the monitoring of wheat scab is generally to monitor the growth condition of wheat in a certain area range in the field, and the obtained hyperspectral image may be obtained by, for example, shooting a field block with wheat in a certain range, where the hyperspectral image obtained by shooting includes growth information of wheat.
In this embodiment, the growth information of wheat included in the hyperspectral image may include, for example: the spectral characteristics of vegetation growth and disease stress can be represented.
S102: calculating a target spectral index based on the reflectivities of different wavelengths in the hyperspectral image to be detected;
in this example, the target spectral index is a spectral index having a high sensitivity to wheat scab and a small correlation with each other.
Wherein, the target spectral index is the spectral index which is screened from a plurality of spectral indexes and has higher sensitivity to wheat scab and smaller mutual correlation, and the screening process comprises the following steps:
acquiring a third training sample set; the third training sample set is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the ear disease rate of the wheat and the sensitivity of each spectral index to scab, and screening out a target spectral index from the plurality of spectral indexes.
In this embodiment, the hyperspectral image includes reflectances at different wavelengths, and the spectral index can be calculated from the reflectances at the corresponding wavelengths based on a preset formula.
The calculation method of each spectral index is shown in the following table 1:
TABLE 1
Wherein, in Table 1, RnIndicating reflectivity at different wavelengths, e.g. R800The reflectance at 800 wavelengths is shown.
In this embodiment, the correlation may be calculated by a plurality of methods, which are not limited in this embodiment, and preferably, the correlation between the spectral indexes and the ear disease rate may be calculated by using a Kendall correlation coefficient.
The sensitivity of each spectral index to head blight can be calculated by various methods, specifically, the embodiment is not limited, and preferably, the sensitivity of each spectral index to head blight can be calculated by using a Relief algorithm.
For example, the following steps are carried out: the target spectral index selected from the plurality of spectral indices may include: anthocyanin Reflectance Index (ARI), Red-edge parameter (Red-edge position) and Red valley Depth (Red Depth).
In the embodiment, a plurality of spectral indexes which are high in sensitivity to scab, low in correlation between the spectral indexes and high in correlation with the ear disease rate are screened out from a plurality of spectral indexes related to vegetation by the method, so that the wheat scab can be monitored by the least spectral indexes, the calculation amount is greatly reduced, and the data processing efficiency is improved.
S103: extracting texture features of a target scale from the hyperspectral image to be detected;
the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, and the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set;
in this embodiment, the texture parameters extracted from the image may include multiple types, for example, a mean value, a variance, a homogeneity, a contrast, a dissimilarity, an entropy, a second moment, a correlation, and the like, and if all the texture parameters are to be used for detecting head blight, on one hand, a workload is large, and a processing efficiency of data is affected, and on the other hand, a correlation between each texture parameter and head blight is not large, so in order to improve a data processing efficiency and an accuracy, in this embodiment, a target texture feature is screened from multiple texture parameters, where the target texture feature is a texture parameter having a high correlation with a head blight rate of head blight, and the specific screening method may include:
determining a first target waveband based on the sensitivity of different wavelengths to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavelengths;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing the correlations, and screening out a plurality of correlations which meet a first preset condition;
and taking the texture parameters corresponding to the plurality of correlations which meet the preset conditions as texture features.
In this embodiment, the first target wavelength band includes at least one wavelength, and the wavelength included in the first target wavelength band is a wavelength that is more sensitive to gibberellic disease. The screening process of the first target band may include multiple types, and is not limited in this embodiment.
For example, the following steps are carried out: the wavelengths of the first target band selected include: 700nm (ARI), 720nm (red edge position).
The second target wavelength band includes at least one wavelength, and the wavelengths included in the second target wavelength band include a wavelength band with more image information, wherein the screening process of the second target wavelength band may include multiple types, which is not limited in this embodiment, and preferably, the following method may be adopted:
obtaining the weight of all wave bands of the image in the first principal component according to a principal component analysis method;
extracting principal components of the wave bands with weights larger than a first preset threshold value;
and selecting the wave bands with the correlation between the wave bands smaller than a second preset threshold value from the wave bands with the weights larger than the first preset threshold value.
For example, the following steps are carried out: the wavelengths of the second target band selected include: 582nm, 674nm and 694 nm.
In this embodiment, the method for obtaining texture parameters of multiple bands from a training sample may include multiple methods, which are not limited in this embodiment, for example, a gray level co-occurrence matrix method may be adopted, and the extracted multiple texture parameters may include: mean, variance, homogeneity, contrast, dissimilarity, entropy, second moment, correlation, and the like.
In this embodiment, the first preset condition is that the correlation between the principal component of the texture parameter and the ear disease rate is greater than the second preset threshold, or the first preset condition is that the correlation between the principal component of the texture parameter and the ear disease rate is greater, and the screened texture parameters meeting the first preset condition are represented as texture features.
For example, the following steps are carried out: the screened texture features include: mean, homogeneity, contrast, dissimilarity, and correlation.
In this embodiment, the target scale is obtained by training the first gibberellic disease detection model through a plurality of texture features of different scales, and performing comparative analysis on the trained first gibberellic disease detection model, so as to determine the first gibberellic disease detection model meeting the preset first condition. In this embodiment, the first screened gibberellic disease detection model satisfies a plurality of preset indexes.
Wherein, a plurality of predetermined indexes include: average accuracy, F1 score, and ROC curve.
The technical personnel also find that the infection of the field gibberellic disease has obvious spatial aggregation, different distribution modes are presented in the early stage and the later stage, namely, the wheat gibberellic disease presents point distribution in the early stage and then begins to spread, the wheat gibberellic disease presents sheet distribution in the later stage, and in order to find the optimal scales of the early stage and the later stage of the infection gibberellic disease, namely the optimal scales of the images used for training the gibberellic disease detection model, in the embodiment, the gibberellic disease detection model is trained through the images in the early stage of the infection gibberellic disease and the images in the later stage of the infection gibberellic disease respectively. Specifically, the training process will be described in detail below, and will not be described in detail in this embodiment.
In the embodiment, because the optimal scales of the images adopted in the early stage and the later stage of gibberellic disease infection of the wheat are different, the texture features of the target scale extracted from the hyperspectral image to be detected are also related to the current gibberellic disease infection condition, and if the wheat is in the early stage of gibberellic disease infection when the hyperspectral image to be detected is shot, the texture features of the first scale, for example, the texture features of 5 windows in scale are extracted from the hyperspectral image to be detected; and if the wheat is in the late stage of scab infection when the hyperspectral image to be detected is shot, extracting texture features of a second scale, for example, extracting texture features of a 17-window scale from the hyperspectral image to be detected.
S104: inputting the plurality of spectral indexes and the texture characteristics of the target scale into a second gibberellic disease detection model to obtain the severity of wheat infected with gibberellic disease; the second gibberellic disease detection model is obtained by training a plurality of spectral indexes extracted from a second training sample and texture features of a preset scale, the second gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
in this embodiment, the second gibberellic disease detection model may be obtained by training the second gibberellic disease detection model to be trained through a plurality of spectral indexes extracted from the second training sample and texture features of a preset scale, or may be obtained in the process of screening the optimal scale, where the second gibberellic disease detection model corresponding to the optimal scale (target scale) is the second gibberellic disease detection model.
According to the introduction, when the wheat is infected with the gibberellic disease in the early stage and the later stage, training samples for training a model are different, one is to use a hyperspectral image containing growth information of the wheat infected with the gibberellic disease in the early stage as a training sample, and the other is to use a hyperspectral image containing growth information of the wheat infected with the gibberellic disease in the later stage as a training sample. The second gibberellic disease detection model also contains two, one for detecting images of wheat at the early stage of infection and one for detecting images at the later stage of infection.
If the hyperspectral image to be detected is an image infected with head blight at a previous stage, extracting texture features of a first scale, for example, extracting texture features of a window with the scale of 5, from the hyperspectral image to be detected;
and if the hyperspectral image to be detected is an image at the later stage of scab infection, extracting texture features of a second scale, for example, extracting texture features of a window with the scale of 17, from the hyperspectral image to be detected.
In this embodiment, the prediction of the severity of wheat infection with scab by the second scab detection model may include a plurality of grades, which is not limited in this embodiment, and may include: the grade of infection is mild and the grade of infection is severe.
In this embodiment, the spectral index and the texture features of the image are used for detecting the wheat scab, and the optimal scale for extracting the texture features used for detecting the severity of the wheat scab or training the second scab detection model is obtained by analyzing the first scab detection model obtained by training the texture features of a plurality of different scales, and is expressed as the target scale. Therefore, the hyperspectral image to be detected is predicted through the second gibberellic disease detection model obtained after the texture features of the optimal scale are trained, and the preset accuracy is greatly improved.
In the embodiment, the applicant finds that the wheat scab infection in the field has obvious spatial aggregation property and presents different distribution modes in the early stage and the later stage, namely the wheat scab is distributed in a line point manner in the early stage and then begins to spread, and the wheat scab is distributed in a sheet manner in the later stage. Aiming at the expression of early stage of infection, if a larger scale is adopted, the characteristic of point distribution cannot be accurately expressed; for the expression in the late stage of infection, if a small scale is adopted, the characteristic of 'sheet' -shaped distribution cannot be accurately expressed. Thus, in order to find the best scale to accurately characterize the early and late stages of infection with head blight, it was determined by the following examples 2 and 3, respectively:
referring to fig. 2, a schematic flow chart of a screening method for a target scale provided in embodiment 2 of the present invention is shown, and in this embodiment, the method includes:
s201, acquiring a fifth training sample set; the fifth training sample set is a hyperspectral image containing growth information of wheat infected with early stage of gibberellic disease;
s202: calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the fifth training sample set;
in this embodiment, it can be known from the above description that the target spectral index is a spectral index having a high sensitivity to wheat scab and a small correlation therebetween, and the method for screening the target spectral index is already described above, and is not described in detail in this embodiment.
S203: extracting a plurality of texture features with different scales from the hyperspectral images in the fifth training sample set;
s204: taking the target spectral index and the texture features of one scale as a feature pair, and training the gibberellic disease detection models to be trained through each feature pair respectively to obtain a plurality of trained first gibberellic disease detection models;
in this embodiment, in order to select the optimal size, in this embodiment, the texture features of each scale are respectively trained on the gibberellic disease detection model to be trained, and in order to improve the training accuracy, in this embodiment, the texture features and the target spectral index of each scale are used as a feature pair to respectively train the gibberellic disease detection model to be trained.
S205: analyzing the trained first gibberellic disease detection models through a plurality of preset first indexes;
s206: screening a first target gibberellic disease detection model from a plurality of trained first gibberellic disease detection models based on analysis results of the trained first gibberellic disease detection models;
s207: and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of gibberellic disease infection.
In this embodiment, the preset multiple first indexes may include multiple types, which are not limited in this embodiment, for example, the first index may include: average accuracy, F1 score, and ROC curve.
In this embodiment, the accuracy of the first gibberellic disease detection model is calculated using a plurality of test sets of hyperspectral images containing growth information of wheat suffering from gibberellic disease, for example, the overall accuracy of the first gibberellic disease detection model may be calculated using a confusion matrix.
Wherein, the accuracy of the model is higher when the scale of the extraction of the texture features is closer to the optimal scale.
In this embodiment, the F1 score calculation formula is as follows, formula 1) to formula 3):
formula 1) Precision ═ TP/(TP + FP);
formula 2) Recall ═ TP/(TP + FN);
formula 3) F1 ═ 2 × Precision Recall/(Precision + Recall);
wherein Precision: the precision ratio represents the proportion of the samples with the predicted values of true (diseased) and true (diseased) in all the samples with the predicted values of true; TP: the number of the predicted value and the true value which are true; FP: the number of samples with true predicted values but false true values (no disease); recall: the recall rate refers to the proportion of the samples with the true predicted values and the true sample; FN: the number of samples for which the predicted value is false but the true value is true.
In this embodiment, the F1 score can comprehensively determine the sensitivity and specificity of the model, and the higher the F1 score is, the better the sensitivity and specificity of the model is.
In this embodiment, the false positive rate and the true positive rate are calculated multiple times and the average value of the false positive rate and the true positive rate is calculated through the following formulas 4) and 5) and the prediction result of the first gibberellic disease detection model on the test set, so as to obtain the average ROC (english full name: receiver Operating charateristic curre, Chinese full name: subject operating characteristic curve) curve, and calculating the area under the ROC curve (AUC).
4)FPR=TP/(TP+FP);
5)TPR=TP/(TP+FN);
The ROC curve can reflect the generalization ability of the model, and the larger the area under the ROC curve is, the better the generalization ability is.
For example, the following steps are carried out: the following table 1 shows the conditions of different indexes of the first gibberellic disease detection model under different windows when the first gibberellic disease detection model is screened:
therefore, the three indexes can be integrated, so that the first gibberellic disease detection model with the best prediction effect is screened out and expressed as a first target gibberellic disease detection model, and the scale corresponding to the first target gibberellic disease detection model is used as the target scale.
In this embodiment, a hyperspectral image containing growth information of wheat infected with head blight at a previous stage is used as a training sample to train a head blight detection model to be trained, so as to obtain a plurality of first head blight detection models, and then the first head blight detection models are evaluated by a plurality of indexes, so as to obtain an optimal first head blight detection model, and a scale of texture features used for training the optimal first head blight detection model is used as a target scale of the head blight at the previous stage. Therefore, when the optimal scale is used for detecting the gibberellic disease, the accuracy of detecting the gibberellic disease can be greatly improved.
Referring to fig. 3, a schematic flow chart of a screening method for a target scale provided in embodiment 2 of the present invention is shown, and in this embodiment, the method includes:
s301: acquiring a sixth training sample set; the sixth training sample set is a hyperspectral image containing growth information of wheat at the later stage of gibberellic disease infection;
in this embodiment, it can be known from the above description that the target spectral index is a spectral index having a high sensitivity to wheat scab and a small correlation therebetween, and the method for screening the target spectral index is already described above, and is not described in detail in this embodiment.
Different from the foregoing embodiment 2, the sixth training sample adopted in this embodiment is a hyperspectral image containing growth information of wheat infected at a later stage of gibberellic disease, and the fifth training sample adopted in embodiment 2 is a hyperspectral image containing growth information of wheat infected at a earlier stage of gibberellic disease.
S302: calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the sixth training sample set;
s303: extracting a plurality of texture features of different scales from the hyperspectral images in the sixth training sample set;
s304: respectively training the gibberellic disease detection models to be trained through each feature by taking the target spectral index and the texture feature of one scale as a feature pair to obtain a plurality of trained first gibberellic disease detection models;
in this embodiment, in order to select the optimal size, in this embodiment, the texture features of each scale are respectively trained on the gibberellic disease detection model to be trained, and in order to improve the training accuracy, in this embodiment, the texture features and the target spectral index of each scale are used as a feature pair to respectively train the gibberellic disease detection model to be trained.
S305: analyzing the trained first gibberellic disease detection models through a preset second index;
s306: screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models;
s307: and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
In this embodiment, the preset second index may include one or more, which is not limited in this embodiment, for example, the first index may include: average accuracy, F1 score, and ROC curve.
The average accuracy, the F1 curve, and the ROC curve are already described in embodiment 2, and are not described again in this embodiment.
Wherein, the accuracy of the model is higher when the scale of the extraction of the texture features is closer to the optimal scale.
The F1 score can comprehensively judge the sensitivity and the specificity of the model, and the higher the F1 score is, the better the sensitivity and the specificity of the model are.
The ROC curve can reflect the generalization ability of the model, and the larger the area AUC under the ROC curve is, the better the generalization ability is.
For example, the following steps are carried out: table 2 below shows the different indices of the first gibberellic disease detection model at different windows when the first gibberellic disease detection model is screened:
TABLE 2
Therefore, the three indexes can be integrated, so that the first gibberellic disease detection model with the best prediction effect is screened out and expressed as a first target gibberellic disease detection model, and the scale corresponding to the first target gibberellic disease detection model is used as the target scale.
In this embodiment, a hyperspectral image containing growth information of wheat infected with head blight at a previous stage is used as a training sample to train a head blight detection model to be trained, so as to obtain a plurality of first head blight detection models, and then the first head blight detection models are evaluated by a second index, so as to obtain an optimal first head blight detection model, and a scale of texture features used for training the optimal first head blight detection model is used as a target scale at a later stage of head blight infection. Therefore, when the optimal scale is used for detecting the gibberellic disease, the accuracy of detecting the gibberellic disease can be greatly improved.
In this embodiment, the aforementioned fusarium head blight detection model to be trained may be any machine learning model, which is not limited in this embodiment, and may be, for example, a Logistic model.
Referring to fig. 4, there is shown a schematic structural diagram of a wheat scab detection apparatus disclosed in embodiment 4 of the present invention, and in this embodiment, the apparatus includes:
an obtaining unit 401, configured to obtain a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
a calculating unit 402, configured to calculate a target spectral index based on reflectivities of different wavelengths in the hyperspectral image to be detected;
an extracting unit 403, configured to extract texture features of a target scale from the hyperspectral image to be detected; the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
a detecting unit 404, configured to input the multiple spectral indexes and the texture features of the target scale into a second gibberellic disease detection model, so as to obtain a severity of wheat infection with gibberellic disease; the gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through a plurality of spectral indexes and texture features of preset scales extracted from a second training sample set, the gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat suffering from gibberellic disease.
Optionally, the method further includes: a target spectral index screening unit for:
acquiring a third training sample set; the third training sample set is a plurality of hyperspectral images containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the relation between the plurality of spectral indexes and the ear disease rate of wheat and the sensitivity of each spectral index to scab, and screening a target spectral index from the plurality of spectral indexes.
Optionally, the method further includes: a texture feature screening unit configured to:
determining a first target waveband based on the sensitivity of different wavebands to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavebands;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing all the correlations, and screening out a plurality of texture parameters meeting a first preset condition;
and taking texture parameters corresponding to the plurality of texture parameters meeting the second preset condition as texture features.
Optionally, the method further includes:
a first target scale screening unit for:
acquiring a fifth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat infected with early stage of gibberellic disease;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the fifth training sample set;
extracting a plurality of texture features with different scales from the hyperspectral image;
respectively training the gibberellic disease detection models to be trained through each feature by taking the target spectral index and the texture feature of one scale as a feature pair to obtain a plurality of trained first gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a plurality of preset first indexes;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
Optionally, the second target scale screening unit is configured to:
acquiring a sixth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat at the later stage of scab;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the sixth training sample set;
extracting a plurality of texture features with different scales from the hyperspectral image;
taking the target spectral index and the texture features of one scale as a feature pair, and training the gibberellic disease detection models to be trained respectively through each feature to obtain a plurality of trained second gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a preset second index;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
Optionally, the extracting unit includes:
the first extraction subunit is used for extracting texture features with the dimension of 5 windows from the hyperspectral image to be detected if the hyperspectral image to be detected is an image infected with gibberellic disease in the early stage;
and the second extraction self-unit is used for extracting the texture features with the dimension of 17 windows from the hyperspectral image to be detected if the hyperspectral image to be detected is the image at the later stage of scab infection.
When the device of the embodiment is used for detecting the gibberellic disease, the spectral index and the textural features of the image are combined, and the target scale (the optimal scale) is determined in advance, so that the gibberellic disease detection is performed through the textural features of the target scale and the second gibberellic disease detection model trained by the spectral index, and the accuracy of the gibberellic disease detection is greatly improved.
Referring to fig. 5, a schematic structural diagram of an electronic device provided in embodiment 5 of the present invention is shown, and in this embodiment, the electronic device includes: a memory and a processor;
the memory stores programs, and the processor is used for executing the following detection method for wheat scab when the programs in the memory are executed:
acquiring a hyperspectral image to be detected; the hyperspectral image to be detected comprises growth information of wheat;
calculating a target spectral index based on the reflectivities of different wavelengths in the hyperspectral image to be detected;
extracting texture features of a target scale from the hyperspectral image to be detected; the texture features of the target scale are obtained by analyzing a plurality of first gibberellic disease detection models, the plurality of first gibberellic disease detection models are obtained by respectively training gibberellic disease detection models to be trained through texture features of different scales extracted from a first training sample set, and the first training sample is a hyperspectral image containing growth information of wheat infected with gibberellic disease;
inputting the plurality of spectral indexes and the texture characteristics of the target scale into a second gibberellic disease detection model to obtain the severity of wheat infected with gibberellic disease; the gibberellic disease detection model is obtained by training a gibberellic disease detection model to be trained through a plurality of spectral indexes and texture features of preset scales extracted from a second training sample set, the gibberellic disease detection model has the capability of predicting the severity of wheat infected with gibberellic disease, and the second training sample is a hyperspectral image containing growth information of wheat suffering from gibberellic disease.
Optionally, the method further includes:
acquiring a third training sample set; the third training sample set is a plurality of hyperspectral images containing growth information of wheat infected with gibberellic disease;
calculating a plurality of spectral indexes based on the reflectivities of different wavelengths of the hyperspectral images in the third training sample set;
and analyzing the correlation among the plurality of spectral indexes, the relation between the plurality of spectral indexes and the ear disease rate of wheat and the sensitivity of each spectral index to scab, and screening a target spectral index from the plurality of spectral indexes.
Optionally, the method further includes:
determining a first target waveband based on the sensitivity of different wavebands to gibberellic disease;
determining a second target waveband based on the richness degree of image information contained in different wavebands;
obtaining a plurality of texture parameters of a first target waveband and a second target waveband from the fourth training sample set; the fourth training sample set is a plurality of hyperspectral images containing growth information of wheat suffering from gibberellic disease;
performing principal component analysis on the same texture parameters in the first target waveband and the second target waveband to obtain a principal component of each texture parameter;
calculating the correlation between the main component of each texture parameter and the ear disease rate of the fourth training sample;
comparing all the correlations, and screening out a plurality of texture parameters meeting a first preset condition;
and taking texture parameters corresponding to the plurality of texture parameters meeting the second preset condition as texture features.
Optionally, the method further includes:
acquiring a fifth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat infected with early stage of gibberellic disease;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the fifth training sample set;
extracting a plurality of texture features with different scales from the hyperspectral image;
respectively training the gibberellic disease detection models to be trained through each feature by taking the target spectral index and the texture feature of one scale as a feature pair to obtain a plurality of trained first gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a plurality of preset first indexes;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
Optionally, the method further includes:
acquiring a sixth training sample set; the fifth training sample is a hyperspectral image containing growth information of wheat at the later stage of scab;
calculating a target spectral index based on different wavelength reflectivities of the hyperspectral images in the sixth training sample set;
extracting a plurality of texture features with different scales from the hyperspectral image;
taking the target spectral index and the texture features of one scale as a feature pair, and training the gibberellic disease detection models to be trained respectively through each feature to obtain a plurality of trained second gibberellic disease detection models;
analyzing the trained first gibberellic disease detection models through a preset second index;
screening a first target gibberellic disease detection model from the plurality of trained first gibberellic disease detection models based on results of analyzing the plurality of trained first gibberellic disease detection models; and taking the scale of the texture features used for training the first target gibberellic disease detection model as the target scale selected at the early stage of the gibberellic disease.
Optionally, the extracting the texture feature of the target scale from the hyperspectral image includes:
if the hyperspectral image to be detected is an image infected with gibberellic disease in the early stage, extracting texture features with the scale of 5 windows from the hyperspectral image to be detected;
and if the hyperspectral image to be detected is an image at the later stage of scab infection, extracting texture features with the scale of 17 windows from the hyperspectral image to be detected.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种基于深度学习的病理学图像自动分割系统