Hyperspectral data-based fruit sweetness grade classification method

By designing a high-precision end-to-end fruit sweetness rating classification network based on hyperspectral data, the problem of difficult fruit sweetness detection in the existing technology is solved, and lightweight and high-precision sweetness rating classification is realized, which is suitable for practical application scenarios such as fruit sorting and quality evaluation.

CN119762862APending Publication Date: 2025-04-04GUILIN UNIV OF ELECTRONIC TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411846163.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The prior art is difficult to achieve high-precision, lossless and fast fruit sweetness detection, and traditional methods have problems such as loss, high cost, and cumbersome operation.

Method used

A high-precision end-to-end fruit sweetness rating classification network based on hyperspectral data is designed. Features are extracted by convolutional parts and classified in combination with fully connected parts, and the sweetness rating of the fruit is finally output.

Benefits of technology

It realizes high-precision and lossless fruit sweetness grade classification, reduces detection costs, is suitable for practical application scenarios such as fruit sorting and quality evaluation, and promotes the intelligent and automated development of the agricultural field.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762862A_ABST
    Figure CN119762862A_ABST
Patent Text Reader

Abstract

The invention provides a hyperspectral data-based fruit sweetness grade classification method, which comprises the following steps of: shooting a hyperspectral image by using a hyperspectral camera (350nm-950nm), obtaining hyperspectral data through hyperspectral analysis, labeling sample sweetness by using a sugarmeter, dividing sweetness grades into three classes, and designing a high-precision end-to-end fruit sweetness grade classification network aiming at hyperspectral data. The network structure is divided into two parts, the first part is a convolution part which is responsible for feature extraction, high-level features are extracted layer by layer by adopting a method of combining depth separable convolution and standard convolution, and the features are compressed by utilizing global average pooling; feature classification is carried out on the full-connection part, the structure of the full-connection part comprises a linear layer, a batch normalization layer, an activation function, a discard layer and the like, and finally probabilities of three categories are output through Softmax. According to the algorithm, hyperspectrum and deep learning are combined, fruit sweetness grades are classified in a high-precision and lossless mode, cost is reduced, the algorithm is suitable for application scenes such as fruit sorting and quality evaluation, and agricultural intelligent development is promoted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a deep learning network capable of classifying the sweetness level of fruits according to hyperspectral data, and belongs to the technical field related to hyperspectral analysis. Background Art

[0002] The sweetness and pH of fruits are important evaluation criteria for fruit quality, and the detection of fruit sweetness and pH through hyperspectral technology is an emerging and effective detection method. In recent years, as consumers' requirements for fruit quality have increased, sweetness has become one of the important indicators for evaluating fruit quality. Traditional sweetness detection methods usually require destructive sampling or time-consuming chemical analysis, which makes it difficult to achieve rapid and non-destructive detection. Hyperspectral technology, with its ability to capture rich information within the spectral range, provides new possibilities for non-destructive detection of fruit sweetness. However, accurately classifying the key features in hyperspectral data is still a technical difficulty currently faced.

[0003] In the related art, it is usually based on lossy chemical detection and non-destructive near-infrared spectroscopy detection. The methods used are usually based on traditional mathematical linear relationships, machine learning SVM, PLS and other methods. Lossy chemical detection methods will cause fruit loss and can only play a role in sampling detection. When facing large-scale product detection, its performance cannot meet the actual needs. Non-destructive near-infrared spectroscopy detection still has the following shortcomings: traditional mathematical linear relationships, machine learning SVM, PLS and other methods are difficult to meet the actual needs in terms of high precision, lightweight and high-speed detection. For example: the existing invention "fruit sweetness detection device and detection method combined with artificial intelligence and spectral detection combined with artificial intelligence and spectral detection fruit sweetness detection device and detection method" (TW108141552A) has the disadvantages of limited deployment and cloud dependence; "a method, device, system and storage medium for detecting fruit sweetness" (CN201911089371), combined with magnetic resonance imaging based on traditional mathematical linear relationship design formula to achieve detection, has the disadvantages of high cost and cumbersome operation. Therefore, the current existing fruit sweetness level classification algorithm needs to be improved.

