A sorghum variety identification method based on spectral image reconstruction
Through a spectral image reconstruction method, combined with Transformer and BiLSTM-Attention network model, the destructiveness, waste of resources and poor modeling effects of sorghum variety identification in the prior art was solved, and fast, accurate and convenient sorghum variety identification was achieved.
Patent Information
- Application Number
- CN202310524015.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-10
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2043-05-10
AI Technical Summary
The sorghum variety identification methods in the prior art have problems such as destructive detection, waste of resources, poor modeling effect and large technical investment, making it difficult to achieve fast, non-destructive, accurate and convenient sorghum variety identification.
Using a method based on spectral image reconstruction, the spectral data of sorghum is obtained through the sorghum RGB acquisition platform and the spectral reconstruction algorithm, and the spectral reconstruction network is improved by using Transformer, and combined with the BiLSTM-Attention network model, a sorghum variety recognition model is established to achieve fast and accurate variety recognition.
It realizes the rapid, lossless, accurate and convenient identification of sorghum variety, improves the recognition accuracy rate, and reduces the cost and calculation amount.
Smart Images

Figure CN116337781B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of solid brewing raw material detection, is applied to the process of sorghum variety identification, and specifically relates to a sorghum variety identification method based on spectral image reconstruction. Background Art
[0002] Solid-state fermentation technology has a long history in my country and is also a unique brewing process in my country. Among the many raw materials for brewing traditional liquor, sorghum accounts for the main proportion, and sorghum wine has the advantages of mellow and rich, fragrant and sweet, and high yield. Therefore, sorghum is often used as a more ideal raw material in the brewing process for the brewing of sauce-flavor liquor.
[0003] However, there are many varieties of sorghum, and sorghum of different types and origins has a certain impact on the quality and yield of liquor. The content of starch, tannin, fat, protein and other components in sorghum, in addition to the relationship between varieties, is also related to its growth environment, region, season and maturity. The difference in the content of each component will affect the aroma, taste and style of the produced liquor. Therefore, it is particularly important to use sorghum varieties specified by the wine company to produce liquor with stable quality. The accuracy of the sorghum variety detection and identification process has become a key influencing factor.
[0004] At present, most wine companies use manual visual identification and biochemical detection methods to distinguish and identify different types of sorghum varieties. However, the appearance characteristics of different varieties of sorghum are not obviously different, and it is difficult to ensure the accuracy and stability of the detection and identification results through manual methods. The biochemical method is relatively time-consuming and labor-intensive, and requires testers to have the skills to operate professional instruments. Therefore, this field needs to explore a fast, non-destructive and convenient method to identify different sorghum varieties.
[0005] In the prior art, patent CN102706813A discloses a method for identifying Kentucky bluegrass varieties based on hyperspectral images. The patent places a prepared Kentucky bluegrass sample in a hyperspectral imaging device to collect a hyperspectral image; extracts information from the hyperspectral image, including spectral information and external feature information; calculates the total difference between different Kentucky bluegrass varieties in different bands based on the extracted spectral information; establishes a function model for distinguishing different varieties of Kentucky bluegrass based on the total difference in each band or the total difference combined with appearance feature information; and distinguishes the samples based on the established function model to identify different varieties of Kentucky bluegrass, thereby providing a new technical means for identifying Kentucky bluegrass varieties.
[0006] However, the patent has the following shortcomings: the meadow grass variety identification method described therein is a destructive test, and the sample cannot be used again after the test. If the sample size is large, it will cause a waste of resources; and the number of modeling samples used in the patent is relatively small, which cannot make the modeling effect in an optimal state, so the accuracy of its judgment and identification results still has room for improvement.
[0007] Patent CN113092407A discloses a method for identifying the Wuchang Rice Flower Scented Rice variety of origin based on near-infrared spectroscopy. In this patent, a set of spectral curves of the substance to be tested is collected and matched with the characteristic spectral curve of the Wuchang Rice Flower Scented Rice variety of origin; based on the set of spectral curves, the characteristic spectral curve of the substance to be tested is calculated; the correlation coefficient of the two characteristic spectral curves is calculated; when the correlation coefficient is greater than or equal to a preset threshold, the substance to be tested is the Wuchang Rice Flower Scented Rice variety of origin.
[0008] However, this patent still has the following shortcomings: it uses near-infrared spectroscopy to identify the varieties of rice seeds. Although the identification accuracy is high, the investment required is large, and near-infrared spectroscopy technology is overly dependent on models and is not suitable as a means of detecting dispersed samples where samples and measured items often change.
[0009] Therefore, how to provide a sorghum variety identification method with sufficiently excellent recognition accuracy and the advantages of being online, non-destructive, convenient and reliable has become a research focus of technical personnel in this field. Summary of the invention
[0010] In order to solve the problems mentioned in the background technology and the limitations and shortcomings of the existing technology in the process of sorghum identification, the present invention proposes a method for quickly, non-destructively and accurately identifying sorghum varieties based on spectral image reconstruction; the spectral data of sorghum is obtained quickly and at low cost through a sorghum RGB acquisition platform and a spectral reconstruction algorithm; a sorghum variety recognition model is established by using the reconstructed spectral sorghum variety dataset to achieve accurate recognition effect.
[0011] The present invention adopts the following technical solutions to achieve the purpose:
[0012] A sorghum variety identification method based on spectral image reconstruction comprises the following steps:
[0013] S1, obtaining the original hyperspectral image data of the sorghum sample, performing black and white correction, and obtaining the corresponding pseudo RGB image of the sorghum sample to establish a sorghum sample spectrum reconstruction data set; at the same time, collecting the real RGB image of the sorghum;
[0014] S2. Use Transformer to improve the spectral reconstruction network HRNet to obtain the RA-HRNet network. Use the sorghum sample spectral reconstruction dataset to train the RA-HRNet network and obtain the spectral reconstruction model.
[0015] S3, using the collected real RGB image of sorghum, and obtaining the reconstructed spectral image of sorghum through the trained spectral reconstruction model;
[0016] S4, performing data processing on the sorghum reconstructed spectral image, segmenting the background and foreground of the image; traversing the image after data processing, obtaining the poles on the rows and columns and intercepting the sorghum sample image inside the poles, and using a mask to generate a region of interest;
[0017] S5, dividing the region of interest into a plurality of non-intersecting square regions, and calculating the average spectral value of all pixels in each region to obtain a first spectral feature of the sorghum sample;
[0018] S6. For the divided multiple non-intersecting square areas, the first-order moment, the second-order moment and the third-order moment of the HSV channel are used to extract the color features of the sorghum sample respectively to obtain the first image features; the texture features of the sorghum sample are extracted using the gray level co-occurrence matrix to obtain the second image features;
[0019] S7. Establishing a sorghum reconstructed spectral variety recognition data set based on the first spectral feature, the first image feature, and the second image feature;
[0020] S8. Build a BiLSTM_Attention network model and use the sorghum reconstructed spectrum variety recognition dataset to train the BiLSTM_Attention network model to obtain the sorghum variety recognition BiLSTM_Attention model.
[0021] S9. Collect sorghum samples to be tested, use the spectral reconstruction model to process the sorghum samples to be tested, and obtain the reconstructed spectral image of the sorghum to be tested; according to the processes of S4, S5 and S6, the spectral characteristics, color characteristics and texture characteristics of the sorghum samples to be tested are obtained, and the variety of the sorghum samples to be tested is identified through the sorghum variety identification BiLSTM_Attention model to obtain the sorghum variety prediction result and confidence.
[0022] Specifically, in step S1, a hyperspectral image of a sorghum sample covering a culture dish within a visible light range is collected to obtain original hyperspectral image data of the sorghum sample; black and white correction is performed on the original hyperspectral image data, and spectral image data of 31 bands of the sorghum sample at intervals of 10 nm in a range of 400-700 nm and corresponding pseudo RGB images of the sorghum sample are obtained to establish a spectral reconstruction data set of the sorghum sample; while collecting the original hyperspectral image data of the sorghum sample, a pre-built sorghum RGB image acquisition platform is used to collect the real RGB image of the sorghum.
[0023] Furthermore, in step S1, the calculation formula for black and white correction is as follows:
[0024]
[0025] Where R is the rectified reflectance image of the sorghum sample; I is the original hyperspectral image of the sorghum sample; W is the standard whiteboard image; and D is the standard blackboard image.
[0026] Furthermore, in step S1, it is necessary to obtain spectral image data of the sorghum sample in a specific band, and the specific band is: from the hyperspectral image data in the wavelength range of 400-1000nm, 31 actually used bands with an interval of 10nm in 400-700nm are extracted, as shown in Table 1 below.
[0027] Table 1 Hyperspectral image extraction wavelength position table (nm)
[0028] Target actual Target actual Target actual Target actual Target actual 400: 399.6 460: 460.04 520: 519.61 580: 579.65 640: 640.16 410: 410.1 470: 470.6 530: 530.25 590: 590.37 650: 649.61 420: 420.58 480: 479.85 540: 539.57 600: 599.77 660: 660.43 430: 429.77 490: 490.43 550: 550.24 610: 610.52 670: 669.91 440: 440.29 500: 499.7 560: 559.59 620: 619.94 680: 679.4 450: 449.5 510: 510.31 570: 570.28 630: 629.37 690: 690.25 -- -- -- -- -- -- -- -- 700: 699.77
[0029] Furthermore, in step S1, the pseudo RGB image of the sorghum sample is generated by firstly using CIE1964-X 10 Y 10 Z 10 The color matching function and the sorghum spectral image data H(x,y,w) are used to obtain the XYZ image of sorghum, as shown in the following formula:
[0030]
[0031]
[0032]
[0033] Then use the transformation matrix M to map the XYZ color space to the RGB color space as follows:
[0034]
[0035]
[0036] Finally, use Gamma correction to convert the RGB color space to the sRGB space used in the image. The Gamma correction equation is as follows, where R, G, and B are:
[0037]
[0038] Furthermore, in step S2, Transformer is used to build the residual attention feature fusion network RAFN (Residual attention feature fusion network) to improve the spectral reconstruction network HRNet.
[0039] Furthermore, the specific content of step S4 is: gray-scale processing and de-binarization adaptive threshold processing are performed on the real RGB image corresponding to the sorghum reconstructed spectral image to segment the background and foreground of the image; traverse the image after data processing to obtain the poles of the culture dish on the rows and columns and intercept the sorghum sample image inside the poles, and use a circular mask to generate a region of interest; through the traversal process, find the position where the first gray value is 0, and then obtain the poles of the culture dish on the rows and columns, including: max_x, min_x, max_y, nin_y.
[0040] Further, in step S5, the region of interest is divided into 7 non-intersecting square regions; then, the calculation formula of the first spectral feature is as follows:
[0041]
[0042] In the formula, is the average spectral value of the corresponding matrix; m is the number of pixels in the corresponding matrix; n is the number of bands of sorghum hyperspectral data or spectral reconstruction data; I i,j is the reflectance of the j-th pixel in the i-th band.
[0043] Furthermore, in step S6, the first image feature is extracted from the seven non-intersecting square areas using the first-order moment, second-order moment, and third-order moment of the HSV channel, and the formula is as follows:
[0044]
[0045]
[0046]
[0047] In the formula, μ i represents the first-order moment; N represents the number of pixels; p i,j Represents the i-th color component of the j-th pixel, including the color components of the three color channels H, S, and V; σ irepresents the second-order moment; s i Represents the third-order moment; the first-order moment is the mean, representing the average intensity of the color component; the second-order moment is the color variance, representing the non-uniformity; the third-order moment is the skewness of the color component, representing the asymmetry.
[0048] Furthermore, in step S6, the gray-level co-occurrence matrix is used to extract the texture features of the sorghum sample in the square region of interest. The specific process is: first, the RGB image of the region of interest is converted into a grayscale image of a fixed level, and then the four statistics of the grayscale image, namely, energy, entropy, moment of inertia and correlation, are calculated from four directions of 0°, 45°, 90° and 135° respectively; then, the average value of the four statistical index values is used as the typicality information of the image texture feature to obtain the second image feature.
[0049] Among them, the calculation formulas of the four statistical indicator values are as follows:
[0050]
[0051]
[0052]
[0053]
[0054] In the calculation formula:
[0055]
[0056]
[0057] Where Energy represents energy, Entropy represents entropy, MOI represents moment of inertia, and COR represents correlation; L is the number of gray levels; P(i,j) is the image after conversion to level L; i is the gray value of the pixel; j is the gray value of the pixel with a fixed length step from i; μ n and μ y Represent the average gray value of the corresponding row and column respectively; σ x and σ y Represent the variance of the corresponding row and column respectively.
[0058] Specifically, in step S9, the input of the BiLSTM-Attention network model is the first spectral feature, the first image feature, and the second image feature; the output of the BiLSTM-Attention network model is the type corresponding to each sorghum sample.
[0059] In summary, due to the adoption of this technical solution, the beneficial effects of the present invention are as follows:
[0060] The present invention provides a sorghum variety recognition method based on spectral image reconstruction technology, and optimizes HRNet by utilizing the advantages of the Transformer structure in modeling long-distance dependency and non-local self-similarity, so that the model has improved root mean square error (RMSE), mean relative absolute error (MRAE) and peak signal-to-noise ratio (PSNR), while the number of parameters and the amount of calculation of the model are greatly reduced; a BiLSTM-Attention sorghum variety recognition method is constructed, and the weight relationship between sorghum spectral data and image features and global semantic feature information are effectively obtained through a multi-head self-attention mechanism, thereby improving the ability of sorghum variety recognition; thereby providing a new method for rapid and lossless identification of sorghum varieties in the liquor brewing process, which has a higher accuracy rate. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 It is a schematic diagram of the process of the present invention;
[0062] Figure 2 A flowchart of region of interest extraction and prediction in the method of the present invention;
[0063] Figure 3 A schematic diagram of a residual attention feature fusion network RAFN constructed using a Transformer module in the method of the present invention;
[0064] Figure 4 Schematic diagram of the structure of the improved RA-HRNet spectral reconstruction network in the method of the present invention;
[0065] Figure 5 Schematic diagram of the overall structure of the BiLSTM-Attention model in the method of the present invention. DETAILED DESCRIPTION
[0066] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0067] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0068] See Figure 1The overall process and design ideas of a sorghum variety identification method based on spectral image reconstruction include the following steps:
[0069] S1, obtaining the original hyperspectral image data of the sorghum sample, performing black and white correction, and obtaining the corresponding pseudo RGB image of the sorghum sample to establish a sorghum sample spectrum reconstruction data set; at the same time, collecting the real RGB image of the sorghum;
[0070] S2. Use Transformer to improve the spectral reconstruction network HRNet to obtain the RA-HRNet network. Use the sorghum sample spectral reconstruction dataset to train the RA-HRNet network and obtain the spectral reconstruction model.
[0071] S3, using the collected real RGB image of sorghum, and obtaining the reconstructed spectral image of sorghum through the trained spectral reconstruction model;
[0072] S4, performing data processing on the sorghum reconstructed spectral image, segmenting the background and foreground of the image; traversing the image after data processing, obtaining the poles on the rows and columns and intercepting the sorghum sample image inside the poles, and using a mask to generate a region of interest;
[0073] S5, dividing the region of interest into a plurality of non-intersecting square regions, and calculating the average spectral value of all pixels in each region to obtain a first spectral feature of the sorghum sample;
[0074] S6. For the divided multiple non-intersecting square areas, the first-order moment, the second-order moment and the third-order moment of the HSV channel are used to extract the color features of the sorghum sample respectively to obtain the first image features; the texture features of the sorghum sample are extracted using the gray level co-occurrence matrix to obtain the second image features;
[0075] S7. Establishing a sorghum reconstructed spectral variety recognition data set based on the first spectral feature, the first image feature, and the second image feature;
[0076] S8. Build a BiLSTM_Attention network model and use the sorghum reconstructed spectrum variety recognition dataset to train the BiLSTM_Attention network model to obtain the sorghum variety recognition BiLSTM_Attention model.
[0077] S9. Collect sorghum samples to be tested, use the spectral reconstruction model to process the sorghum samples to be tested, and obtain the reconstructed spectral image of the sorghum to be tested; according to the processes of S4, S5 and S6, the spectral characteristics, color characteristics and texture characteristics of the sorghum samples to be tested are obtained, and the variety of the sorghum samples to be tested is identified through the sorghum variety identification BiLSTM_Attention model to obtain the sorghum variety prediction result and confidence.
[0078] In the following content, this embodiment will follow the method steps of the present invention, and on the premise of following its core ideas and concepts, explain the operations in the steps in detail and clearly to present the best implementation method.
[0079] 1. Preparation of sorghum samples.
[0080] In this embodiment, 10 varieties of sorghum samples were selected, and their production areas include Luzhou and Yibin areas of Sichuan Province, Renhuai area of Guizhou Province and Jinan area of Shandong Province; the 10 varieties are: Dwarf Anti-1, Australian Sorghum, Super Glutinous 1, Red Crown 1, Red Grass, Hongta 2, Luzhou Red, Ruinuo 7, Tiegan 1 and Yinuohong.
[0081] At each sampling, a sufficient amount of a single variety of sorghum was evenly spread in a transparent culture dish with a diameter of 80 mm. 50 samples of each variety of sorghum were collected, for a total of 500 samples.
[0082] 2. Collection of RGB images and hyperspectral images of sorghum samples.
[0083] RGB image acquisition platform equipment configuration: The RGB image acquisition platform consists of a platform architecture, an industrial camera (MER2-503-36U3C), a lens (HN-P-1220-10M-C2 / 3), a dome light source (PPX-RI9030) and a computer; Hyperspectral image acquisition platform equipment configuration: The hyperspectral imaging system consists of a hyperspectral camera (Finland FX17 / FX10 series), a halogen lamp (OSRAM, German), an electronically controlled mobile platform, data acquisition software (LUMO-scanner), a computer and a calibration whiteboard.
[0084] 3. Preparation of sorghum sample spectral reconstruction dataset.
[0085] 3-1. Black and white correction: Use black correction plates and white correction plates to correct the original hyperspectral image data to eliminate the influence of dark current and uneven light intensity in the hyperspectral camera and obtain the spectral reflectance of the sorghum sample.
[0086] 3-2. Generation of pseudo-RGB images of sorghum samples: Use the CIE1964 color matching function to generate corresponding pseudo-RGB images from hyperspectral image data to form a hyperspectral image-pseudo-RGB image pair, which is used to establish a mapping relationship between RGB values and spectral reflectance, thereby establishing a sorghum sample spectral reconstruction dataset.
[0087] 4. RA-HRNet spectral reconstruction model training.
[0088] 4-1. The sorghum sample spectral reconstruction dataset was used as the training set and test set to establish the Transformer-based RA-HRNet spectral reconstruction model. The residual attention feature fusion network RAFN built using the Transformer module can be found in Figure 3 Schematic diagram; a spectral reconstruction model based on sorghum hyperspectral data is obtained. The structure of the spectral reconstruction model is as follows Figure 4 shown.
[0089] 4-2. Model evaluation: The root mean square error (RMSE), mean relative absolute error (MRAE), and peak signal-to-noise ratio (PSNR) are used as evaluation indicators to determine the effect of the spectral reconstruction model; the evaluation results are shown in Table 2 below.
[0090] Table 2 Model reconstruction effect evaluation results
[0091] method Params(M) FLOPS(G) MRAE RMSE PSNR RA-HRNet 6.18 32.516 0.2372 0.0445 31.44
[0092] 5. Preparation of sorghum reconstructed spectral variety identification dataset.
[0093] 5-1. The real RGB image of the sorghum sample collected by the RGB image acquisition platform is spectrally reconstructed through the trained RA-HRNet network to obtain the reconstructed spectral image of the sorghum sample.
[0094] 5-2. Extract the spectral features, color features and texture features of the reconstructed spectral image of the sorghum sample; the sorghum sample image contains the background of the acquisition platform and the foreground of the circular culture dish covered with sorghum samples; in order to eliminate irrelevant background information and obtain the required region of interest, it is necessary to use the image processing and segmentation method used in the image, which can be seen in Figure 2 The specific steps are as follows:
[0095] (i) graying the real RGB image of the sorghum sample to obtain a grayscale image of the sorghum sample;
[0096] (ii) Debinarize the grayscale image and use adaptive thresholding to debinarize the image and segment the background and foreground using the difference in grayscale values;
[0097] (iii) Using the processed image, find the first position with a grayscale value of 0 by traversing in the four directions from right to left, from left to right, from bottom to top, and from top to bottom, and then obtain the extreme points of the culture dish in the row and column: max_x, min_x, max_y, min_y;
[0098] (iv) intercept the sample image inside the four poles and use the circular mask to generate the region of interest; then intercept 7 non-intersecting square regions of interest (length × width: 180 × 180) in the circular region of interest, and then extract the spectral features, color features and texture features in the region based on the position information of each square;
[0099] (v) Data fusion: refers to the serial concatenation of data blocks, as follows:
[0100] Data block 1: Data block 2:
[0101] After splicing the two:
[0102] 5-3. Dataset creation. The extracted sorghum sample feature information is labeled with its corresponding variety to obtain a sorghum reconstructed spectral variety identification dataset.
[0103] 6. BiLSTM-Attention model training.
[0104] 6-1. Build BiLSTM-Attention model: Use BiLSTM (bidirectional long short-term memory layer), Attention (multi-head self-attention layer), and output layer (fully connected layer) to build a BiLSTM-Attention sorghum variety recognition network. The overall structure of the BiLSTM-Attention model can be found in Figure 5 's hint.
[0105] 6-2. The obtained sorghum reconstructed spectral variety identification dataset is used as the training set (80%) and the test set (20%), and a BiLSTM-Attention network structure model is constructed to obtain a sorghum variety identification model.
[0106] 6-3. Model evaluation: The classic evaluation standard in machine learning, namely accuracy, is adopted. The model experiment evaluation results are shown in Table 3 below. The accuracy formula is as follows:
[0107]
[0108] In the formula, TP means that the positive sample is identified as a positive sample, which is a correct identification; FP means that the negative sample is identified as a positive sample, also known as the first type of false identification; FN means that the positive sample is identified as other categories, also known as the second type of recognition error; TN means that the negative sample is not identified as a positive sample, which is a correct identification.
[0109] Table 3 BiLSTM-Attention series model experimental results
[0110]
[0111] Note: In Table 3, H represents the parameter num_heads in the multi-head self-attention layer, Train_Acc represents the accuracy of the training set model, and Test_Acc represents the accuracy of the test set model.
[0112] 7. Prediction of the variety of sorghum samples to be tested.
[0113] The real RGB image of the sorghum sample to be tested is collected, and the spectral reconstruction is used to obtain the corresponding spectral reconstruction data. The information of the sorghum sample to be tested (including spectral features, color features and texture features) is obtained through data processing in the process of identifying the data set. After inputting it into the trained sorghum variety identification BiLSTM_Attention model, the variety prediction result of the sorghum sample to be tested can be obtained.
Claims
1. A sorghum variety identification method based on spectral image reconstruction, characterized in that: The steps include: S1, obtaining the original hyperspectral image data of the sorghum sample, performing black and white correction, and obtaining the corresponding pseudo RGB image of the sorghum sample to establish a sorghum sample spectrum reconstruction data set; at the same time, collecting the real RGB image of the sorghum; S2. Use Transformer to improve the spectral reconstruction network HRNet to obtain the RA-HRNet network. Use the sorghum sample spectral reconstruction dataset to train the RA-HRNet network and obtain the spectral reconstruction model. S3, using the collected real RGB image of sorghum, and obtaining the reconstructed spectral image of sorghum through the trained spectral reconstruction model; S4, performing data processing on the sorghum reconstructed spectral image to segment the background and foreground of the image; Traverse the image after data processing, obtain the poles on the rows and columns, intercept the sorghum sample image inside the poles, and use the mask to generate the region of interest; S5, dividing the region of interest into a plurality of non-intersecting square regions, and calculating the average spectral value of all pixels in each region to obtain a first spectral feature of the sorghum sample; S6. For the divided multiple non-intersecting square areas, the first-order moment, the second-order moment and the third-order moment of the HSV channel are used to extract the color features of the sorghum sample respectively to obtain the first image features; the texture features of the sorghum sample are extracted using the gray level co-occurrence matrix to obtain the second image features; S7. Establishing a sorghum reconstructed spectral variety recognition data set based on the first spectral feature, the first image feature, and the second image feature; S8. Build a BiLSTM_Attention network model and use the sorghum reconstructed spectrum variety recognition dataset to train the BiLSTM_Attention network model to obtain the sorghum variety recognition BiLSTM_Attention model. S9. Collect sorghum samples to be tested, use the spectral reconstruction model to process the sorghum samples to be tested, and obtain the reconstructed spectral image of the sorghum to be tested; according to the processes of S4, S5 and S6, the spectral characteristics, color characteristics and texture characteristics of the sorghum samples to be tested are obtained, and the variety of the sorghum samples to be tested is identified through the sorghum variety identification BiLSTM_Attention model to obtain the sorghum variety prediction result and confidence.
2. The sorghum variety identification method based on spectral image reconstruction according to claim 1 is characterized in that: The specific content of S1 is: collecting a hyperspectral image of a sorghum sample covering a culture dish within the visible light range to obtain original hyperspectral image data of the sorghum sample; performing black and white correction on the original hyperspectral image data, and obtaining spectral image data of 31 bands of the sorghum sample at intervals of 10 nm between 400 and 700 nm, as well as corresponding pseudo RGB images of the sorghum sample, to establish a spectral reconstruction data set of the sorghum sample; while collecting the original hyperspectral image data of the sorghum sample, using a pre-built sorghum RGB image acquisition platform to collect the real RGB image of the sorghum.
3. The sorghum variety identification method based on spectral image reconstruction according to claim 2 is characterized in that: In S1, the calculation formula for black and white correction is as follows: Where R is the rectified reflectance image of the sorghum sample; I is the original hyperspectral image of the sorghum sample; W is the standard whiteboard image; and D is the standard blackboard image.
4. The sorghum variety identification method based on spectral image reconstruction according to claim 2 is characterized in that: In S1, the process of generating the pseudo RGB image of the sorghum sample is as follows: first, the pseudo RGB image of the sorghum sample is generated by using CIE1964-X 10 T 10 Z 10 The color matching function and the sorghum spectral image data H(x,y,w) are used to obtain the XYZ image of sorghum. The conversion matrix M is then used to map the XYZ color space to the RGB color space. Finally, Gamma correction is used to convert the RGB color space to the sRGB space used in the image.
5. The sorghum variety identification method based on spectral image reconstruction according to claim 1 is characterized in that: In S2, Transformer is used to build the residual attention feature fusion network RAFN to improve the spectral reconstruction network HRNet.
6. The sorghum variety identification method based on spectral image reconstruction according to claim 2 is characterized in that: The specific content of S4 is: gray-scale processing and debinarization adaptive threshold processing are performed on the real RGB image corresponding to the sorghum reconstructed spectral image to segment the background and foreground of the image; Traverse the image after data processing, obtain the pole of the culture dish on the row and column, intercept the sorghum sample image inside the pole, and use the circular mask to generate the region of interest; Through the traversal process, find the first position where the gray value is 0, and then get the extreme points of the culture dish in the rows and columns, including: max_x, min_x, max_y, min_y.
7. The sorghum variety identification method based on spectral image reconstruction according to claim 1 is characterized in that: In S5, the region of interest is divided into 7 non-intersecting square regions; then, the calculation formula of the first spectral feature is as follows: In the formula, is the average spectral value of the corresponding matrix; m is the number of pixels in the corresponding matrix; n is the number of bands of sorghum hyperspectral data or spectral reconstruction data; I i,j is the reflectance of the j-th pixel in the i-th band.
8. The sorghum variety identification method based on spectral image reconstruction according to claim 7 is characterized in that: In S6, the first image feature is extracted from the seven non-intersecting square areas using the first-order moment, second-order moment and third-order moment of the HSV channel, and the formula is as follows: In the formula, μ i represents the first-order moment; N represents the number of pixels; p i,j Represents the i-th color component of the j-th pixel, including the color components of the three color channels H, S, and V; σ i represents the second-order moment; s i Represents the third-order moment; the first-order moment is the mean, representing the average intensity of the color component; the second-order moment is the color variance, representing the non-uniformity; the third-order moment is the skewness of the color component, representing the asymmetry.
9. The sorghum variety identification method based on spectral image reconstruction according to claim 8 is characterized in that: In S6, the gray-level co-occurrence matrix is used to extract the texture features of the sorghum sample in the square region of interest. The specific process is: first, the RGB image of the region of interest is converted into a grayscale image of a fixed level, and then the four statistics of the grayscale image, namely, energy, entropy, moment of inertia and correlation, are calculated from four directions of 0°, 45°, 90° and 135° respectively; then, the average value of the four statistical index values is used as the typicality information of the image texture feature to obtain the second image feature.
10. The sorghum variety identification method based on spectral image reconstruction according to claim 9, characterized in that: The calculation formulas for the four statistical indicator values are as follows: In the calculation formula: Where Energy represents energy, Entropy represents entropy, MOI represents moment of inertia, and COR represents correlation; L is the number of gray levels; P(i,j) is the image after conversion to level L; i is the gray value of the pixel; j is the gray value of the pixel with a fixed length step from i; μ x and y Represent the average gray value of the corresponding row and column respectively; σ x and σ y Represent the variance of the corresponding row and column respectively.
Citation Information
Patent Citations
Poa pratensis variety identification method based on hyper-spectral image
CN102706813A
Hyperspectral feature extraction method and device and storage medium
CN114742985A
Mining area semantic segmentation model construction method and device and mining area semantic segmentation method
CN115862014A