Rice grain chalkiness nondestructive testing method, device, equipment and medium
Through near-infrared spectroscopy technology and machine learning algorithms, a rice grain chalk detection model is constructed, which solves the problems of low efficiency and strong subjectivity of rice chalk detection in the existing technology, and achieves fast and accurate non-destructive testing.
Patent Information
- Application Number
- CN202510069032.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2045-01-16
AI Technical Summary
The existing rice chalky detection methods are inefficient and subjective, and traditional image processing techniques are difficult to accurately distinguish between normal and chalky grains.
Near-infrared spectroscopy technology combined with machine learning algorithms is used to collect spectral data of rice grains through near-infrared spectrometer, and a rice grain chalky detection model is constructed using a self-encoder and one-dimensional convolutional neural network to realize non-destructive detection.
It realizes rapid, accurate and non-destructive detection of rice grain chalky, reduces the subjectivity and error rate of manual detection, and is suitable for on-site operation environments.
Smart Images

Figure CN119901706A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of rice quality assessment, and in particular relates to a method, device, equipment and medium for nondestructive detection of rice grain chalkiness. Background Art
[0002] As a large agricultural country, rice is the main food crop in my country, especially an important staple food in the southern region. The stability of its production is closely related to sustainable development. Therefore, ensuring high-quality and high-yield rice is not only the fundamental guarantee for improving people's quality of life, but also an important foundation for promoting stable social and economic development. High-quality rice seeds are the key factor in achieving high rice yields, which directly affects the yield and quality of rice. However, during the rice filling period, due to the influence of environmental conditions such as high or low temperature, insufficient light, and long water outage, the rice grains will not be fully filled, resulting in loose arrangement of starch granules and protein bodies in the rice endosperm, causing the rice to become chalky and easy to break during processing. Chalkiness is one of the important traits for measuring rice quality, which directly affects the appearance quality, processing quality and commodity value of rice, causing economic losses. Therefore, rice chalkiness detection is an important part of rice quality assessment, providing guidance for rice production and variety selection, and is of great significance to improving rice quality and promoting the development of the rice industry.
[0003] At present, the detection of rice chalkiness is mostly done manually, by visually observing the chalkiness of rice in polished rice samples and manually recording the chalky rice grains. This method has the disadvantages of low work efficiency, strong subjective factors, and high error rate, and it is difficult to meet the needs of modern agricultural development. It is necessary to study an efficient and accurate method for detecting rice chalkiness. In recent years, some automatic detection methods for seed quality have emerged, such as computer vision technology combined with machine learning algorithms and hyperspectral imaging combined with chemometrics. However, computer vision technology is mostly used for the detection of apparent quality and cannot directly identify whether rice grains are chalky. Although hyperspectral imaging technology can perceive the internal quality characteristics of rice grains, it requires a lot of preprocessing work, is slow and expensive, and is not suitable for field operation environments. Summary of the invention
[0004] The purpose of the present invention is to provide a method for non-destructive detection of rice grain chalkiness, which uses near-infrared spectroscopy technology to perform non-destructive detection of rice grain chalkiness, thereby solving the technical problems in the prior art that traditional manual detection methods are inefficient and easily affected by subjective factors, and traditional image processing technology is difficult to distinguish between normal grains and chalky grains.
[0005] To solve the above technical problems, the present invention is achieved through the following technical solutions:
[0006] The present invention provides a method for nondestructive detection of rice grain chalkiness, which comprises:
[0007] Using a near infrared spectrometer to collect initial spectral data of the rice grains to be tested;
[0008] The initial spectral data of the rice grains to be tested are processed using a rice grain chalkiness detection model to obtain a chalkiness detection result of the rice grains to be tested.
[0009] In one embodiment of the present invention, the rice grain chalkiness detection model is constructed in the following manner:
[0010] Using a near infrared spectrometer to collect initial spectral data of a rice grain sample, wherein the rice grain sample includes chalky rice grains and normal rice grains;
[0011] Performing data preprocessing on the initial spectral data of the rice grain sample to obtain preprocessed spectral data of the rice grain sample;
[0012] Using an autoencoder to perform feature extraction on the preprocessed spectral data of the rice grain sample to obtain a characteristic spectral data set of the rice grain sample;
[0013] According to the characteristic spectral data set of the rice grain sample, the rice grain chalkiness detection model is constructed using a one-dimensional convolutional neural network.
[0014] In one embodiment of the present invention, the method of collecting initial spectral data of rice grain samples using a near infrared spectrometer includes:
[0015] The spectral data of the rice grain sample in the wavelength range of 900nm to 1700nm are collected multiple times by using a near infrared spectrometer, and the average spectral data are calculated as the initial spectral data of the rice grain sample.
[0016] In one embodiment of the present invention, the preprocessing of the initial spectral data to obtain the preprocessed spectral data of the rice grain sample includes:
[0017] The initial spectral data is preprocessed by SG smoothing algorithm and SNV standardization to obtain preprocessed spectral data of the rice grain sample.
[0018] In one embodiment of the present invention, the extracting features of the preprocessed spectral data of the rice grain sample using an autoencoder to obtain a characteristic spectral data set of the rice grain sample includes:
[0019] The autoencoder comprises an input layer, a hidden layer and an output layer;
[0020] The input layer receives the pre-processed spectral data of the rice grain sample, and inputs the pre-processed spectral data into the hidden layer;
[0021] The hidden layer extracts hidden features in the preprocessed spectral data through weights and activation functions, and inputs the hidden features into the output layer;
[0022] The output layer reconstructs data according to the hidden features to obtain a characteristic spectrum data set of the rice grain sample.
[0023] In one embodiment of the present invention, the rice grain chalkiness detection model is constructed using a one-dimensional convolutional neural network based on the characteristic spectral dataset of the rice grain sample, comprising:
[0024] Dividing the characteristic spectrum data set into a training set and a test set according to a preset ratio;
[0025] An initial detection model is constructed using a one-dimensional convolutional neural network, the initial detection model is trained using a training set, and the performance of the initial detection model is evaluated using a test set to obtain a performance evaluation result of the initial detection model;
[0026] The initial detection model is optimized according to the performance evaluation results to obtain the final rice grain chalkiness detection model.
[0027] In one embodiment of the present invention, the one-dimensional convolutional neural network includes a first convolutional layer, an ECA module, a pooling layer, a second convolutional layer and a fully connected layer, wherein the ECA module is located between the first convolutional layer and the pooling layer for enhancing feature extraction capability.
[0028] Based on the same inventive concept, another embodiment of the present invention further provides a rice grain chalkiness nondestructive detection device, the device comprising:
[0029] A data acquisition module, used for collecting initial spectral data of the rice grains to be tested using a near infrared spectrometer;
[0030] The chalkiness detection module is used to process the initial spectral data of the rice grains to be tested using the rice grain chalkiness detection model to obtain the chalkiness detection results of the rice grains to be tested.
[0031] Based on the same inventive concept, another embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0032] one or more processors;
[0033] A storage device is used to store one or more programs. When the one or more programs are executed by the one or more processors, the electronic device implements the rice grain chalkiness nondestructive detection method as described in any of the above embodiments.
[0034] Based on the same inventive concept, another embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer, the computer executes the non-destructive detection method for chalkiness of rice grains as described in any of the above embodiments.
[0035] As described above, the present invention provides a method for nondestructive detection of rice grain chalkiness, which uses a near-infrared spectrometer to collect initial spectral data of the rice grains to be tested, and uses a rice grain chalkiness detection model to process the initial spectral data of the rice grains to be tested, so as to obtain the chalkiness detection results of the rice grains to be tested. The method is based on the rapid, accurate and non-destructive characteristics of near-infrared spectroscopy technology, and obtains the spectral data of rice grains through a near-infrared spectroscopy acquisition instrument, and then uses feature extraction and data preprocessing technology to extract the key features of chalky grains and normal grains, combined with machine learning technology to achieve nondestructive detection of rice grain chalkiness, which provides strong support for the quality monitoring of rice grains and is of great significance to improving the quality and efficiency of rice production. Of course, any product implementing the present invention does not necessarily need to achieve all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for describing the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0037] Figure 1 A schematic flow chart of a method for nondestructive detection of rice grain chalkiness provided as an exemplary embodiment of the present application.
[0038] Figure 2 A schematic diagram of the process of constructing a rice grain chalkiness detection model provided in an exemplary embodiment of the present application.
[0039] Figure 3 A schematic diagram of rice grain spectrum acquisition provided as an exemplary embodiment of the present application.
[0040] Figure 4 An initial spectral data diagram of a normal rice grain sample provided for an exemplary embodiment of the present application.
[0041] Figure 5An initial spectral data diagram of a chalky rice grain sample provided for an exemplary embodiment of the present application.
[0042] Figure 6 A preprocessed spectral data diagram of normal rice grains after correction using SG smoothing and SNV standardization provided by an exemplary embodiment of the present application.
[0043] Figure 7 A graph of preprocessed spectral data of chalky rice grains corrected by SG smoothing and SNV standardization provided in an exemplary embodiment of the present application.
[0044] Figure 8 A graph of pre-processed spectral data of normal rice grains after correction using SG smoothing and logarithmic processing provided by an exemplary embodiment of the present application.
[0045] Fig. 9 A graph of preprocessed spectral data of chalky rice grains corrected by SG smoothing and logarithmic processing provided in an exemplary embodiment of the present application.
[0046] Fig.10 A schematic diagram of a network structure for feature extraction using an autoencoder provided in an exemplary embodiment of the present application.
[0047] Fig.11 A schematic diagram of the structure of a one-dimensional convolutional neural network provided for an exemplary embodiment of the present application.
[0048] Fig.12 A schematic diagram of the network structure of an ECA module provided for an exemplary embodiment of the present application.
[0049] Fig.13 A schematic structural diagram of a rice grain chalkiness nondestructive testing device provided as another exemplary embodiment of the present application.
[0050] Fig.14 A schematic structural diagram of an electronic device provided for another exemplary embodiment of the present application. DETAILED DESCRIPTION
[0051] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0052] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0053] In the following description, numerous details are discussed to provide a more thorough explanation of the embodiments of the present invention. However, it is obvious to those skilled in the art that the embodiments of the present invention can be implemented without these specific details. In other embodiments, well-known structures and devices are shown in the form of block diagrams rather than in detail to avoid making the embodiments of the present invention difficult to understand.
[0054] At present, rice chalkiness detection mostly adopts manual methods, but manual detection methods have disadvantages such as low efficiency, strong subjectivity, and high error rate. In addition, computer vision technology is mostly used for the detection of apparent quality, and cannot directly identify whether rice grains are chalky. At the same time, although hyperspectral imaging technology can perceive the internal quality characteristics of rice grains, it requires a lot of preprocessing work, is slow and expensive, and is not suitable for on-site operation environments.
[0055] In order to solve the technical problems that the traditional manual detection method in the prior art is inefficient and easily affected by subjective factors, and the traditional image processing technology is difficult to distinguish between normal rice grains and chalky rice grains, the present invention provides a rice grain chalkiness non-destructive detection method, based on the characteristics of near infrared spectroscopy technology, which is fast, accurate and non-destructive, and obtains the spectral data of the rice grains to be tested by a near infrared spectroscopy acquisition instrument, and then uses feature extraction and data preprocessing technology to extract the key features of the rice grains, and combines machine learning technology to achieve non-destructive detection of the chalkiness of the rice grains to be tested. This method provides strong support for the quality monitoring of rice grains, and is of great significance to improving the quality and efficiency of rice production.
[0056] See also Figure 1 As shown, the rice grain chalkiness nondestructive detection method comprises the following steps:
[0057] S100: using a near infrared spectrometer to collect initial spectral data of the rice grains to be tested;
[0058] S200: using a rice grain chalkiness detection model to process the initial spectral data of the rice grain to be tested, so as to obtain a chalkiness detection result of the rice grain to be tested.
[0059] It should be noted that before conducting the chalkiness detection of the rice grains to be tested, a specific rice grain chalkiness detection model needs to be constructed in advance.
[0060] See also Figure 2 As shown, the construction of the rice grain chalkiness detection model includes the following steps:
[0061] S010: collecting initial spectral data of rice grain samples using a near infrared spectrometer, wherein the rice grain samples include chalky rice grains and normal rice grains;
[0062] S020: performing data preprocessing on the initial spectral data of the rice grain sample to obtain preprocessed spectral data of the rice grain sample;
[0063] S030: extracting features from the preprocessed spectral data of the rice grain sample using an autoencoder to obtain a characteristic spectral dataset of the rice grain sample;
[0064] S040: Based on the characteristic spectral data set of the rice grain sample, a one-dimensional convolutional neural network is used to construct the rice grain chalkiness detection model.
[0065] The steps for constructing the above rice grain chalkiness detection model will be described in detail below.
[0066] First, step S010 is performed, that is, using a near-infrared spectrometer to collect initial spectral data of rice grain samples, wherein the rice grain samples include chalky rice grains and normal rice grains.
[0067] In an exemplary embodiment of the present application, in step S010, using a near infrared spectrometer to collect initial spectral data of a rice grain sample further includes:
[0068] The spectral data of the rice grain sample in the wavelength range of 900nm to 1700nm are collected multiple times by using a near infrared spectrometer, and the average spectral data are calculated as the initial spectral data of the rice grain sample.
[0069] For details, please refer to Figure 3 As shown, Figure 3A schematic flow chart of spectrum collection of rice grains is shown. Since rice grains are shelled, their features cannot be directly identified by appearance. Therefore, before spectrum collection, the shelled rice grains are numbered first, and then the spectrum data of the rice grains are collected and recorded one by one using a near-infrared spectrometer in the order of numbers. It is worth noting that in the present embodiment, the near-infrared spectrometer is a GX model Fourier transform infrared spectrometer (i.e., a GXFTIR spectrometer), and each rice grain is placed in a small ring cup matched with the near-infrared spectrometer for scanning. The small ring cup is a cylindrical glass sample jar, and the GX FTIR spectrometer can accommodate about 300 rice grains at a time, and each rice grain sample needs to be placed in the small ring cup for scanning three times. After all rice grain samples are measured, the breeders shell the rice grains in the order of numbers to determine whether they are chalky rice grains or normal rice grains. In this embodiment, a total of 316 original spectra of rice grain samples at full wavelength (900-1700nm) were collected using a near-infrared spectrometer. The initial spectrum data of the rice grain samples obtained are as follows: Figure 4 and Figure 5 As shown, Figure 4 shows the initial spectrum data of normal rice grains in the rice grain sample, Figure 5 Initial spectral data of chalky rice grains in the rice grain sample are shown.
[0070] Next, step S20 is executed, that is, data preprocessing is performed on the initial spectral data of the rice grain sample to obtain preprocessed spectral data of the rice grain sample.
[0071] In an exemplary embodiment of the present application, in step S020, the initial spectral data is preprocessed to obtain preprocessed spectral data of the rice grain sample, further comprising:
[0072] The initial spectral data is preprocessed by SG smoothing algorithm and SNV standardization to obtain preprocessed spectral data of the rice grain sample.
[0073] Specifically, the preprocessing method includes but is not limited to one or more combinations of SG smoothing (Savitzky-Golay, SG), SNV standardization (Standard Normal Variate, SNV), and logarithmic processing (LG). In this embodiment, the preprocessing method combines SG smoothing with SNV standardization, uses SG smoothing to reduce noise, and then uses SNV standardization to eliminate scattering effects, which can improve model performance. It should be noted that the SG smoothing is a data smoothing technique that smoothes data by fitting polynomials and is suitable for processing high-frequency noise in spectral data. The SNV standardization is used to eliminate the scattering effect in spectral data by calculating the mean and standard deviation of each spectral point and all spectral points at the same wavelength, and then standardizing each point to eliminate the scattering effect caused by factors such as particle size and surface roughness. The logarithmic processing is a linear transformation used to process data with a large range of variations. By compressing the dynamic range of the data, the data is made more concentrated for subsequent data analysis and modeling. Please refer to Figures 6 to 9 As shown, Figure 6 shows the pre-processed spectral data of normal rice grains after correction by SG smoothing and SNV normalization, Figure 7 shows the pre-processed spectral data of chalky rice grains corrected by SG smoothing and SNV normalization, Figure 8 shows the pre-processed spectral data of normal rice grains after correction by SG smoothing and logarithmic processing, Fig. 9 Preprocessed spectral data of chalky rice grains corrected by SG smoothing and logarithmic processing are shown.
[0074] Next, step S030 is performed, that is, using an autoencoder to perform feature extraction on the preprocessed spectral data of the rice grain sample to obtain a characteristic spectral data set of the rice grain sample.
[0075] In an exemplary embodiment of the present application, the autoencoder includes an input layer, a hidden layer and an output layer. In step S030, the autoencoder is used to extract features from the preprocessed spectral data of the rice grain sample to obtain a characteristic spectral data set of the rice grain sample, further comprising:
[0076] S031: the input layer receives the pre-processed spectral data of the rice grain sample, and inputs the pre-processed spectral data into the hidden layer;
[0077] S032: The hidden layer extracts hidden features in the preprocessed spectral data through weights and activation functions, and inputs the hidden features into the output layer;
[0078] S033: The output layer reconstructs data based on the hidden features to obtain the characteristic spectral data set of the rice grain sample.
[0079] Specifically, an autoencoder (AE) is an unsupervised learning neural network for feature learning and data dimensionality reduction. Through the encoding process, high-dimensional input data is compressed into a low-dimensional representation (hidden layer), and then through the decoding process, the input data is reconstructed (output layer), so that the reconstructed output data is as close as possible to the original input data. Please refer to Fig.10 shown Fig.10 shows the network structure of the autoencoder for feature extraction. The autoencoder includes an input layer, a hidden layer, and an output layer. The input layer is used to receive input data, that is, the preprocessed spectral data of the rice grain sample. The hidden layer is used to encode the input data and extract the hidden features in the preprocessed spectral data through weights and activation functions. The output layer is used to decode the hidden features and reconstruct the input data to obtain the characteristic spectral data set of the rice grain sample. In the network structure of the autoencoder, the input layer is x = {x1, x2, …, x n}, the middle hidden layer is h = {h1, h2, ……, h m}, where m < n, and the output layer is y = {y1, y2, …, y n}. In the encoding and decoding processes of the autoencoder, the data undergoes the following transformations:
[0080] h = f(A y x + e y )
[0081] y = g(A z h + e z )
[0082] In the formula, f and g are activation functions. In this embodiment, the activation function is the Sigmoid activation function; A y is the weight of the neurons in the input layer and the hidden layer; e y is the bias of the neurons in the input layer and the hidden layer; A z is the weight of the neurons in the output layer and the hidden layer; e z is the bias of the neurons in the output layer and the hidden layer.
[0083] It should be noted that in this embodiment, the preprocessed spectral data of the rice grain sample is subjected to feature extraction through an autoencoder, and 60 hidden features are obtained from 228 initial features.
[0084] Next, step S040 is executed, that is, based on the characteristic spectrum data set of the rice grain sample, a rice grain chalkiness detection model is constructed using a one-dimensional convolutional neural network.
[0085] In an exemplary embodiment of the present application, in step S40, the rice grain chalkiness detection model is constructed using a one-dimensional convolutional neural network according to the characteristic spectrum data set of the rice grain sample, further comprising:
[0086] S041: Dividing the characteristic spectrum data set into a training set and a test set according to a preset ratio;
[0087] S042: constructing an initial detection model using a one-dimensional convolutional neural network, training the initial detection model using a training set, and evaluating the performance of the initial detection model using a test set to obtain a performance evaluation result of the initial detection model;
[0088] S043: Optimizing the initial detection model according to the performance evaluation result to obtain the final rice grain chalkiness detection model.
[0089] In an exemplary embodiment of the present application, the one-dimensional convolutional neural network includes a first convolutional layer, an ECA module, a pooling layer, a second convolutional layer and a fully connected layer, wherein the ECA module is located between the first convolutional layer and the pooling layer for enhancing feature extraction capabilities.
[0090] Specifically, the randperm function is used to generate a random permutation index from 1 to n to shuffle the characteristic spectral data set, where n is the number of samples in the characteristic spectral data set. The shuffled data set is then divided into a training set and a test set according to a preset ratio. In this embodiment, the preset ratio is set to 8:2. Of course, in other embodiments, the preset ratio can be customized according to different scenarios and actual application requirements. Please refer to Fig.11 As shown, Fig.11The structure of the one-dimensional convolutional neural network is shown, and the one-dimensional convolutional neural network includes an input layer, a first convolutional layer, an efficient channel attention (ECA) module, a batch normalization layer, a one-dimensional maximum pooling layer, a second convolutional layer, a fully connected layer, a Softmax layer, a classification layer, and an output layer. Compared with the traditional one-dimensional convolutional neural network, the one-dimensional convolutional neural network described in this embodiment adds an ECA module, and the ECA module is located between the first convolutional layer and the pooling layer to enhance the feature extraction capability. Finally, the initial detection model is constructed based on the improved one-dimensional convolutional neural network. It is worth noting that in this embodiment, the activation function of the first convolutional layer and the second convolutional layer is a RELU activation function, the optimization algorithm selected by the initial detection model is the Adam gradient descent algorithm, and the initial learning rate is set to 0.001.
[0091] It should be noted that the ECA module learns the relationship between channels in an efficient way and dynamically adjusts the response strength of the channels accordingly, avoiding the complex dimensionality reduction operation in the traditional attention mechanism. Instead, it uses one-dimensional convolution to achieve local interaction across channels and can adaptively select the convolution kernel size, thereby reducing the number of parameters and computational complexity. Fig.12 As shown, Fig.12 shows the network structure of the ECA module, Fig.12 The size of the convolution kernel size K is adaptively determined by the number of channels C, and its calculation formula is as follows:
[0092]
[0093] In the formula, || odd It means taking the absolute value and rounding down to the nearest odd number, γ=2, b=1.
[0094] When given feature y∈R C , the efficient channel attention w can be expressed as:
[0095] w=σ(W y )
[0096] Among them, W is the learning channel attention band matrix, which can be expressed as:
[0097]
[0098] Among them, the learned channel attention band matrix W contains q*C parameters, which is less than the original channel attention mechanism. Each channel feature y m The weight w m Through the interaction with q parameters in the neighborhood, the process can be expressed as:
[0099]
[0100] The feature weights of all channels are shared, that is, w is used together v , at this time, the calculation in the above formula can be expressed by a one-dimensional convolution with a convolution kernel size of q, that is, the efficient channel attention w can be expressed as:
[0101] w = σ(Conv1D q (y))
[0102] Among them, Conv1D is a one-dimensional convolution operation.
[0103] The above formula is the calculation formula of the ECA module. The ECA module avoids the reduction of model performance caused by dimensionality reduction, thereby improving the spectral feature extraction ability of the model. The ECA module only involves a small number of parameters to suppress invalid features, so that the one-dimensional convolutional neural network obtains more robust classification clues. The input data extracts features through the first convolutional layer, and then the batch normalization layer normalizes the data to prevent the value from being too large or too small, causing the one-dimensional convolutional neural network to be unstable. Then it enters the one-dimensional maximum pooling layer with a pooling window length of 2 and a step length of 2, and the output data length is halved. Secondly, through the second convolutional layer, since the padding is set to the same, the output data length is the same as the input. Then the data is flattened through the fully connected layer and converted into prediction results of two categories. Then the output of the fully connected layer is converted into a probability distribution through the Softmax function layer, so that the sum of the predicted probabilities of the two categories is 1. Finally, the classification layer is used to calculate the cross entropy loss according to the true label and the predicted probability, which is used to update the parameters of the one-dimensional convolutional neural network during the training process, and then the rice chalkiness detection model is constructed. The rice chalkiness detection model finally outputs a predicted label. When it is classified as label "1", the rice grain sample is chalky rice grain. When it is classified as category label "2", the rice grain sample is normal rice grain, indicating that the rice quality is good.
[0104] When the rice grain detection model is constructed and fully verified to ensure its accuracy and reliability, the rice grain detection model can be used to perform chalkiness detection on the rice grains to be tested.
[0105] It should be noted that chalkiness is an important quality indicator of rice grains, which is directly related to the edible taste and nutritional value of rice. Therefore, accurate and rapid detection of chalkiness is of great significance for rice breeding, quality grading and market sales.
[0106] First, step S100 is performed, that is, using a near-infrared spectrometer to collect initial spectral data of the rice grains to be tested.
[0107] Specifically, an advanced near-infrared spectrometer is used to collect the initial spectral data of the rice grains to be tested. It should be noted that near-infrared spectroscopy is a non-destructive analysis method that can reveal the composition and properties of a substance by measuring the absorption, reflection or transmission characteristics of the molecules of a substance at a specific wavelength. Before collecting the spectral data of the rice grains to be tested, it should be ensured that the parameters of the near-infrared spectrometer are set correctly, such as the scanning range, resolution, and number of scans, in order to obtain high-quality spectral data. At the same time, in order to eliminate the influence of environmental factors, such as temperature, humidity, and light changes, appropriate measures must be taken for correction and standardization.
[0108] Next, step S200 is performed, that is, the initial spectral data of the rice grains to be tested are processed using the rice grain chalkiness detection model to obtain the chalkiness detection result of the rice grains to be tested.
[0109] Specifically, the rice grain chalkiness detection model can learn the complex relationship between spectral features and chalkiness, and predict new rice grains to be tested accordingly. During the processing, the rice grain model will perform feature extraction, dimensionality reduction, classification or regression on the input spectral data, and finally output one or more indicators characterizing the chalkiness, such as chalkiness, chalky grain rate, etc. The indicators characterizing the chalkiness will be directly used to evaluate the quality grade of the rice grains to be tested, providing a scientific basis for subsequent breeding selection, processing and market positioning.
[0110] In summary, the present invention provides a method for nondestructive detection of rice grain chalkiness, which uses a near-infrared spectrometer to collect initial spectral data of the rice grains to be tested, and uses a rice grain chalkiness detection model to process the initial spectral data of the rice grains to be tested, so as to obtain the chalkiness detection results of the rice grains to be tested. The method is based on the rapid, accurate and non-destructive characteristics of near-infrared spectroscopy technology, obtains the spectral data of rice grains through a near-infrared spectroscopy acquisition instrument, and then uses feature extraction and data preprocessing technology to extract the key features of chalky grains and normal grains, combined with machine learning technology to achieve nondestructive detection of rice grain chalkiness, which provides strong support for the quality monitoring of rice grains and is of great significance to improving the quality and efficiency of rice production.
[0111] Based on the same inventive concept, please refer to Fig.13 As shown, another embodiment of the present invention further provides a rice grain chalkiness nondestructive detection device 11, the device comprising:
[0112] The data acquisition module 111 is used to collect the initial spectrum data of the rice grains to be tested by using a near infrared spectrometer;
[0113] The chalkiness detection module 112 is used to process the initial spectral data of the rice grains to be tested by using the rice grain chalkiness detection model to obtain the chalkiness detection results of the rice grains to be tested.
[0114] Based on the same inventive concept, please refer to Fig.14 As shown, another embodiment of the present invention further provides an electronic device 1, which may include a memory 12, a processor 13 and a bus, and may also include a computer program stored in the memory 12 and executable on the processor 13, such as a non-destructive detection program for rice grain chalkiness.
[0115] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 1, such as a mobile hard disk of the electronic device 1. In other embodiments, the memory 12 can also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 1. Further, the memory 12 can also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 12 can not only be used to store application software and various types of data installed in the electronic device 1, such as the code for non-destructive detection of rice grain chalkiness, etc., but also can be used to temporarily store data that has been output or is to be output.
[0116] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 1, and uses various interfaces and lines to connect the various components of the entire electronic device 1, and executes or executes the programs or modules (such as rice grain chalkiness nondestructive detection program, etc.) stored in the memory 12, and calls the data stored in the memory 12 to execute various functions of the electronic device 1 and process data.
[0117] The processor 13 executes the operating system and various installed application programs of the electronic device 1. The processor 13 executes the application programs to implement the steps in the above-mentioned rice grain chalkiness non-destructive detection method.
[0118] Exemplarily, the computer program may be divided into one or more modules, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 1. For example, the computer program may be divided into a data acquisition module 110 and a chalkiness detection module 120.
[0119] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium, and the computer-readable storage medium can be non-volatile or volatile. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to perform part of the functions of the rice grain chalkiness non-destructive detection method described in each embodiment of the present application.
[0120] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A non-destructive detection method for rice grain chalkiness, characterized in that: include: Using a near infrared spectrometer to collect initial spectral data of the rice grains to be tested; The initial spectral data of the rice grains to be tested are processed using a rice grain chalkiness detection model to obtain a chalkiness detection result of the rice grains to be tested.
2. The method for nondestructive detection of rice grain chalkiness according to claim 1, characterized in that: The rice grain chalkiness detection model is constructed in the following manner: Using a near infrared spectrometer to collect initial spectral data of a rice grain sample, wherein the rice grain sample includes chalky rice grains and normal rice grains; Performing data preprocessing on the initial spectral data of the rice grain sample to obtain preprocessed spectral data of the rice grain sample; Using an autoencoder to perform feature extraction on the preprocessed spectral data of the rice grain sample to obtain a characteristic spectral data set of the rice grain sample; According to the characteristic spectral data set of the rice grain sample, the rice grain chalkiness detection model is constructed using a one-dimensional convolutional neural network.
3. The method for nondestructive detection of rice grain chalkiness according to claim 2, characterized in that: The method of collecting initial spectral data of rice grain samples by using a near infrared spectrometer comprises: The spectral data of the rice grain sample in the wavelength range of 900nm to 1700nm are collected multiple times by using a near infrared spectrometer, and the average spectral data are calculated as the initial spectral data of the rice grain sample.
4. The method for nondestructive detection of rice grain chalkiness according to claim 2, characterized in that: The preprocessing of the initial spectral data to obtain preprocessed spectral data of the rice grain sample includes: The initial spectral data is preprocessed by SG smoothing algorithm and SNV standardization to obtain preprocessed spectral data of the rice grain sample.
5. The method for nondestructive detection of rice grain chalkiness according to claim 2, characterized in that: The method of extracting features from the preprocessed spectral data of the rice grain sample using an autoencoder to obtain a characteristic spectral data set of the rice grain sample includes: The autoencoder comprises an input layer, a hidden layer and an output layer; The input layer receives the pre-processed spectral data of the rice grain sample, and inputs the pre-processed spectral data into the hidden layer; The hidden layer extracts hidden features in the preprocessed spectral data through weights and activation functions, and inputs the hidden features into the output layer; The output layer reconstructs data according to the hidden features to obtain a characteristic spectrum data set of the rice grain sample.
6. The method for nondestructive detection of rice grain chalkiness according to claim 2, characterized in that: The method of constructing the rice grain chalkiness detection model using a one-dimensional convolutional neural network based on the characteristic spectrum data set of the rice grain sample comprises: Dividing the characteristic spectrum data set into a training set and a test set according to a preset ratio; An initial detection model is constructed using a one-dimensional convolutional neural network, the initial detection model is trained using a training set, and the performance of the initial detection model is evaluated using a test set to obtain a performance evaluation result of the initial detection model; The initial detection model is optimized according to the performance evaluation results to obtain the final rice grain chalkiness detection model.
7. The method for nondestructive detection of rice grain chalkiness according to claim 2, characterized in that: The one-dimensional convolutional neural network includes a first convolutional layer, an ECA module, a pooling layer, a second convolutional layer and a fully connected layer, wherein the ECA module is located between the first convolutional layer and the pooling layer to enhance feature extraction capabilities.
8. A non-destructive detection device for rice grain chalkiness, characterized in that: The device comprises: A data acquisition module, used for collecting initial spectral data of the rice grains to be tested using a near infrared spectrometer; The chalkiness detection module is used to process the initial spectral data of the rice grains to be tested using the rice grain chalkiness detection model to obtain the chalkiness detection results of the rice grains to be tested.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the rice grain chalkiness nondestructive detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of a computer, the computer is caused to execute the rice grain chalkiness nondestructive detection method as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for obtaining chalkiness of rice grains and cooking utensil
CN111435541A
Agricultural product detection method and device, electronic equipment and computer readable storage medium
CN117392432A
Deep learning-based method for updating spectral analysis model for fruit
WO2023077569A1