[0004] The invention discloses a fruit sweetness grade classification method based on hyperspectral data. A hyperspectral camera (350nm-950nm) is used to capture hyperspectral images, hyperspectral data is obtained through hyperspectral analysis, the sweetness value of each sample is measured and annotated through a saccharimeter, and the sweetness grade is divided into three categories, namely, Not sweet, Perfect and Too sweet. A high-precision end-to-end fruit sweetness grade classification network for hyperspectral data is designed. The network structure is mainly divided into two parts. The first part is a convolution part, which is mainly responsible for multi-level feature extraction, and the fully connected part is responsible for classifying the features extracted by the convolution. Finally, the probability values ​​of the three categories are output through a Softmax function, so as to determine the sweetness grade of the fruit. Summary of the invention

[0005] The purpose of the present invention is to provide a fruit sweetness level classification method based on hyperspectral data, using a hyperspectral camera (350nm-950nm) to capture hyperspectral images, obtaining hyperspectral data through hyperspectral analysis, measuring and annotating the sweetness value of each sample through a saccharimeter, and dividing the sweetness level into three categories, namely Not sweet, Perfect and Toosweet; a high-precision end-to-end fruit sweetness level classification network for hyperspectral data is designed. The present invention includes the following steps:

[0006] The designed fruit sweetness level classification method based on hyperspectral data includes the design of an end-to-end fruit sweetness level classification network for hyperspectral data, and the construction of a high-precision lossless classification network for predicting the sweetness level of fruits. The network structure is mainly divided into two parts. The first part is the convolution part, which is mainly responsible for multi-level feature extraction; the second part is the fully connected part, which is responsible for classifying the features extracted by convolution, and finally outputs the probability values ​​of the three categories through the Softmax function to determine the sweetness level of the fruit.

[0007] First, the convolution module consists of multiple layers of one-dimensional convolutional layers and depthwise separable convolutional layers, which extract local and global features layer by layer to improve feature expression capabilities. The initial input is passed through a one-dimensional depthwise separable convolutional layer to extract local features, and then the feature space is gradually expanded using a standard convolutional layer. Finally, the computational efficiency is further optimized and the feature dimension is compressed through depthwise separable convolution. After each layer of convolution operation, batch normalization and average pooling are used to enhance the stability and generalization ability of the model. Finally, the features are compressed to a single value through a global average pooling layer to provide input for the subsequent fully connected module.

[0008] The fully connected module further extracts global features through multi-layer linear transformation, uses the ReLU activation function to increase nonlinear expression capabilities, and combines batch normalization and Dropout technology to improve the robustness of the model and prevent overfitting. Finally, the Softmax function outputs the probability values ​​of the three categories and then outputs the corresponding sweetness level.

[0009] This method is lightweight, high-precision, and robust. The lightweight design relies on deep separable convolution to greatly reduce the number of parameters and calculations, allowing it to run efficiently on low-power devices; the high precision is due to the layer-by-layer feature extraction of multi-layer convolution and pooling; and the use of batch normalization and Dropout enhances the generalization ability of the model. The model uses a lightweight neural network architecture that can efficiently extract spectral data features. The hyperspectral data of fruits can be used to accurately classify the sweetness level of fruits.

[0010] The loss function plays a key role in this model and its calculation formula is as follows:

[0011]

[0012] Among them, x represents the model's prediction score for each category, e x[class] is the index score of the category, ∑ i e x[i] It is the sum of all category index scores.

[0013] The purpose of the present invention is to provide a fruit sweetness level classification method based on hyperspectral data, using a hyperspectral camera (350nm-950nm) to shoot hyperspectral images, obtaining hyperspectral data through hyperspectral analysis, measuring and marking the sweetness value of each sample through a saccharimeter, and dividing the sweetness level into three categories, namely Not sweet, Perfect and Toosweet; a high-precision end-to-end fruit sweetness level classification network for hyperspectral data is designed, and the network structure is mainly divided into two parts. The first part is the convolution part, which is mainly responsible for feature extraction. The method of combining deep separable convolution and standard convolution is adopted, mainly including deep separable convolution (DSConv1d), standard convolution (Conv1d), batch normalization (BatchNorm1d), activation function (ReLU), average pooling (AveragePool) and global average pooling (GlobalAverage Pool). High-level features are gradually extracted through layer-by-layer operation, and finally the features are compressed to a fixed length by using global average pooling to adapt to the subsequent fully connected part. The fully connected part is responsible for classifying the features extracted by convolution. Its structure includes a linear layer (Linear), a batch normalization layer (BatchNorm1d), an activation function (ReLU) and a dropout layer (Dropout), and finally outputs the probability values ​​of the three categories through the Softmax function. The algorithm of the present invention combines hyperspectral imaging technology with deep learning to achieve high-precision lossless classification of fruit sweetness levels, while ensuring accuracy and reducing costs. The designed end-to-end network is efficient and accurate, and is widely used in practical application scenarios such as fruit sorting and quality assessment, promoting the further development of intelligence and automation in the agricultural field. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following briefly introduces the drawings required for the description of the embodiments or the prior art, and the present invention can be further understood in conjunction with the contents of the drawings. The components shown in the drawings are not necessarily drawn to scale, but the focus is on illustrating the principles of the embodiments.

