Method, system, device and storage medium for determining the anthocyanin content of red-leafed lettuce
By integrating a one-dimensional convolutional neural network and an extreme learning machine into a network model, the problems of low efficiency and insufficient accuracy in anthocyanin content detection are solved, and efficient and automated anthocyanin content detection is achieved.
Patent Information
- Application Number
- CN202310938908.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2026-02-13
- Estimated Expiration
- 2043-07-28
AI Technical Summary
Existing methods for detecting anthocyanin content are time-consuming and inefficient, and conventional hyperspectral analysis lacks universal applicability and robustness, making it difficult to achieve automated and accurate spectral quantitative analysis.
An integrated network model combining a one-dimensional convolutional neural network and an extreme learning machine is used to identify anthocyanin content through reflectance data from hyperspectral images. Feature extraction and prediction are performed by combining the Inception module and a fully connected layer.
This improved the efficiency and accuracy of anthocyanin content detection, enabled automated hyperspectral quantitative analysis, and reduced reliance on manual pretreatment.
Smart Images

Figure CN117198420B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of anthocyanin content detection, in particular to a method, system and device for determining anthocyanin content of purple-leaf lettuce and a storage medium. BACKGROUND
[0002] Purple-leaf lettuce has rich nutritional value, and its leaves are rich in anthocyanins, carotenes, vitamins, and minerals. Chlorophyll, carotenoids, and anthocyanins are the three main pigments in plant tissues. These pigments are often found in the roots, stems, leaves, flowers, and fruits of higher plants, giving them different colors. Their content can effectively reflect the physiological state of plants. Studies have shown that anthocyanins have multiple protective and repair functions for plants, and can repair the light environment of leaves and improve the plant's ability to resist drought stress. The conventional methods for detecting anthocyanin content mainly include spectrophotometry and high-performance liquid chromatography. Although these methods can accurately measure the content of anthocyanins, they are time-consuming, inefficient, and destructive, which limits their application. In recent years, with the continuous improvement of instrument measurement technology and chemical metrology methods, high-spectral imaging technology is considered one of the most promising non-destructive analysis technologies. It can obtain spectral information of hundreds of continuous wavebands, combining spectroscopy and imaging technology, and has been successfully applied in many fields such as vegetable and fruit quality detection, food safety, and variety identification.
[0003] The quantitative model for establishing the relationship between spectral information and target components is a common approach to estimation tasks. However, in actual spectral collection, there are often a variety of noise signals. In the process of studying high-spectral data, useless signals can seriously interfere with the analysis results. Therefore, the typical spectral analysis workflow usually includes multiple data preprocessing steps. A good quantitative model requires users to have a lot of prior knowledge, lacks universality, and is not robust enough. Therefore, it is of great significance to find a method that can eliminate complex manual preprocessing operations and automatically establish an accurate spectral quantitative analysis model. SUMMARY
[0004] The purpose of the present application is to provide a method, system, device and storage medium for determining the anthocyanin content of purple-leaf lettuce, which improves the detection efficiency and accuracy of anthocyanin content.
[0005] To achieve the above-mentioned purpose, the present application provides the following solutions:
[0006] A method for determining the anthocyanin content of purple-leaf lettuce, comprising:
[0007] obtaining a hyperspectral image of the purple-leaf lettuce to be detected, and determining the reflectance data of the hyperspectral image;
[0008] inputting the reflectivity data into a anthocyanin content identification model to obtain the anthocyanin content of the to-be-detected red-leaf lettuce; the anthocyanin content identification model is obtained by training an integrated network using a training set, the integrated network comprising a one-dimensional convolutional neural network and an extreme learning machine, and the output of the one-dimensional convolutional neural network is connected to the input of the extreme learning machine.
[0009] Optionally, the one-dimensional convolutional neural network comprises a first convolutional layer, an Inception module, a flattening layer and a fully connected layer connected in sequence; the first convolutional layer comprises eight 1*7 convolutional kernels connected in sequence; the Inception module comprises a first branch, a second branch, a third branch and a fourth branch connected in parallel;
[0010] the first branch comprises a second convolutional layer, a third convolutional layer and a fourth convolutional layer connected in sequence; the size of the convolutional kernel in the second convolutional layer is 1*1, the size of the convolutional kernel in the third convolutional layer and the fourth convolutional layer is 1*3, and the number of the convolutional kernels in the second convolutional layer, the third convolutional layer and the fourth convolutional layer is four;
[0011] the second branch comprises a fifth convolutional layer and a sixth convolutional layer connected in sequence; the size of the convolutional kernel in the fifth convolutional layer is 1*1, the size of the convolutional kernel in the sixth convolutional layer is 1*3, and the number of the convolutional kernels in the fifth convolutional layer and the sixth convolutional layer is four;
[0012] the third branch comprises a maximum pooling layer and a seventh convolutional layer connected in sequence; the size of the convolutional kernel in the seventh convolutional layer is 1*1, and the number of the convolutional kernels is four;
[0013] the fourth branch comprises an eighth convolutional layer, and the size of the convolutional kernel in the eighth convolutional layer is 1*1, and the number of the convolutional kernels is four.
[0014] Optionally, the activation functions in the convolutional layers and the fully connected layers in the one-dimensional convolutional neural network are all rectified linear units.
[0015] Optionally, the sample data in the training set comprises input data and label data, the input data is the reflectivity data of the sample red-leaf lettuce hyperspectral image, and the label data is the true anthocyanin content of the sample red-leaf lettuce.
[0016] Optionally, the hyperspectral image of the to-be-detected red-leaf lettuce is obtained, and the reflectivity data of the hyperspectral image is determined, specifically comprising:
[0017] converting the hyperspectral image of the to-be-detected red-leaf lettuce into a normalized vegetation index image;
[0018] creating an image matrix with a gray value of 1 and the same length and width size as the normalized vegetation index image.
[0019] The image matrix is set to 0 with the pixel points of the corresponding position in the normalized vegetation index image whose gray value is less than 0.8, to obtain a mask image;
[0020] The average value of the reflectivity of the pixel points of the mask position corresponding to the mask image in the hyperspectral image of the purple-leaf lettuce to be detected is calculated, to obtain reflection data; the mask position is the position of the mask image whose gray value is 1.
[0021] Optionally, when the training set is used to train the integrated network, the following steps are specifically included:
[0022] The gradient of the loss function is calculated by using a stochastic gradient descent optimizer, and the weight of the integrated network is updated in the gradient direction;
[0023] The loss function is a mean square error to which L2 regularization is added.
[0024] The application further discloses a purple-leaf lettuce anthocyanin content determination system, which comprises:
[0025] A hyperspectral image of the purple-leaf lettuce to be detected is obtained, and the reflectivity data of the hyperspectral image is determined;
[0026] The reflectivity data is input into an anthocyanin content recognition model, to obtain the anthocyanin content of the purple-leaf lettuce to be detected; the anthocyanin content recognition model is obtained by training an integrated network by using a training set, the integrated network comprises a one-dimensional convolutional neural network and an extreme learning machine, and the output of the one-dimensional convolutional neural network is connected with the input of the extreme learning machine.
[0027] The application further discloses an electronic device comprising a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to execute the purple-leaf lettuce anthocyanin content determination method.
[0028] The application further discloses a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the purple-leaf lettuce anthocyanin content determination method.
[0029] According to the embodiments of the application, the following technical effects are achieved:
[0030] The reflectivity data of the hyperspectral image of the to-be-detected purple-leaf lettuce is input into a anthocyanin content recognition model to obtain the anthocyanin content of the to-be-detected purple-leaf lettuce, wherein the anthocyanin content recognition model is obtained by training an integrated network using a training set, the integrated network is integrated by a one-dimensional convolutional neural network and an extreme learning machine, and the integrated network combines the characteristics of the one-dimensional convolutional neural network feature extraction and the high learning efficiency and high generalization performance of the extreme learning machine, thereby improving the detection efficiency and accuracy of the anthocyanin content. BRIEF DESCRIPTION OF DRAWINGS
[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0032] Figure 1 A purple-leaf lettuce anthocyanin content determination method flowchart is provided for the embodiments of the present application.
[0033] Figure 2 A relationship diagram of a one-dimensional convolutional neural network and an extreme learning machine in an integrated network is provided for the embodiments of the present application.
[0034] Figure 3 An integrated network structure diagram is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0035] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0036] The purpose of the present application is to provide a purple-leaf lettuce anthocyanin content determination method, system, device and storage medium to improve the detection efficiency of anthocyanin content.
[0037] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application will be further described in detail below with reference to the drawings and specific embodiments.
[0038] Embodiment 1
[0039] As shown in the figure, the purple-leaf lettuce anthocyanin content determination method provided in the present embodiment specifically includes the following steps. Figure 1
[0040] Step 101: Obtain a hyperspectral image of the purple-leaf lettuce to be detected, and determine reflectance data of the hyperspectral image.
[0041] Specifically, step 101 comprises:
[0042] Place the purple-leaf lettuce to be detected on a sample platform, and use SpecVIEW software to collect the hyperspectral image.
[0043] Since the collected hyperspectral image depends on the light source spectrum, light source intensity, lens transmittance, diffraction efficiency of the spectrometer, spectral response efficiency, and reflectance of the measured object, the collected original hyperspectral image is subjected to black-white correction, and the correction formula is:
[0044]
[0045] Wherein, R is the hyperspectral image of the purple-leaf lettuce to be detected after black-white correction, sample is the original hyperspectral data, white is the standard whiteboard data, and dark is the black frame data collected by closing the lens cover.
[0046] Convert the hyperspectral image (the hyperspectral image after black-white correction) of the purple-leaf lettuce to be detected into a normalized vegetation index image.
[0047] Create an image matrix with a gray value of 1 and the same length and width as the normalized vegetation index image.
[0048] Set the pixel points at the corresponding positions of the image matrix and the normalized vegetation index image with a gray value less than 0.8 to 0 to obtain a mask image.
[0049] Calculate the average value of the reflectance of the pixel points at the mask positions corresponding to the mask image in the hyperspectral image of the purple-leaf lettuce to be detected, wherein the mask positions are the positions with a gray value of 1 in the mask image, to obtain reflectance data.
[0050] Step 102: input the reflectance data into a cyanin content recognition model to obtain the cyanin content of the purple-leaf lettuce to be detected; the cyanin content recognition model is obtained by training an integrated network using a training set, the integrated network comprises a one-dimensional convolutional neural network and an extreme learning machine, and the output of the one-dimensional convolutional neural network is connected to the input of the extreme learning machine.
[0051] The connection relationship between the one-dimensional convolutional neural network (1DCNN) and the extreme learning machine (ELM) is as shown in Figure 2 , wherein Regressors is the extreme learning machine. Figure 2
[0052] As shown in Figure 3 As shown, the one-dimensional convolutional neural network comprises a first convolutional layer (Conv1), an initial module (Inception module), a flattening layer (Flatten), and a fully connected layer (FC) connected in sequence.
[0053] The first convolutional layer comprises eight 1x7 convolutional kernels connected in sequence, which converts one-dimensional reflectivity data into eight smaller size feature maps.
[0054] The Inception module comprises a first branch, a second branch, a third branch, and a fourth branch arranged in parallel, and the four branches perform convolutional operations on the feature maps output by the first convolutional layer, respectively.
[0055] The first branch comprises a second convolutional layer (Conv1-1), a third convolutional layer (Conv1-2), and a fourth convolutional layer (Conv1-3) connected in sequence; the size of the convolutional kernel in the second convolutional layer is 1x1, the size of the convolutional kernel in the third convolutional layer and the fourth convolutional layer is 1x3, and the number of convolutional kernels in the second convolutional layer, the third convolutional layer, and the fourth convolutional layer is 4. After convolution by the second convolutional layer, the number of feature maps is reduced by half, and the size of the feature maps remains unchanged. The feature map dimension output by the third convolutional layer and the fourth convolutional layer remains unchanged.
[0056] The second branch comprises a fifth convolutional layer (Conv2-1) and a sixth convolutional layer (Conv2-2) connected in sequence; the size of the convolutional kernel in the fifth convolutional layer is 1x1, and the size of the convolutional kernel in the sixth convolutional layer is 1x3; the number of convolutional kernels in the fifth convolutional layer and the sixth convolutional layer is 4.
[0057] The third branch comprises a maximum pooling layer (Pooling) and a seventh convolutional layer (Conv3-1) connected in sequence; the size of the convolutional kernel in the seventh convolutional layer is 1x1, and the number of convolutional kernels is 4. The size of the maximum pooling layer window is 1x3, and after the maximum pooling layer operation, the feature map dimension of the Conv1 layer is reduced to 1 / 3 of the original, and the number of feature maps remains unchanged.
[0058] The fourth branch comprises an eighth convolutional layer (Conv4-1), and the size of the convolutional kernel in the eighth convolutional layer is 1x1, and the number of convolutional kernels is 4. After the convolution operation of the eighth convolutional layer, the number of feature maps is reduced by half, and the dimension remains unchanged.
[0059] The Inception module splices the feature maps output by the Conv1-3 layer, the Conv2-2 layer, the Conv3-1 layer, and the Conv4-1 layer, fuses the features at different levels together, flattens the spliced feature maps to obtain a one-dimensional vector through the flattening layer, and then connects with the fully connected layer. The output of the fully connected layer isFigure 3 Features) as the input of extreme learning machine.
[0060] The activation function in the convolution layer (first convolution layer to eighth convolution layer) and the full connection layer in the one-dimensional convolutional neural network is a rectified linear unit.
[0061] The weight matrix w and the bias matrix b between the input layer and the hidden layer of the extreme learning machine are randomly initialized before training. H is the output matrix of the hidden layer, and the calculation formula is H = g (W x X + b), wherein g is an activation function, β is the weight between the hidden layer and the output layer, and the calculation formula is: β = H + T', wherein H + is the generalized inverse matrix of H, the matrix T is the output matrix, T' is the transpose of T. x represents sample feature data (output of the full connection layer), x i represents the feature data of the i-th sample, Y is a label matrix of the sample, Y i represents the label data of the i-th sample, i takes a value in the range of 1 to n, and n is the number of samples.
[0062] The final result output by the extreme learning machine is used as the prediction result of the anthocyanin content value of the red-leaf lettuce.
[0063] The sample data in the training set includes input data and label data, the input data is the reflectivity data of the sample red-leaf lettuce hyperspectral image, and the label data is the true anthocyanin content of the sample red-leaf lettuce.
[0064] When constructing the training set, the hyperspectral image of the red-leaf lettuce is collected by using the GaiaSorter hyperspectral imaging system. The imaging system mainly consists of a V10E spectrometer, an OL23 lens, an LT365 detector, two bromine-tungsten light sources, a movable sample platform, a matching SpecVIEW software and a computer. The spectral range collected by the camera is 382.19-1026.66 nm, the spectral resolution is 2.8 nm, the sampling interval is 0.65 nm, and there are 728 wavebands. In order to obtain the hyperspectral image of the sample red-leaf lettuce, the following steps are taken:
[0065] S1, before starting to collect the hyperspectral image, the system needs to be preheated for 30 minutes, and the preheating operation can eliminate the baseline drift.
[0066] S2, set the exposure time of the hyperspectral imaging system to 15 ms, and the moving speed of the sample platform to 2.5 mm / s.
[0067] S3, place the red-leaf lettuce sample to be tested on the sample platform, and install the light-shielding glass of the platform to avoid the influence of external light sources, and collect the hyperspectral image data of 108 samples.
[0068] S4, measuring the true value of the purple-leaf lettuce anthocyanin content, selecting three evenly distributed leaf blades from the upper part of the purple-leaf lettuce, removing the main arteries of the detected leaves, cutting the leaves, using a balance to weigh 0.2 g of leaves from the three positions respectively, and moving to a 10-ml centrifuge tube, then adding 10 ml of 2% hydrochloric acid methanol solution to the centrifuge tube, sealing, then placing the centrifuge tube into a centrifuge for centrifugation for 5 minutes. Finally, place the centrifuge tube in a light-proof environment for two hours until all the anthocyanins are precipitated, and use a spectrophotometer to measure the absorbance values of the anthocyanin solution at wavelengths of 530 nm and 600 nm, respectively, and repeat three times for each sample to take the average value. The anthocyanin content of three leaves of each plant is measured, and the average value is taken as the true anthocyanin content of the sample. A total of 108 samples of lettuce anthocyanin content were collected. The measured anthocyanin content is taken as the true anthocyanin content of the corresponding sample (label data).
[0069] As a specific embodiment, the determination method and steps 101 of the reflectance data of the sample purple-leaf lettuce in the training set are the same as the determination method of the reflectance data of the detected purple-leaf lettuce.
[0070] As another specific embodiment, the spectral software package based on the python programming language is used to process the hyperspectral image of the sample purple-leaf lettuce. After reading the hyperspectral image of the purple-leaf lettuce, it is converted into the average reflectance data of the purple-leaf lettuce plant, and the reflectance data of the sample purple-leaf lettuce is obtained.
[0071] The reflectance data of the sample purple-leaf lettuce hyperspectral image is taken as the input, and the reflectance data of the purple-leaf lettuce is taken as the output. When the training set is used to train the integrated network, it specifically includes:
[0072] The loss function used is the mean square error with L2 regularization. During the fitting process, the weights are steadily shrunk to 0, reducing the complexity of the neural network model to avoid overfitting to some extent. The stochastic gradient descent optimizer is used to calculate the gradient of the loss function and update the weights of the integrated network in the gradient direction. All negative values input into the integrated network are set to zero.
[0073] The loss function is represented as:
[0074]
[0075] where y i is the measured anthocyanin content of the i-th sample, the predicted anthocyanin content of the i-th sample, λ is the regularization coefficient, and w is the weight matrix.
[0076] The application uses a trained ensemble network (cyanin content recognition model) to realize high-precision estimation of the cyanin content of purple-leaf lettuce, including: outputting the specific value of the cyanin content of the purple-leaf lettuce by the trained ensemble network.
[0077] The application provides a regression analysis method Ensemble that fuses deep convolution features and extreme learning machines (ELM) and is used for estimating the cyanin content of purple-leaf lettuce based on hyperspectral reflectance data. Ensemble uses a deep learning model as an implicit feature extraction tool, transmits the extracted local spatial patterns to downstream for feature-based model construction, and considers accurate matching features. Convolutional neural networks are good at mining features in information, but their generalization performance needs to be improved. ELM is good at efficiently approximating target functions, but needs to improve in mining feature information, and the fusion of the two types of estimation methods provides an effective way to improve the overall model performance.
[0078] Embodiment 2
[0079] The application provides a system for determining the cyanin content of purple-leaf lettuce, including:
[0080] Obtain the hyperspectral image of the purple-leaf lettuce to be detected, and determine the reflectance data of the hyperspectral image.
[0081] Input the reflectance data into a cyanin content recognition model to obtain the cyanin content of the purple-leaf lettuce to be detected; the cyanin content recognition model is obtained by training an ensemble network using a training set, the ensemble network includes a one-dimensional convolutional neural network and an extreme learning machine, and the output of the one-dimensional convolutional neural network is connected to the input of the extreme learning machine.
[0082] The embodiment adopts an Inception module. A one-dimensional convolutional neural network that matches the input near-infrared spectral signal is designed based on the Inception module, the input of the model is the original spectral reflectance data, and the output is the target element content (cyanin).
[0083] The input of the model is the original spectral reflectance data with a dimension of (None, 728, 1). First, the input spectral data is convolved by a Conv1 convolutional layer with 8 convolution kernels with a size of 1x7, the convolution step is set to 2, and the convolution mode is set to same, the output dimension of the Conv1 layer is (None, 361, 8), and the one-dimensional spectrum is converted into 8 smaller feature maps.
[0084] Then, four parallel branches are used to perform convolution operations on the feature maps output by the Conv1 layer. The first branch concatenates Conv1-1, Conv1-2, and Conv1-3, all with a stride of 1 and the same convolution mode. After the Conv1-1 convolution, the number of feature maps is reduced by half, while the size of the feature maps remains unchanged, resulting in an output feature map dimension of (None, 361, 4). The output feature maps after the Conv1-2 and Conv1-3 convolutions also retain the same dimension of (None, 361, 4). The second branch concatenates two convolutional layers, Conv2-1 and Conv2-2. Both convolutions have a stride of 1 and the same convolution mode. The output feature maps of both Conv2-1 and Conv2-2 have the same dimension of (None, 361, 4). The third branch first connects to a max-pooling layer, with an output dimension of (None, 120, 8). The pooling layer is followed by a Conv3-1 convolutional layer with a stride of 1 and the same convolution mode. The output feature map has dimensions (None, 120, 4). The fourth branch has only one Conv4-1 convolutional layer with a stride of 1 and the same convolution mode. The output feature map of the Conv4-1 convolutional layer has dimensions (None, 120, 4).
[0085] After the convolution operation is completed in four parallel branches, the features from different levels are fused together to obtain a feature map of dimension (None, 1203, 4). Then, this feature map is flattened to obtain a one-dimensional vector of dimension (None, 4812), which is then connected to a fully connected layer containing 128 neurons. Finally, the output of this fully connected layer is used as the input to the Extreme Learning Machine (ELM) network to obtain the final output.
[0086] The final result output by the Extreme Learning Machine was used as the estimate of the anthocyanin content in purple lettuce.
[0087] Example 3
[0088] This embodiment provides an electronic device, including a memory and a processor. The memory is used to store a computer program, and the processor runs the computer program to enable the electronic device to perform the method for determining the anthocyanin content of purple lettuce according to Embodiment 1.
[0089] The computer-readable storage medium provided in this embodiment stores a computer program, which, when executed by a processor, implements the method for determining the anthocyanin content of purple lettuce as described in Embodiment 1.
[0090] The various embodiments described in this specification are presented for the purpose of illustrating the principles of the present application and its best mode of operation. Each of the embodiments described in this specification has been provided for the purpose of illustration only and the various embodiments are not intended to limit the present application in any way unless otherwise specifically indicated. The same parts and / or features of the various embodiments described in this specification can be referenced using the same reference numerals for the ease of understanding of the present application.
[0091] The principles and implementations of the present application have been described in the specification with specific examples. The above description of the embodiments is only for the purpose of helping to understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, the specific implementation and application range of the present application can be changed according to the idea of the present application. In summary, the content of the specification should not be understood as a limitation of the present application.
Claims
1. A method for determining the anthocyanin content of purple lettuce, characterized in that, include: Obtain a hyperspectral image of the purple-leaf lettuce to be tested, and determine the reflectance data of the hyperspectral image; The reflectance data is input into the anthocyanin content recognition model to obtain the anthocyanin content of the purple lettuce to be detected. The anthocyanin content recognition model is obtained by training an ensemble network using a training set. The ensemble network includes a one-dimensional convolutional neural network and an extreme learning machine. The output of the one-dimensional convolutional neural network is connected to the input of the extreme learning machine. Obtaining a hyperspectral image of the purple-leaf lettuce to be tested and determining the reflectance data of the hyperspectral image specifically includes: The hyperspectral image of the purple lettuce to be detected was converted into a normalized vegetation index image. Create an image matrix with the same dimensions (length and width) as the normalized vegetation index image, where all gray values are 1. The corresponding pixels in the image matrix and the normalized vegetation index image with gray values less than 0.8 are set to 0 to obtain a mask image. The reflectance data is obtained by calculating the average reflectance of pixels in the hyperspectral image of the purple lettuce to be detected that have a non-zero mask position corresponding to the mask image; the mask position is the position where the gray value of the mask image is 1. When training an ensemble network using a training set, the specific steps include: The gradient of the loss function is calculated using a stochastic gradient descent optimizer, and the weights of the ensemble network are updated in the gradient direction. The loss function is the mean squared error with L2 regularization added, and the loss function is expressed as follows: Among them, y i Let i be the measured anthocyanin content of the i-th sample. The predicted anthocyanin content of the i-th sample, where λ is the regularization coefficient and w is the weight matrix; The one-dimensional convolutional neural network includes a first convolutional layer, an Inception module, a flattening layer, and a fully connected layer connected in sequence; the first convolutional layer includes eight 1×7 convolutional kernels connected in sequence; the Inception module includes a first branch, a second branch, a third branch, and a fourth branch in parallel; The first branch includes a second convolutional layer, a third convolutional layer, and a fourth convolutional layer connected in sequence; the kernel size in the second convolutional layer is 1×1, the kernel size in the third convolutional layer and the fourth convolutional layer is 1×3, and the number of kernels in the second convolutional layer, the third convolutional layer and the fourth convolutional layer is 4. The second branch includes a fifth convolutional layer and a sixth convolutional layer connected in sequence; the kernel size in the fifth convolutional layer is 1×1, the kernel size in the sixth convolutional layer is 1×3, and the number of kernels in both the fifth and sixth convolutional layers is 4. The third branch includes a max pooling layer and a seventh convolutional layer connected in sequence; the seventh convolutional layer has a kernel size of 1×1 and a kernel number of 4. The fourth branch includes an eighth convolutional layer, in which the size of the convolutional kernel is 1×1 and the number of convolutional kernels is 4; The Inception module concatenates the feature maps output from the first, second, third, and fourth branches, fusing features from different levels together. It then flattens the concatenated feature maps into a one-dimensional vector using a flattening layer, which is then connected to a fully connected layer.
2. The method for determining the anthocyanin content of purple lettuce according to claim 1, characterized in that, In the one-dimensional convolutional neural network, the activation functions in both the convolutional and fully connected layers are rectified linear units.
3. The method for determining the anthocyanin content of purple lettuce according to claim 1, characterized in that, The training set sample data includes input data and label data. The input data is the reflectance data of the hyperspectral image of the sample purple-leaf lettuce, and the label data is the actual anthocyanin content of the sample purple-leaf lettuce.
4. A system for determining the anthocyanin content of purple lettuce, characterized in that, include: Obtain a hyperspectral image of the purple-leaf lettuce to be tested, and determine the reflectance data of the hyperspectral image; The reflectance data is input into the anthocyanin content recognition model to obtain the anthocyanin content of the purple lettuce to be detected. The anthocyanin content recognition model is obtained by training an ensemble network using a training set. The ensemble network includes a one-dimensional convolutional neural network and an extreme learning machine. The output of the one-dimensional convolutional neural network is connected to the input of the extreme learning machine. Obtaining a hyperspectral image of the purple-leaf lettuce to be tested and determining the reflectance data of the hyperspectral image specifically includes: The hyperspectral image of the purple lettuce to be detected was converted into a normalized vegetation index image. Create an image matrix with the same dimensions (length and width) as the normalized vegetation index image, where all gray values are 1. The corresponding pixels in the image matrix and the normalized vegetation index image with gray values less than 0.8 are set to 0 to obtain a mask image. The reflectance data is obtained by calculating the average reflectance of pixels in the hyperspectral image of the purple lettuce to be detected that have a non-zero mask position corresponding to the mask image; the mask position is the position where the gray value of the mask image is 1. When training an ensemble network using a training set, the specific steps include: The gradient of the loss function is calculated using a stochastic gradient descent optimizer, and the weights of the ensemble network are updated in the gradient direction. The loss function is the mean squared error with L2 regularization added, and the loss function is expressed as follows: Among them, y i Let i be the measured anthocyanin content of the i-th sample. The predicted anthocyanin content of the i-th sample, where λ is the regularization coefficient and w is the weight matrix; The one-dimensional convolutional neural network includes a first convolutional layer, an Inception module, a flattening layer, and a fully connected layer connected in sequence; the first convolutional layer includes eight 1×7 convolutional kernels connected in sequence; the Inception module includes a first branch, a second branch, a third branch, and a fourth branch in parallel; The first branch includes a second convolutional layer, a third convolutional layer, and a fourth convolutional layer connected in sequence; the kernel size in the second convolutional layer is 1×1, the kernel size in the third convolutional layer and the fourth convolutional layer is 1×3, and the number of kernels in the second convolutional layer, the third convolutional layer and the fourth convolutional layer is 4. The second branch includes a fifth convolutional layer and a sixth convolutional layer connected in sequence; the kernel size in the fifth convolutional layer is 1×1, the kernel size in the sixth convolutional layer is 1×3, and the number of kernels in both the fifth and sixth convolutional layers is 4. The third branch includes a max pooling layer and a seventh convolutional layer connected in sequence; the seventh convolutional layer has a kernel size of 1×1 and a kernel number of 4. The fourth branch includes an eighth convolutional layer, in which the size of the convolutional kernel is 1×1 and the number of convolutional kernels is 4; The Inception module concatenates the feature maps output from the first, second, third, and fourth branches, fusing features from different levels together. It then flattens the concatenated feature maps into a one-dimensional vector using a flattening layer, which is then connected to a fully connected layer.
5. An electronic device, characterized in that, The device includes a memory and a processor, the memory being used to store a computer program, and the processor running the computer program to cause the electronic device to perform the method for determining the anthocyanin content of purple lettuce according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the method for determining the anthocyanin content of purple lettuce as described in any one of claims 1 to 3.
Citation Information
Patent Citations
Measurement method of content of anthocyanin in leaves of peony on the basis of hyperspectrum
CN105241822A
A hyperspectral image classification method based on SRCM and a convolutional neural network
CN109598306A