Method for detecting sugar degree of citrus reiculata Blanco based on hyperspectral image
Through the hyperspectral image detection method based on lightweight convolutional neural network, the complexity and resource waste of Wogan sugar content detection are solved, lossless and efficient sugar content detection and automatic sorting are achieved, and detection accuracy and efficiency are improved.
Patent Information
- Application Number
- CN202410972935.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-08
AI Technical Summary
The existing Wogan fruit sugar content detection methods have problems such as complex detection steps, complex operation, low accuracy and waste of resources. In particular, traditional methods require breaking the fruit for testing, which is inefficient and difficult to meet the fruit grading needs.
The initial Wogan sugar level detection model is constructed based on lightweight convolutional neural network. Through pre-processing and training of hyperspectral data and sugar level data, lossless Wogan sugar level detection is achieved. The data is collected and corrected by using a hyperspectral camera, combined with Convolutional neural networks perform sugar level prediction.
It improves the efficiency and accuracy of the detection of the wogan sugar content, reduces fruit waste, and makes it possible to automatically sort the wogan fruit sugar content, meeting the needs of fruit grading.
Smart Images

Figure CN118918474A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of agricultural informatization, and in particular relates to a method for detecting the sugar content of mandarin oranges based on hyperspectral images. Background Art
[0002] The soluble sugar content in Wogan fruit is an important quality indicator. At present, the quality inspection of Wogan fruit mainly includes physical and chemical property inspection and analysis, electrical property inspection and analysis, and machine vision inspection and analysis. Among them: physical and chemical property inspection is relatively accurate for fruit inspection, but the inspection steps are complicated and lossy. Although the electrical property inspection is relatively accurate, the operation is complicated and easily interfered. Although machine vision inspection is non-destructive, it requires inspectors to have high learning ability and solid professional knowledge. In addition, since the existing inspection method only uses the data of the three RGB channels, although the inspection efficiency is improved, its inspection accuracy is not high, which is difficult to meet the needs of fruit grading.
[0003] Currently, fruit quality grading still relies mainly on manual sugar content testing and weight testing. Because sugar content testing requires breaking open the mandarin oranges, it is inefficient and is also a destructive test. After testing, the mandarin oranges can only be discarded, resulting in a waste of resources. Summary of the invention
[0004] In order to solve the above technical problems, the present invention proposes a method for detecting the sugar content of mandarin oranges based on hyperspectral images to solve the problems existing in the above prior art.
[0005] To achieve the above object, the present invention provides a method for detecting the sugar content of mandarin oranges based on hyperspectral images, comprising the following steps:
[0006] Build an initial Wogan sugar content detection model based on a lightweight convolutional neural network;
[0007] Collecting hyperspectral data and sugar content data of Wogan, and preprocessing the hyperspectral data to obtain preprocessed data;
[0008] The pre-processed data is used as training sample sugar content data as labels to train an initial Wogan sugar content detection model to obtain a Wogan sugar content detection model;
[0009] The hyperspectral data of the mandarin orange to be detected is collected and corrected to obtain the hyperspectral data to be detected, and the hyperspectral data to be detected is input into the mandarin orange sugar content detection model to obtain the sugar content of the mandarin orange to be detected.
[0010] Preferably, the method for constructing an initial Wogan sugar content detection model comprises:
[0011] The traditional convolution of the first layer of the lightweight convolutional neural network is replaced with dynamic convolution; the pool7x7 of the 14th layer is replaced with global average pooling; and the 1x1 convolution of the last layer originally used for classification is replaced with a fully connected layer.
[0012] Preferably, the method for collecting hyperspectral data of Wogan includes:
[0013] Pick ripe mandarin oranges and place them on a diffuse reflective white board;
[0014] Use a hyperspectral camera to photograph the mandarin oranges and mark the photographed surface to obtain initial hyperspectral data;
[0015] The initial hyperspectral data are spectrally corrected by using a diffuse reflection white board to obtain the hyperspectral data of the mandarin orange.
[0016] Preferably, the method for collecting sugar content data includes:
[0017] Cut open the mandarin oranges that have completed hyperspectral data collection;
[0018] The sugar content of half of the oranges in the shooting direction was tested using a handheld sugar meter to obtain the sugar content data of the oranges.
[0019] Preferably, the method of performing spectral correction on the initial hyperspectral data by using a diffuse reflection whiteboard includes background signal removal, linear correction, baseline correction and normalization processing.
[0020] Preferably, the method for removing background signals comprises:
[0021] Firstly, the RGB image corresponding to the hyperspectral data is binarized by the threshold method to obtain a binarized image. Then, the fruit area is extracted from the binarized image by the connected domain extraction algorithm to obtain a rectangular bounding box of the mandarin orange fruit. The hyperspectral data is cropped according to the four vertices of the bounding box to obtain the hyperspectral data without the background signal.
[0022] Preferably, the method for preprocessing the hyperspectral data includes:
[0023] The hyperspectral data and the sugar content data are made into a data set;
[0024] Performing dimensionality reduction processing on the data set by using PCA principal component analysis algorithm;
[0025] The dataset after dimensionality reduction is divided into a training set and a validation set.
[0026] Compared with the prior art, the present invention has the following advantages and technical effects:
[0027] The present invention discloses a method for detecting the sugar content of Wogan based on hyperspectral images, comprising the following steps: constructing an initial Wogan sugar content detection model based on a lightweight convolutional neural network; collecting hyperspectral data and sugar content data of Wogan, preprocessing the hyperspectral data to obtain preprocessed data; using the preprocessed data as training sample sugar content data as labels to train the initial Wogan sugar content detection model to obtain the Wogan sugar content detection model; collecting hyperspectral data of Wogan to be detected and performing correction processing to obtain hyperspectral data to be detected, inputting the hyperspectral data to be detected into the Wogan sugar content detection model to obtain the sugar content of the Wogan to be detected. This method realizes lossless sugar content detection of Wogan by collecting hyperspectral data of Wogan and combining it with a convolutional neural network model. Compared with the traditional lossy sugar content detection method, the present invention not only improves the detection efficiency, but also reduces the waste of fruit. It makes it possible to automatically sort the sugar content of Wogan fruit in the future. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0029] Figure 1 This is a flow chart of a method for detecting the sugar content of mandarin oranges based on hyperspectral images according to an embodiment of the present invention;
[0030] Figure 2 This is a data collection flow chart of an embodiment of the present invention;
[0031] Figure 3 This is a flow chart of model training in an embodiment of the present invention;
[0032] Figure 4 This is a flow chart of sugar content prediction according to an embodiment of the present invention. DETAILED DESCRIPTION
[0033] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0034] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0035] Embodiment 1
[0036] like Figure 1-4 As shown, this embodiment provides a method for detecting the sugar content of mandarin oranges based on hyperspectral images, comprising the following steps:
[0037] S1. Build an initial sugar content detection model for Wogan fruit based on lightweight convolutional neural network;
[0038] Hyperspectral data is a high-dimensional matrix data of 640x640x256, which will make the model parameters very large. Therefore, a lightweight convolutional neural network MobileNet v3 small is used as the basic model for Wogan quality grading, and improvements are made on its basis. The main points are: first, the traditional convolution conv2d of the first layer is replaced with dynamic convolution ODconv2d, so that the network can dynamically adjust the convolution weight according to the input to improve network performance; then the pool 7x7 of the 14th layer is replaced with the global average pooling GAP; the last layer of 1x1 convolution conv2d originally used for classification is replaced with the fully connected layer FC, so that the network is suitable for sugar content regression analysis. The improved network structure is shown in the following table:
[0039]
[0040]
[0041] S2, collecting hyperspectral data and sugar content data of Wogan, and preprocessing the hyperspectral data to obtain preprocessed data;
[0042] To ensure the integrity of data distribution, hyperspectral data and sugar content data of mature mandarin oranges were collected at different periods.
[0043] 1. Hyperspectral Data Collection
[0044] (1) picking mature mandarin oranges;
[0045] (2) placing the harvested mandarin oranges on a diffuse reflection white board;
[0046] (3) Use a hyperspectral camera to photograph the mandarin oranges and mark the photographed surface;
[0047] (4) Spectral correction is performed on the spectral data using a diffuse reflection whiteboard to ensure the accuracy of the measurement results.
[0048] The method for spectral correction is as follows:
[0049] Removing background signals: First, the RGB image corresponding to the hyperspectral data is binarized using the threshold method, and then the fruit area is extracted using the connected domain extraction algorithm to obtain the rectangular bounding box of the mandarin orange fruit. The hyperspectral data is cropped according to the four vertices of the bounding box to remove the background signal.
[0050] Linear correction: By filtering the spectral image, the burrs and white noise in the hyperspectral data are removed, which is completed through the linear correction function of the Omnic software.
[0051] Baseline correction: It is mainly used to eliminate the influence of the background signal of the hyperspectral instrument itself on the hyperspectral data, which is completed through the automatic baseline correction of the omnic software.
[0052] Normalization processing: Taking the spectral data of the diffuse reflectance white board as a benchmark, the data range of the spectral data of each fruit is adjusted to between [0,1] to speed up the convergence of the subsequent convolutional neural network.
[0053] 2. Sugar content data collection
[0054] (1) Cutting the mandarin oranges for which hyperspectral data collection has been completed;
[0055] (2) Use a handheld saccharimeter to test the saccharimetry of half of the oranges in the shooting direction and record the saccharimetry data.
[0056] S3, using the pre-processed data as training sample sugar content data as labels to train an initial Wogan sugar content detection model to obtain a Wogan sugar content detection model; the training method is as follows:
[0057] (1) The collected hyperspectral data and sugar content data are made into a data set, in which the hyperspectral data is used as a training sample and the sugar content data is used as a label;
[0058] (2) The data dimension of hyperspectral data is high, with 256 channels, which is redundant. The PCA algorithm is used to reduce the data dimension and reduce the number of channels to 32.
[0059] (3) Divide the reduced-dimensional data set into a training set and a test set;
[0060] (4) Send the training set to the improved MobileNet v3, train the network until convergence, and save the network weights.
[0061] S4, collect the hyperspectral data of the mandarin orange to be detected and perform correction processing to obtain the hyperspectral data to be detected, input the hyperspectral data to be detected into the mandarin orange sugar content detection model to obtain the sugar content of the mandarin orange to be detected. The specific steps of prediction are as follows:
[0062] (1) picking the tested mandarin oranges;
[0063] (2) placing the harvested mandarin oranges on a diffuse reflection white board;
[0064] (3) Use a hyperspectral camera to photograph the mandarin oranges;
[0065] (4) Spectral correction of spectral data using a diffuse reflection whiteboard;
[0066] (5) Load the trained network weights into the improved MobileNet v3 small;
[0067] (6) Input the corrected hyperspectral data into MobileNet v3 small to obtain the sugar content prediction result.
[0068] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for detecting sugar content of mandarin oranges based on hyperspectral images, characterized in that: The following steps are involved: Build an initial Wogan sugar content detection model based on a lightweight convolutional neural network; Collecting hyperspectral data and sugar content data of Wogan, and preprocessing the hyperspectral data to obtain preprocessed data; The pre-processed data is used as training sample sugar content data as labels to train an initial Wogan sugar content detection model to obtain a Wogan sugar content detection model; The hyperspectral data of the mandarin orange to be detected is collected and corrected to obtain the hyperspectral data to be detected, and the hyperspectral data to be detected is input into the mandarin orange sugar content detection model to obtain the sugar content of the mandarin orange to be detected.
2. The method for detecting the sugar content of mandarin oranges based on hyperspectral images according to claim 1, characterized in that: The method for constructing an initial Wogan sugar content detection model comprises: The traditional convolution of the first layer of the lightweight convolutional neural network is replaced with dynamic convolution; the pool7x7 of the 14th layer is replaced with global average pooling; and the 1x1 convolution of the last layer originally used for classification is replaced with a fully connected layer.
3. The method for detecting the sugar content of mandarin oranges based on hyperspectral images according to claim 1, characterized in that: The methods for collecting hyperspectral data of Wogan include: Pick ripe mandarin oranges and place them on a diffuse reflective white board; Use a hyperspectral camera to photograph the mandarin oranges and mark the photographed surface to obtain initial hyperspectral data; The initial hyperspectral data are spectrally corrected by using a diffuse reflection white board to obtain the hyperspectral data of the mandarin orange.
4. The method for detecting the sugar content of mandarin oranges based on hyperspectral images according to claim 1, characterized in that: Methods for collecting sugar content data include: Cut open the mandarin oranges that have completed hyperspectral data collection; The sugar content of half of the oranges in the shooting direction was tested using a handheld sugar meter to obtain the sugar content data of the oranges.
5. The method for detecting the sugar content of mandarin oranges based on hyperspectral images according to claim 3, characterized in that: The method for performing spectral correction on the initial hyperspectral data by using a diffuse reflection white plate includes background signal removal, linear correction, baseline correction and normalization processing.
6. The method for detecting the sugar content of mandarin oranges based on hyperspectral images according to claim 5, characterized in that: The method for removing background signals comprises: Firstly, the RGB image corresponding to the hyperspectral data is binarized by the threshold method to obtain a binarized image. Then, the fruit area is extracted from the binarized image by the connected domain extraction algorithm to obtain a rectangular bounding box of the mandarin orange fruit. The hyperspectral data is cropped according to the four vertices of the bounding box to obtain the hyperspectral data without the background signal.
7. The method for detecting the sugar content of mandarin oranges based on hyperspectral images according to claim 1, characterized in that: The method for preprocessing the hyperspectral data includes: The hyperspectral data and the sugar content data are made into a data set; Performing dimensionality reduction processing on the data set by using PCA principal component analysis algorithm; The dataset after dimensionality reduction is divided into a training set and a validation set.
Citation Information
Patent Citations
Navel orange sugar degree detection method based on hyper-spectral imaging technology
CN103472031A
Method for detecting internal and external quality of Fengcheng peaches based on hyperspectrum and deep learning
CN111968080A
Method for detecting soluble solids in fruits, electronic equipment and storage medium
CN117853423A
Cited By
Preharvest citrus sugar degree nondestructive testing method and system based on hyperspectral image
CN121937992A