[0015] Figure 1 It is a schematic diagram of a method for classifying fruit sweetness levels based on hyperspectral data provided by the present invention. DETAILED DESCRIPTION

[0016] Embodiments of the present invention are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and are not to be construed as limitations of the present invention. In the description of the present invention, the terms "include", "comprise" or other similar words are used to represent a non-exclusive inclusion relationship, that is, the processes, methods, commodities or devices covered include not only the elements that have been explicitly listed, but also other elements that are not explicitly listed, or elements inherent to the processes, methods, commodities or devices, unless otherwise clearly and specifically defined.

[0017] See also Figure 1 The present invention provides a method for classifying the sweetness level of fruits based on hyperspectral data, and the method for classifying the sweetness level of fruits comprises the following steps:

[0018] S101, Input (1, n).

[0019] Specifically, the input data is represented as a one-dimensional vector with a shape of (1, n), where n is the dimension of the input feature. Each input vector can be regarded as a sequence of n different features, which represent spectral data of different bands, etc.

[0020] S102. DSConv1d(n, 64, k=5, stride=1)+ReLU.

[0021] Specifically, the depthwise separable convolution is divided into two steps: Depthwise convolution: Convolution operation is performed on each input channel separately, and the number of convolution kernels is the same as the number of input channels. At this stage, each input feature is only calculated with its own convolution kernel and will not interact with the features of other channels. Pointwise convolution: The output of the depthwise convolution is fused using a 1x1 convolution kernel to form an output channel. This convolution method is more efficient than traditional convolution and reduces the amount of calculation. Activation function is used to introduce nonlinearity so that the neural network can fit complex mapping relationships.

[0022] S103, BatchNorm1d(64).

[0023] Specifically, the output of the convolutional layer is standardized by subtracting the mean and dividing by the standard deviation so that the output data of each channel has zero mean and unit variance, which accelerates training and improves the stability of the model and avoids the problem of gradient vanishing and explosion.

[0024] S104. Average Pool (k=2, stride=2).

[0025] Specifically, the downsampling operation compresses the dimension of the input data by taking the average value within the pooling window. This helps capture the global information of the feature while reducing the amount of calculation. Using a pooling window of size 2 and a stride of 2, each pooling operation reduces the feature dimension by half.

[0026] S105, Conv1d(64,128,k=5, stride=1)+ReLU.

[0027] Specifically, the number of input channels is increased from 64 to 128, and a convolution operation with a kernel size of 5 is used. A stride of 1 is used for sliding, where the convolution kernel does not skip any position, and each feature is processed one by one. The ReLU activation function is used to truncate negative values ​​to 0, improving computational efficiency and reducing computational complexity.

[0028] S106, BatchNorm1d(128).

[0029] Specifically, batch normalization is applied to the 128 output channels. By normalizing the output of each channel, the activation value of each channel is ensured to be within a reasonable range to prevent excessively large or small gradient updates.

[0030] S107. Average Pool (k=2, stride=2).

[0031] Specifically, the average pooling operation is used again to reduce the size while retaining the most important features. Each pooling reduces the size of the feature by half.

[0032] S108, Conv1d(128,1024,k=3,stride=1)+ReLU.

[0033] Specifically, the number of channels is expanded from 128 to 1024. The convolution kernel size is 3 and the stride is 1. Extracting higher-level features allows the network to capture more complex patterns. The ReLU activation function, a nonlinear transformation, enables the network to learn complex patterns.

