Method for identifying early barnyard grass in rice field based on ground feature spectrometer
Through the combination of handheld geotechnical spectrometer and MATLAB classification learner toolbox, the problems of high cost, insufficient accuracy and slow processing speed of rice field barnyard grass identification technology in complex environments are solved, and efficient and accurate barnyard grass identification is achieved. The modeling cost is reduced and the recognition rate reaches 95%.
Patent Information
- Application Number
- CN202411285314.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-13
- Publication Date
- 2024-12-17
AI Technical Summary
The existing rice field barnyard grass identification technology has high cost, professional dependence, insufficient accuracy in complex environments and slow processing speed, making it difficult to meet the needs of low-cost, easy operation, fast monitoring and efficient identification.
A hand-held earth object spectrometer was used to identify early barnyard grass in rice fields, and an identification model was established through spectral data acquisition, preprocessing, feature extraction and the MATLAB classification learner toolbox, and the classification model with the highest recognition rate was selected for identification.
It realizes low-cost and easy-to-operate barngrass recognition, improves identification accuracy and processing speed in complex environments, reduces modeling time cost, and the recognition rate reaches 95%.
Smart Images

Figure CN119147478A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of early identification of rice seedlings and barnyard grass in a paddy field, and in particular to a method for identifying early barnyard grass in a paddy field based on a spectrometer. Background Art
[0002] China is a large agricultural country. Rice is one of the main food crops in my country and plays a very important role in my country's national economy. It is vital to ensure the high yield and increase of rice income. For a long time, weed damage has been the main hazard to agricultural production. Barnyard grass is an important factor affecting rice yield. Its damage is manifested in its strong competitiveness, wide variety, wide spread, and fast growth rate, which will cause poor growth and reduced yield of rice. The prevention and control methods of barnyard grass usually include manual weeding (large workload and low efficiency), mechanical weeding (low precision) and chemical weeding (effectively saving manpower input, high efficiency and good prevention and control effect). Among them, the large-scale use of chemical agents to control weeds will inevitably affect the water and soil environment of farmland and pose a threat to the quality of agricultural products and food safety. Therefore, early identification of barnyard grass is a necessary prerequisite for ensuring high yield and increase of rice income.
[0003] However, in the actual rice production process, the identification of rice field barnyard grass is still in the traditional manual identification stage, and the difference between rice and barnyard grass is distinguished by the difference between the auricle and the ligule. With the development of science and technology, many emerging weed identification technologies have gradually emerged, such as weed identification technologies based on image information and spectral information.
[0004] In 2013, Chen Shuren et al. (Chen Shuren, Zou Huadong, Wu Ruimei, et al. Recognition of weedy rice in the seedling stage of paddy field based on hyperspectral imaging technology [J]. Transactions of the Chinese Society of Agricultural Machinery, 2013, 44(05): 253-257.) took weedy rice and rice with a growth period of 10 days as the research objects, collected their hyperspectral image information, filtered and preprocessed them, and used the principal component analysis method to select the characteristic images at wavelengths of 1448.89nm and 1469.89nm. During the prediction, the recall rate of weedy rice was 92.86%, and the recall rate of rice was 96.88%. In 2018, Huang Huasheng (Huang Huasheng. Research on weed recognition in paddy field based on UAV remote sensing images [D]. South China Agricultural University, 2019.) et al. used UAV remote sensing to collect remote sensing images of rice fields, and identified weeds based on a fully convolutional network, with an overall accuracy of 95.3%. In 2019, Jiang Tongtong (Jiang Tongtong. Research on classification of rice and weeds based on UAV remote sensing images [D]. South China Agricultural University, 2019.) used UAV remote sensing images to study the classification of rice and weeds, using convolutional neural networks to identify rice and weeds. Based on the Inception_v3 model, the transfer learning method was used to adapt it to the identification of rice weeds, and the comprehensive classification accuracy was significantly improved to 94.80%. In 2023, Braga et al. (Braga AF, Chiconi LA, Bacha AL, et al. Discrimination of morning glory species (Ipomoea spp.) using near-infrared spectroscopy and multivariate analysis [J]. Weed Science, 2023, 71 (2): 104-111.) used near-infrared (NIR) spectroscopy and multivariate analysis to identify three morning glory species. The NIR spectra were collected from the leaves of three morning glory species during the vegetative growth period, and the spectral band was 4000-10000 cm -1 , the accuracy of selecting the discriminant model can reach more than 98.5%.
[0005] At present, although there are various emerging technologies used to identify weeds in the field, there are still the following problems:
[0006] 1. High-cost and professional-dependent rice and barnyard grass information collection technology: Currently, rice and barnyard grass information collection mainly relies on professional instruments carried by drones to collect images and spectral data. This method not only requires professional personnel to operate, but also has high equipment purchase and maintenance costs, which greatly limits its application in extensive farmland management. Therefore, the present invention focuses on how to develop a low-cost, easy-to-operate information collection technology to achieve efficient and accurate monitoring of rice and barnyard grass.
[0007] 2. Challenges in the accuracy of barnyard grass recognition technology in complex environments: With the continuous development of barnyard grass recognition technology, although the recognition effect has been improved, under complex environmental conditions, such as light changes, plant occlusion, soil moisture, etc., the existing technology is still difficult to accurately distinguish barnyard grass from other plants. This lack of accuracy may lead to false alarms or missed alarms, which in turn affects the decision-making effect of farmland management. The present invention is committed to exploring how to improve the accuracy of barnyard grass recognition technology in complex environments, reduce false alarms and missed alarms, and ensure the accuracy and effectiveness of farmland management.
[0008] 3. Optimization requirements for the processing speed of barnyard grass identification technology: Barnyard grass identification technology requires processing a large amount of image data and performing complex algorithm calculations. This process is often time-consuming and difficult to meet the needs of real-time or rapid monitoring. The present invention focuses on how to optimize the processing speed of barnyard grass identification technology and reduce data processing time, especially in large-scale farmland management applications, to support fast and efficient farmland monitoring and decision-making. Summary of the invention
[0009] The technical problem to be solved by the present invention is to overcome the deficiencies of the prior art and provide a method for identifying early barnyard grass in rice fields based on a handheld ground object spectrometer, thereby solving the problem of difficulty in identifying early barnyard grass in rice fields.
[0010] In order to solve the above technical problems, the technical solutions proposed in the present invention are as follows: 1. A method for identifying early barnyard grass in rice fields based on a ground object spectrometer, comprising the following steps:
[0011] 1) Use a ground spectrometer to collect spectral data of early rice and barnyard grass in paddy fields and establish a sample library;
[0012] 2) The sample library is randomly divided into a calibration set and a prediction set in a ratio of 8:2;
[0013] 3) Preprocessing the collected early rice seedling and barnyard grass spectral data to remove noise; the preprocessing light includes smoothing and / or derivative; the smoothing method adopts SG convolution smoothing method, and the calculation formula is as follows:
[0014]
[0015] w represents the window coefficient, and the window width is expressed as 2w+1, X j+k represents the original value of the sample at the j+Kth wavelength point, h k represents the smoothing coefficient, and
[0016] The derivation method includes SG convolution derivation, and the calculation formula is as follows:
[0017] d^2y / dx^2≈∑(ci*yi) / h^2
[0018] Where d^2y / dx^2 represents the second-order derivative of the spectral data, ci is the polynomial coefficient in the SG algorithm, yi is the spectral data point in the window, and h is the window size.
[0019] 4) Using CARS to extract features from spectral data;
[0020] 5) Use MATLAB to establish a recognition model using the calibration set and select the best prediction model;
[0021] 6) Input the spectral data of the prediction set into the prediction model in step 5) to obtain the recognition result.
[0022] In the above-mentioned method for identifying early barnyard grass in rice fields based on a ground object spectrometer, preferably, the spectral data collection in step 1) is to randomly collect spectral information of rice seedlings and barnyard grass in the 2-4 leaf stage in the rice field, establish a sample library containing no less than 200 sets of spectral data, the spectral range is 400-1100nm, and save it in TXT format.
[0023] In the above-mentioned method for identifying early barnyard grass in rice fields based on a ground object spectrometer, preferably, in step 4), the spectral features of early 2-4 leaves of rice and barnyard grass are extracted by using the CARS algorithm; the calling form is:
[0024] CARS=carspls(X,y,A,fold,method,num,selectLV,originalVersion,order);
[0025] Wherein, X represents the spectral data of rice seedlings and barnyard grass, y represents the category label data, A represents the maximum number of principal factors to be extracted, fold represents the fold of cross-validation, method represents the preprocessing method, num represents the number of Monte Carlo sampling runs, selectLV represents the method of selecting the optimal number of principal factors, originalVersion represents the called CARS version, and order represents the arrangement order of samples; in the present invention, A is 10, fold is 10, method is 'center', num is 100, selectLV is 1, originalVersion is 0, and order is 0.
[0026] In the above-mentioned method for identifying early barnyard grass in paddy fields based on a ground object spectrometer, preferably, the step 5) of using MATLAB to establish an identification model using a calibration set includes the following steps:
[0027] ① Establish multiple classification models for early rice seedlings and barnyard grass in the MATLAB classification learner toolbox;
[0028] ② Import the calibration set data in step 2) into the MATLAB classification learner;
[0029] ③Select all classification models in the MATLAB Classification Learner Toolbox in step ①;
[0030] ④ Conduct model training;
[0031] ⑤ Select a classification model that can identify early barnyard grass in rice fields on the prediction set with a recognition rate of 95% to obtain a prediction model.
[0032] Compared with the prior art, the invention has the advantages that the method for identifying early barnyard grass in rice fields based on a ground object spectrometer can select a classification model with the highest recognition rate from multiple classification models to identify early rice seedlings and barnyard grass, thereby achieving a high recognition rate for early barnyard grass. At the same time, modeling is performed using the classification learner toolbox provided by MATLAB, which facilitates subsequent transfer of the model to hardware deployment and reduces the time cost of modeling. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 This is a step diagram of the method for identifying early barnyard grass in rice fields based on a ground object spectrometer in Example 1. DETAILED DESCRIPTION
[0034] In order to facilitate the understanding of the present invention, the present invention will be described more comprehensively and carefully in combination with preferred embodiments below, but the protection scope of the present invention is not limited to the following specific embodiments.
[0035] It should be noted that when an element is described as being "fixed, fixed, connected or connected to" another element, it can be directly fixed, fixed, connected or connected to the other element, or it can be indirectly fixed, fixed, connected or connected to the other element through other intermediate connectors.
[0036] Unless otherwise defined, all the professional terms used below have the same meanings as those generally understood by those skilled in the art. The professional terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the scope of protection of the present invention.
[0037] Example 1
[0038] The present embodiment provides a method for identifying early barnyard grass in rice fields based on a ground object spectrometer, wherein the ground object spectrometer is a handheld ground object spectrometer. Figure 1 As shown, the following steps are included:
[0039] Step 1) using a handheld ground spectrometer to randomly collect spectral information of rice seedlings and barnyard grass at 2-4 leaf stages in a paddy field under clear and cloudless weather, and establish a sample library containing no less than 200 sets of spectral data;
[0040] Step 2) The sample library is randomly divided into a calibration set and a prediction set in a ratio of 8:2;
[0041] The sample set division is performed using the built-in functions datasample (Ge Huifang. Optimization of characteristic wavelengths of near-infrared spectra for soybean oil acid value [D]. Harbin University of Commerce, 2016.) and setdiff (Ge Huifang. Optimization of characteristic wavelengths of near-infrared spectra for soybean oil acid value [D]. Harbin University of Commerce, 2016.) of MATLAB software (Wang Lei, Qin Hong, Li Jing, et al. Identification of the origin of Ningxia wolfberry based on near-infrared hyperspectral images [J]. Spectroscopy and Spectral Analysis, 2020, 40(04): 1270-1275.). This example uses the following calling form:
[0042] Cal=datasample(a,k);
[0043] [Val,ia]=setdiff(a,Cal,'rows');
[0044] Wherein, Cal represents the calibration set, a represents the sample library, k represents the number of samples in the calibration set, Val represents the prediction set, and ia represents the row number of the prediction set. In this embodiment, the value of k is 231.
[0045] In this embodiment, the development environment and development tools are selected, where the hardware environment includes: AMD Ryzen 536006-Core Processor, 32GB of installed memory, and 2TB of hard disk memory; the software environment includes at least Windows 10 Education Edition, 64-bit operating system; the development tool selects MATLAB R2022a for related operations.
[0046] Step 3) preprocessing the collected spectral data;
[0047] Spectral preprocessing includes two directions: smoothing and / or differentiation;
[0048] The smoothing method uses the SG convolution smoothing method, and the calculation formula is as follows:
[0049]
[0050] In formula (1), w represents the window coefficient, the window width is expressed as 2w+1, and X j+k represents the original value of the sample at the j+Kth wavelength point, h k represents the smoothing coefficient, and
[0051] The derivation method includes SG convolution derivation and direct difference derivation. The present invention adopts SG convolution derivation method, and the calculation formula is as follows:
[0052] d^2y / dx^2≈Σ(ci*yi) / h^2(2);
[0053] Where d^2y / dx^2 represents the second-order derivative of the spectral data, ci is the polynomial coefficient in the SG algorithm, yi is the spectral data point in the window, and h is the window size.
[0054] In this embodiment, the size of the smoothing window is 5, the size of the derivative window is 5, and the derivative order is 2.
[0055] Step 4) CARS (AHL, AYL, BQX, et al. Key wavelengths screening using competitive adaptive reweighted sampling method for multivariate calibration [J]. Analytica Chimica Acta, 2009, 648 (1): 77-84) is used to extract features from spectral data to reduce the difficulty of modeling;
[0056] Spectral features are extracted using MATLANB R2022a through the CARS algorithm. Its calling form is:
[0057] CARS=carspls(X,y,A,fold,method,num,selectLV,originalVersion,order);
[0058] Where X represents spectral data, y represents category label data, A represents the maximum number of principal factors to be extracted, fold represents the number of cross-validation folds, method represents the preprocessing method, num represents the number of Monte Carlo sampling runs, selectLV represents the method of selecting the optimal number of principal factors, originalVersion represents the CARS version called, and order represents the order of sample arrangement. In this example, A is 10, fold is 10, method is 'center', num is 100, selectLV is 1, originalVersion is 0, and order is 0.
[0059] Step 5) Use MATLAB to establish a recognition model using the calibration set; the details are as follows:
[0060] ① Establish multiple classification models for early rice seedlings and barnyard grass in the MATLAB classification learner toolbox; the classification models include fine tree, medium tree, coarse tree, linear discriminant, quadratic discriminant, logistic regression, Gaussian naive Bayes, kernel naive Bayes, linear SVM, quadratic SVM, cubic SVM, fine Gaussian SVM, medium Gaussian SVM, coarse Gaussian SVM, fine KNN, medium KNN, coarse KNN, cosine KNN, cubic KNN, weighted KNN, boosted tree, bagged tree, subspace discriminant, subspace KNN, RUSBoosted tree, narrow neural network, wide neural network, two-layer neural network, three-layer neural network, SVM kernel, logistic regression kernel and other modeling methods.
[0061] ② Import the calibration set data in step 2) into the MATLAB classification learner;
[0062] ③Select all classification models in the MATLAB Classification Learner Toolbox in step ①;
[0063] ④ Perform model training; in this embodiment, a cross-validation method is used for model training, and the cross-validation fold is set to 5.
[0064] ⑤ Select the classification model with a recognition rate of 95% for early barnyard grass in rice fields on the prediction set to obtain the prediction model. As shown in the following table, all the classification models in step ① recognize early barnyard grass in rice fields on the validation set, and their respective recognition rates are as follows. From the table below, it can be seen that the model constructed based on kernel SVM performs best in this example, so it is derived as a classification model in this embodiment.
[0065]
[0066]
[0067] The method for identifying early barnyard grass in rice fields based on a ground object spectrometer of the present invention can select a classification model with the highest recognition rate from multiple classification models to identify early rice seedlings and barnyard grass, thereby having a high recognition rate for early barnyard grass. At the same time, modeling is performed through the classification learner toolbox provided by MATLAB, which facilitates the subsequent transfer of the model to hardware deployment and reduces the time cost of modeling.
Claims
1. A method for identifying early barnyard grass in rice fields based on ground spectrometer. It is characterized by: The following steps are involved: 1) Use a ground spectrometer to collect spectral data of early rice and barnyard grass in paddy fields and establish a sample library; 2) The sample library is randomly divided into a calibration set and a prediction set in a ratio of 8:2; 3) Preprocessing the collected early rice seedling and barnyard grass spectral data to remove noise; the preprocessing light includes smoothing and / or derivative; the smoothing method adopts SG convolution smoothing method, and the calculation formula is as follows: w represents the window coefficient, and the window width is expressed as 2w+1, X j+k represents the original value of the sample at the j+Kth wavelength point, h k represents the smoothing coefficient, and The derivation method includes SG convolution derivation, and the calculation formula is as follows: d^2y / dx^2≈∑(ci*yi) / h^2 Where d^2y / dx^2 represents the second-order derivative of the spectral data, ci is the polynomial coefficient in the SG algorithm, yi is the spectral data point in the window, and h is the window size. 4) Using CARS to extract features from spectral data; 5) Use MATLAB to establish a recognition model using the calibration set and select the best prediction model; 6) Input the spectral data of the prediction set into the prediction model in step 5) to obtain the recognition result.
2. The method for identifying early barnyard grass in rice fields based on a ground object spectrometer according to claim 1, Features: The step 1) of spectral data collection is to randomly collect spectral information of rice seedlings and barnyard grass at 2-4 leaf stages in the rice fields, and establish a sample library containing no less than 200 sets of spectral data, with a spectral range of 400-1100nm.
3. The method for identifying early barnyard grass in rice fields based on a ground object spectrometer according to claim 1, Features: In the step 4), the spectral characteristics of early 2-4 leaf rice and barnyard grass are extracted by CARS algorithm; Its calling form is: CARS=carspls(X,y,A,fold,method,num,selectLV,originalVersion,order); Wherein, X represents the spectral data of rice seedlings and barnyard grass, y represents the category label data, A represents the maximum number of principal factors to be extracted, fold represents the fold of cross-validation, method represents the preprocessing method, num represents the number of Monte Carlo sampling runs, selectLV represents the method of selecting the optimal number of principal factors, originalVersion represents the called CARS version, and order represents the arrangement order of samples; in the present invention, A is 10, fold is 10, method is 'center', num is 100, selectLV is 1, originalVersion is 0, and order is 0.
4. The method for identifying early barnyard grass in rice fields based on a ground object spectrometer according to claim 1, Features: In the step 5), using MATLAB to use the calibration set to establish the recognition model includes the following steps: ① Establish multiple classification models for early rice seedlings and barnyard grass in the MATLAB classification learner toolbox; ② Import the calibration set data in step 2) into the MATLAB classification learner; ③Select all classification models in the MATLAB Classification Learner Toolbox in step ①; ④ Conduct model training; ⑤ Select a classification model that can identify early barnyard grass in rice fields on the prediction set with a recognition rate of 95% to obtain a prediction model.