[0034] S109, BatchNorm1d(1024).

[0035] Specifically, batch normalization is applied to 1024 channels so that the output of each channel has zero mean and unit variance, thereby improving training efficiency.

[0036] S110. Average Pool (k=2, stride=2).

[0037] Specifically, the dimension of features is continued to be reduced through pooling operations to focus on more meaningful features and reduce the computational burden.

[0038] S111, Conv1d(1024,256,k=3, stride=1)+ReLU.

[0039] Specifically, the number of input channels is reduced from 1024 to 256, and a convolution operation with a kernel size of 3 is used. The operation slides with a stride of 1, where the convolution kernel does not skip any position and each feature is processed one by one. The ReLU activation function is used to truncate negative values ​​to 0, thereby improving computational efficiency and reducing computational complexity.

[0040] S112, BatchNorm1d(256).

[0041] Specifically, batch normalization is performed on 256 channels to ensure that the output of each channel is in a standardized distribution.

[0042] S113. Average Pool (k=2, stride=2).

[0043] Specifically, the pooling operation is applied again to further reduce the size of the features.

[0044] S114, DSConv1d(256,1,k=3, stride=1)+ReLU.

[0045] Specifically, a depth-wise separable convolution is used to reduce the number of channels from 256 to 1, and a single-channel feature is output. The ReLU activation function is still applicable to this layer.

[0046] S115, BatchNorm1d(1).

[0047] Specifically, batch normalization is performed on the final single-channel output to ensure that it has a standardized distribution.

[0048] S116, Global Average Pool.

[0049] Specifically, global average pooling is performed on the final single-channel features to compress the output features into a single feature value as the input of the subsequent fully connected layer.

[0050] S117, Linear(1,64)+ReLU.

[0051] Specifically, the number of input channels is increased from 64 to 128, and a convolution operation with a kernel size of 5 is used. The operation slides with a stride of 1, where the convolution kernel does not skip any position and each feature is processed one by one. The ReLU activation function is used to truncate negative values ​​to 0, thereby improving computational efficiency and reducing computational complexity.

[0052] S118, BatchNorm1d(64).

[0053] Specifically, batch normalization is applied to the 64-dimensional output to ensure that the activation value of each neuron is within a reasonable range and avoid gradient problems.

[0054] S119, Linear(64,128)+ReLU.

[0055] Specifically, the 64-dimensional features are mapped to 128 dimensions to enhance the expressiveness of the feature space, and the ReLU activation function is applied.

[0056] S120, BatchNorm1d(128).

[0057] Specifically, batch normalization is performed on the 128-dimensional output.

[0058] S121, Linear(128,64)+ReLU.

[0059] Specifically, the 128-dimensional features are mapped to 64 dimensions and the ReLU activation function is applied.

[0060] S122, BatchNorm1d(64).

[0061] Specifically, batch normalization is performed on the 64-dimensional output.

[0062] S123, Linear(64,32)+ReLU.

[0063] Specifically, the 64-dimensional features are mapped to 32 dimensions and the ReLU activation function is applied.

[0064] S124, Dropout (p=0.5).

[0065] Specifically, using Dropout, half of the neurons are randomly discarded to prevent the network from overfitting during training. This promotes more generalized learning by allowing the network to "rely" on only some features at each iteration.

[0066] S125, Linear(32,3)+Softmax.

[0067] Specifically, in the last layer of the fully connected part, a linear layer is used to map the 32-dimensional features of the previous layer to 3 output categories. The output of this layer is processed by the Softmax activation function to generate a probability value for each category. The Softmax function ensures that the output is a probability distribution, where the probability value of each category is between 0 and 1, and the sum of the probabilities of all categories is 1.

[0068] S126. Output the sweetness level of the fruit.

[0069] Specifically, after a high-precision end-to-end fruit sweetness classification network, the network outputs the corresponding sweetness level. The sweetness level is divided into three categories: Not sweet, Perfect, and Too sweet.

[0070] Beneficial Effects

[0071] The present invention proposes a fruit sweetness grade classification method based on hyperspectral data. Through a high-precision end-to-end fruit sweetness grade classification network designed for hyperspectral data, features are first extracted through the convolution part, and then feature classification is performed through the fully connected part. Finally, the sweetness grade of the fruit is output, wherein the sweetness grade is divided into three categories, namely Not sweet, Perfect and Too sweet. The fruit sweetness grade can be non-destructively detected based on this network, the accuracy is improved, the cost is reduced, the model is easy to deploy, and it is widely applicable to practical application scenarios such as fruit sorting and quality assessment, promoting the further development of intelligence and automation in the agricultural field.

[0072] In the present invention, a hyperspectral camera is used to capture hyperspectral images, and hyperspectral data is obtained through spectral inversion, and the sweetness level is output through a fruit sweetness level classification network. Compared with the traditional sweetness detection method that relies on a single spectrum or chemical means, the present invention shows extremely significant advantages in terms of cost and efficiency. Hyperspectral technology can capture richer spectral information, extract effective features of hyperspectral data at multiple levels, and thus improve the accuracy of the model, providing a solid and reliable reference basis for the subsequent processing of fruits, and significantly increasing economic benefits.

[0073] What is disclosed above is only a preferred embodiment of the present invention, and it certainly cannot be used to limit the scope of rights of the present invention. Ordinary technicians in this field can understand that all or part of the processes of the above embodiment and equivalent changes made according to the claims of the present invention still fall within the scope of the invention.

Claims

1. A method for classifying fruit sweetness levels based on hyperspectral data, characterized in that: Hyperspectral images were taken using a hyperspectral camera (350nm-950nm), and hyperspectral data was obtained through hyperspectral analysis. The sweetness value of each sample was measured and annotated using a saccharimeter, and the sweetness level was divided into three categories: Not sweet, Perfect, and Too sweet. A high-precision end-to-end fruit sweetness level classification network for hyperspectral data was designed. The following steps are included: Design an end-to-end fruit sweetness classification network and build a high-precision lossless classification network for predicting the sweetness level of fruits. The network structure is mainly divided into two parts. The first part is the convolution part, which is mainly responsible for multi-level feature extraction; the second part is the fully connected part, which is responsible for classifying the features extracted by convolution. Finally, the probability values ​​of the three categories are output through the Softmax function to determine the sweetness level of the fruit.

2. A method for classifying fruit sweetness levels based on hyperspectral data as claimed in claim 1, characterized in that: The high-precision end-to-end fruit sweetness classification network for hyperspectral data can accurately classify the sweetness level of fruits by inputting hyperspectral data of fruits. The model adopts a lightweight neural network architecture, including convolutional modules and fully connected modules, which can efficiently extract spectral data features and achieve high-precision classification. First, the convolution module consists of multiple layers of one-dimensional convolutional layers and depthwise separable convolutional layers, which extract local and global features layer by layer to improve feature expression capabilities. The initial input is passed through a one-dimensional depthwise separable convolutional layer to extract local features, and then the feature space is gradually expanded using a standard convolutional layer. Finally, the computational efficiency is further optimized and the feature dimension is compressed through depthwise separable convolution. After each layer of convolution operation, batch normalization and average pooling are used to enhance the stability and generalization ability of the model. Finally, the features are compressed to a single value through a global average pooling layer to provide input for the subsequent fully connected module. The fully connected module further extracts global features through multi-layer linear transformation, uses the ReLU activation function to increase nonlinear expression capabilities, and combines batch normalization and Dropout technology to improve the robustness of the model and prevent overfitting. Finally, the Softmax function outputs the probability values ​​of the three categories and then outputs the corresponding sweetness level. This method is lightweight, high-precision, and robust. The lightweight design relies on deep separable convolution to greatly reduce the number of parameters and calculations, allowing it to run efficiently on low-power devices; the high precision is due to the layer-by-layer feature extraction of multi-layer convolution and pooling; and the use of batch normalization and Dropout enhances the generalization ability of the model. The model uses a lightweight neural network architecture that can efficiently extract spectral data features. The hyperspectral data of fruits can be used to accurately classify the sweetness level of fruits. The loss function plays a key role in this model and its calculation formula is as follows: in, x represents the model's prediction score for each category, e x[class] is the index score of the category, Σ i e x[i] It is the sum of all category index scores.

Citation Information

Patent Citations

  • A method, apparatus, system, and storage medium for detecting the sweetness of fruit.

    CN111366600B

  • Fruit sweetness detecting device and detecting method combined with artificial intelligence and spectral detection

    TW202120909A