Pea nutritional ingredient analysis method and system based on machine learning

By constructing a machine learning model to integrate pea multi-source data, the problems of single detection methods and insufficient edge computing in the existing technology are solved, accurate prediction and dynamic evaluation of pea nutritional components are achieved, analysis efficiency and accuracy are improved, and agricultural product supply chain is optimized.

CN120470320AInactive Publication Date: 2025-08-12AGRI RES INST TIBET ACADEMY OF AGRI & ANIMAL HUSBANDRY SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510592897.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-08-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing technology has multi-dimensional dynamic factors such as single detection methods and failure to effectively integrate the growth environment and storage and transportation process in the analysis of crop nutrients, resulting in insufficient generalization capabilities of prediction models and difficult for traditional methods to adapt to the edge computing requirements of field mobile detection equipment.

Method used

By constructing a pea nutritional component analysis method based on machine learning, multi-source data of pea's historical nutritional components, growth environment and storage and transportation environment, a macro and micronutrition prediction model is constructed, and dynamic correction is carried out in combination with the historical nutrient loss library, and data processing and prediction are used to use edge computing modules.

Benefits of technology

It realizes accurate prediction and dynamic evaluation of pea nutritional components, improves analysis efficiency and accuracy, adapts to the analysis needs of different users, and optimizes the efficiency of agricultural product supply chain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120470320A_ABST
    Figure CN120470320A_ABST
Patent Text Reader

Abstract

The invention discloses a pea nutritional ingredient analysis method and system based on machine learning, and the method comprises the steps: classifying the historical nutritional ingredients of peas, calculating the nutrient loss rate, constructing a historical nutrient loss library through a historical storage and transportation environment and the nutrient loss rate, carrying out the edge processing of historical monitoring data, and obtaining a growth environment index. The method comprises the following steps: respectively constructing a macro nutrition prediction model and a micronutrient prediction model, obtaining a first macro nutrition prediction value and a first micronutrient prediction value according to monitoring data and a growth environment of peas to be analyzed, and matching according to a storage and transportation environment of the peas to be analyzed to obtain a similar nutrition loss rate and an environment similarity; and according to the environment similarity, the similar nutrition loss rate, the first macro nutrition prediction value and the first micro nutrition prediction value, obtaining a pea nutritional ingredient analysis result. The method not only can improve the efficiency and accuracy of pea nutritional ingredient analysis, but also has good interpretability, and can be directly applied to a pea nutritional ingredient analysis system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of food analysis, and in particular to a method and system for analyzing pea nutritional components based on machine learning. Background Art

[0002] As people pay more and more attention to healthy eating, the precise analysis of the nutritional content of agricultural products has become an important research direction in food science and agricultural technology. As an important crop rich in protein, dietary fiber and multiple vitamins, the accurate assessment of the nutritional content of peas not only helps to optimize planting and management strategies, but also provides a key basis for food processing and dietary nutrition guidance.

[0003] Traditional chemical testing methods, limited by destructive sampling, time-consuming, and expensive processes, struggle to meet modern industry's demands for real-time monitoring and dynamic assessment of nutrient content. In recent years, machine learning technologies, combined with non-destructive testing methods such as spectral analysis and image processing, have provided new avenues for the rapid prediction of crop nutrients. However, existing testing technologies still have several shortcomings: First, the single-minded nature of testing methods fails to effectively integrate multi-dimensional dynamic factors such as the growth environment and storage and transportation processes, resulting in insufficient generalization of prediction models. Second, traditional methods lack correlation analysis between macronutrients and micronutrients and ignore the effects of nutrient loss during storage and transportation, limiting the accuracy of nutrient assessments across the entire supply chain. Finally, existing machine learning models often rely on centralized computing architectures, making them difficult to adapt to the edge computing requirements of mobile field testing equipment. To address the above problems, the present invention proposes a pea nutrient analysis method and system based on machine learning. By integrating multi-source data such as historical pea nutrients, growth environment, storage and transportation environment, a macro- and micro-nutrient prediction model is constructed, and dynamic correction is performed in combination with a historical nutrient loss database. This method can not only effectively overcome the limitations of traditional technologies, but also achieve accurate prediction and dynamic evaluation of pea nutrients through in-depth mining of multi-dimensional data, which is of great significance for improving the quality management level of peas and optimizing the efficiency of the agricultural product supply chain. Summary of the Invention

[0004] The purpose of the present invention is to provide a method and system for analyzing the nutritional components of peas based on machine learning.

[0005] To achieve the above object, the present invention is implemented according to the following technical solutions:

[0006] The present invention comprises the following steps:

[0007] Acquire historical nutrient components and historical status data of peas; the historical nutrient components include a first nutrient component and a second nutrient component; the historical status data include historical monitoring data and historical environmental parameters; the historical environmental parameters include historical growing environment and historical storage and transportation environment;

[0008] Classifying the historical nutritional components according to macronutrients and micronutrients, calculating the nutritional loss rate based on the historical nutritional component classification results, and constructing a historical nutritional loss database based on the historical storage and transportation environment and the nutritional loss rate; the nutritional loss rate includes the macronutrient loss rate and the micronutrient loss rate;

[0009] performing edge processing on the historical monitoring data, inputting the historical growth environment into an environmental function to obtain a growth environment index, and constructing a macronutrient prediction model and a micronutrient prediction model based on the edge processing results and the growth environment index, respectively; the edge processing results include spectral features, color texture features, and shape texture features;

[0010] Inputting the monitoring data and growth environment of the peas to be analyzed into the macronutrient prediction model and the micronutrient prediction model respectively to obtain a first macronutrient prediction value and a first micronutrient prediction value;

[0011] The comprehensive similarity between the storage and transportation environment of the peas to be analyzed and the historical storage and transportation environment of the historical nutrient loss library is calculated to obtain a similar nutrient loss rate and an environmental similarity, and the pea nutrient component analysis results are obtained based on the environmental similarity, the similar nutrient loss rate, the first macronutrient predicted value, and the first micronutrient predicted value.

[0012] Furthermore, the historical nutritional components are obtained by testing and analyzing pea samples; the first nutritional components represent the nutritional components corresponding to the best picking period of peas; and the second nutritional components represent the nutritional components of peas before consumption.

[0013] Furthermore, the method for constructing a historical nutrient loss library includes:

[0014] Constructing a decision tree based on the content, type, and function of the nutrients, using the decision tree to divide the first nutrient into a first macronutrient and a first micronutrient, and using the decision tree to divide the second nutrient into a second macronutrient and a second micronutrient;

[0015] The pruning conditions of the decision tree are:

[0016]

[0017] Where Prune(node) is the decision function for whether to prune the current node, C(f,t,d) is the detection confidence, which is related to the split feature f, the current split threshold t and the detection lower limit d, σ(·) is the sigmoid function, B(n,s) is the bioavailability weight function, which is related to the nutrient type C n and sample type C s E(ΔT, ΔH) is the environmental tolerance, which is related to the temperature error ΔT and humidity error ΔH, Tmax is the maximum temperature error within the calibration standard tolerance, H max is the maximum humidity error in the calibration standard tolerance, τ(C n ) is nutrient type C n Dynamic threshold of

[0018] The macronutrient loss rate is determined based on the first macronutrient component and the second macronutrient component, and the micronutrient loss rate is determined based on the first micronutrient component and the second micronutrient component. The macronutrient loss rate and micronutrient loss rate of peas in the same batch are associated with the corresponding historical storage and transportation environment to obtain a set of historical nutrient loss data, and multiple sets of historical nutrient loss data are obtained to construct a historical nutrient loss library.

[0019] Furthermore, the method for edge processing includes:

[0020] Acquire historical monitoring data and preprocess the historical monitoring data; the historical monitoring data includes spectral data and pea images; the spectral data is collected by a near-infrared spectrometer; the pea images are collected by a high-resolution camera;

[0021] Edge processing is performed on historical monitoring data. The specific steps are as follows: principal component analysis is performed on the spectral data to obtain spectral features, and the pea image is input into the self-attention image processing model to obtain color texture features and shape texture features;

[0022] The self-attention image processing model includes an input layer, a distortion correction module, a color correction module, a feature self-attention module and an output layer;

[0023] The distortion correction module performs radial / tangential distortion correction on the pea image based on checkerboard calibration to output a pea geometric correction image; the color correction module performs CIE Lab color space correction on the pea geometric correction image based on a standard color card to obtain a pea color standardized image;

[0024] The feature self-attention module includes a color feature branch, a texture feature branch, and a shape feature branch connected in parallel; the color feature branch processes the pea color standardized image through HSV space conversion, dynamic kernel attention, and feature dimensionality reduction to obtain a color feature vector; the texture feature branch processes the pea color standardized image through Gabor filtering, direction-aware self-attention, and LBP encoding to obtain a texture feature vector; the shape feature branch processes the pea color standardized image through Canny edge detection, contour attention, and morphological refinement to obtain a shape feature vector;

[0025] The dynamic kernel attention expression is:

[0026]

[0027] Where DKA(X) is the output of the dynamic kernel attention mechanism, X is the input matrix, Q is the query matrix, K is the key matrix, and d k is the key vector dimension, σ(·) is the sigmoid function, DWConv 3×3 (X) is a 3*3 depth-separable convolution operation on the input matrix;

[0028] The direction-aware self-attention expression is:

[0029]

[0030] Where DASA(X) is the output of the direction-aware self-attention mechanism, Θ = {0°, 45°, 90°, 135°} is the preset direction set, and Q θ is the query matrix related to the direction, K θ is the direction-dependent bond matrix, V θ is the value matrix associated with the direction, is the global average pooling operation of the gradient features of the input matrix X in the direction θ, W θ is the trainable parameter vector associated with the direction θ;

[0031] The contour attention expression is:

[0032]

[0033] Where CAE) is the output of the contour attention mechanism, E is the Canny edge detection result, and Hough (E i ) is the edge feature E i Parameterized as line segment operation, N is the number of edge features, Length(E i ) is the edge feature E i Length, ξ T is the temperature coefficient;

[0034] The output layer includes a first fully connected layer and a second fully connected layer; the first fully connected layer connects the color feature branch and the texture feature branch to perform channel weighted splicing to obtain color and texture features; the second fully connected layer connects the shape feature branch and the texture feature branch to perform channel weighted splicing to obtain shape and texture features.

[0035] Furthermore, the method for constructing a macronutrient prediction model and a micronutrient prediction model includes:

[0036] Obtaining a historical growth environment of the peas, and inputting the historical growth environment into an environmental function to obtain a growth environment index; the historical growth environment includes an atmospheric growth environment and soil conditions;

[0037] The growth environment index expression is:

[0038]

[0039]

[0040] Among them, PGI is the growth environment index, w i 、w j To dynamically assign weights, are atmospheric growth environment factors, representing temperature, humidity, light intensity, and carbon dioxide concentration, corresponding to temperature adaptability Humidity adaptability F H =0.5(1-|H air -70%| / 30%)+0.5(1-|H oil -60%| / 40%), light adaptability Carbon dioxide concentration adaptation

[0041] Among them H air is the atmospheric humidity, H oil is soil moisture, t L Average daily light intensity, Oil = {S, PH, F, O} is the soil condition, representing porosity, pH value, comprehensive fertility, organic matter, corresponding to porosity adaptability Acid-base adaptability Fertility index Organic matter index where c f is the nutrient element concentration, c f,0 is the reference value of nutrient element concentration, and the nutrient element categories include nitrogen, phosphorus, potassium, and magnesium;

[0042] Shape and texture features, spectral features and the first macronutrient component are combined into a macronutrient comprehensive set, and the macronutrient comprehensive set is divided into a macronutrient training set and a macronutrient test set according to a ratio of 6:3. The macronutrient training set is used to train the macronutrient prediction model, and the macronutrient test set is used to evaluate the performance of the macronutrient prediction model. The macronutrient prediction model includes an input layer, a Gaussian process layer, a feature fusion layer, a BP neural network and an output layer. The Gaussian process layer is used to construct a feature space kernel matrix, the feature fusion layer is used to weightedly fuse the shape and texture features with the spectral features to obtain macronutrient features, and the BP neural network is used to learn the relationship between the macronutrient features and the first macronutrient component to predict the macronutrient component. The macronutrient prediction model uses Huber Loss to evaluate the difference between the predicted value and the true value of the macronutrient component, and uses NAdam to optimize the model hyperparameters.

[0043] Color texture features, growth environment index, spectral features and the first trace nutrient component are combined into a trace comprehensive set, and the trace comprehensive set is divided into a trace training set and a trace test set according to a ratio of 6:3. The trace training set is used to train the trace nutrient prediction model, and the trace test set is used to evaluate the performance of the trace nutrient prediction model. The trace nutrient prediction model includes an input layer, an LSTM network, an attention layer, a fully connected layer and an output layer. The LSTM network is used to learn the time dependency relationship between color texture features, growth environment index, spectral features and the first trace nutrient component. The attention layer is used to calculate the feature importance weights, and the fully connected layer is used to perform feature compression and activation to predict trace nutrients. The trace nutrient prediction model uses QuantileLoss to evaluate the difference between the predicted value and the true value of the trace nutrient component, and uses RMSprop-TF to optimize the model hyperparameters.

[0044] Furthermore, the method for obtaining similar nutrient loss rates and environmental similarities includes:

[0045] The historical storage and transportation environment of the historical nutrient loss database is subjected to a spatiotemporal coarse screening based on the time tags and spatial tags corresponding to the storage and transportation environment of the peas to be analyzed to obtain a first storage and transportation environment; the spatiotemporal coarse screening criteria are that the annual historical time distance is less than 15 days and the coordinate space distance is less than 500 km;

[0046] Calculate the comprehensive similarity of the characteristic vectors corresponding to the storage and transportation environment of the peas to be analyzed and the first storage and transportation environment, take the average of the nutrient loss rates corresponding to the highest comprehensive similarities in the first three groups as the similar nutrient loss rate, and take the average of the highest comprehensive similarities in the first three groups as the environmental similarity; the comprehensive similarity is determined by weighted calculation of cosine similarity and Jacobian similarity; the similar nutrient loss rate includes similar macro loss rate and similar micro loss rate.

[0047] Furthermore, the method for obtaining the pea nutritional component analysis results includes:

[0048] Calculating a second macronutrient predicted value based on the first macronutrient predicted value and a similar macronutrient loss rate, calculating a second micronutrient predicted value based on the first micronutrient predicted value and a similar micronutrient loss rate, and correcting the second macronutrient predicted value and the second micronutrient predicted value using environmental similarity to obtain a third macronutrient predicted value and a third micronutrient predicted value;

[0049] The first macronutrient prediction value and the first micronutrient prediction value respectively reflect the macronutrient components and micronutrient components of the peas to be analyzed at the optimal picking period; the third macronutrient prediction value and the third micronutrient prediction value respectively reflect the macronutrient components and micronutrient components of the peas before consumption;

[0050] The first macronutrient predicted value, the first micronutrient predicted value, the third macronutrient predicted value and the third micronutrient predicted value are combined to form the pea nutrient component analysis result.

[0051] The second aspect is the pea nutritional analysis system based on machine learning, including:

[0052] Edge computing module: used to classify the historical nutrients into macronutrients and micronutrients, calculate the nutrient loss rate based on the historical nutrient classification results, construct a historical nutrient loss database based on the historical storage and transportation environment and the nutrient loss rate, perform edge processing on the historical monitoring data, and input the historical growth environment into the environmental function to obtain a growth environment index;

[0053] Prediction model module: used to construct a macronutrient prediction model and a micronutrient prediction model according to the edge processing result and the growth environment index, and input the monitoring data and growth environment of the peas to be analyzed into the macronutrient prediction model and the micronutrient prediction model to obtain a first macronutrient prediction value and a first micronutrient prediction value;

[0054] A cloud analysis module is configured to calculate the comprehensive similarity between the storage and transportation environment of the peas to be analyzed and the historical storage and transportation environment in the historical nutrient loss database to obtain a similar nutrient loss rate and an environmental similarity, and obtain a pea nutrient composition analysis result based on the environmental similarity, the similar nutrient loss rate, the first macronutrient predicted value, and the first micronutrient predicted value;

[0055] Management module: used to store, manage and view the historical nutrient loss library and the pea nutrient analysis results, and adjust the pea growth environment and storage and transportation environment according to the pea nutrient analysis results.

[0056] The beneficial effects of the present invention are:

[0057] The present invention is a method and system for analyzing pea nutritional components based on machine learning. Compared with the prior art, the present invention has the following technical effects:

[0058] The present invention can improve the data preprocessing capability in pea nutrient analysis through data classification, construction of a historical nutrient loss database, model construction, data matching and data correction steps, and can enhance the adaptability of multi-source data in the model, thereby improving the efficiency and accuracy of pea nutrient analysis. The pea nutrient analysis technology is optimized, which can greatly save resources and improve work efficiency. It provides more reliable technical support for pea nutrient analysis and realizes accurate prediction and dynamic evaluation of pea nutrients. It is of great significance for improving the quality management level of peas and optimizing the efficiency of the agricultural product supply chain. It can adapt to different pea nutrient analysis systems and the pea nutrient analysis needs of different users and has a certain universality. BRIEF DESCRIPTION OF THE DRAWINGS

[0059] Figure 1 The present invention is a flowchart of the steps of the method for analyzing the nutritional components of peas based on machine learning. DETAILED DESCRIPTION

[0060] The present invention will be further described below through specific examples. The illustrative examples and descriptions of the present invention are used to explain the present invention but are not intended to limit the present invention.

[0061] The pea nutritional component analysis method and system based on machine learning of the present invention include the following steps:

[0062] like Figure 1 As shown, in this embodiment, the following steps are included:

[0063] Acquire historical nutrient components and historical status data of peas; the historical nutrient components include a first nutrient component and a second nutrient component; the historical status data include historical monitoring data and historical environmental parameters; the historical environmental parameters include historical growing environment and historical storage and transportation environment;

[0064] Classifying the historical nutritional components according to macronutrients and micronutrients, calculating the nutritional loss rate based on the historical nutritional component classification results, and constructing a historical nutritional loss database based on the historical storage and transportation environment and the nutritional loss rate; the nutritional loss rate includes the macronutrient loss rate and the micronutrient loss rate;

[0065] performing edge processing on the historical monitoring data, inputting the historical growth environment into an environmental function to obtain a growth environment index, and constructing a macronutrient prediction model and a micronutrient prediction model based on the edge processing results and the growth environment index, respectively; the edge processing results include spectral features, color texture features, and shape texture features;

[0066] Inputting the monitoring data and growth environment of the peas to be analyzed into the macronutrient prediction model and the micronutrient prediction model respectively to obtain a first macronutrient prediction value and a first micronutrient prediction value;

[0067] The comprehensive similarity between the storage and transportation environment of the peas to be analyzed and the historical storage and transportation environment of the historical nutrient loss library is calculated to obtain a similar nutrient loss rate and an environmental similarity, and the pea nutrient component analysis results are obtained based on the environmental similarity, the similar nutrient loss rate, the first macronutrient predicted value, and the first micronutrient predicted value.

[0068] In this embodiment, the historical nutritional components are obtained by testing and analyzing pea samples; the first nutritional components represent the nutritional components corresponding to the optimal picking period of peas; and the second nutritional components represent the nutritional components of peas before consumption.

[0069] In this embodiment, the method for constructing a historical nutrient loss library includes:

[0070] Constructing a decision tree based on the content, type, and function of the nutrients, using the decision tree to divide the first nutrient into a first macronutrient and a first micronutrient, and using the decision tree to divide the second nutrient into a second macronutrient and a second micronutrient;

[0071] The pruning conditions of the decision tree are:

[0072]

[0073] Where Prune(node) is the decision function for whether to prune the current node, C(f,t,d) is the detection confidence, which is related to the split feature f, the current split threshold t and the detection lower limit d, σ(·) is the sigmoid function, B(n,s) is the bioavailability weight function, which is related to the nutrient type C n and sample type C s E(ΔT, ΔH) is the environmental tolerance, which is related to the temperature error ΔT and humidity error ΔH, T max is the maximum temperature error within the calibration standard tolerance, H max is the maximum humidity error in the calibration standard tolerance, τ(C n ) is nutrient type C n Dynamic threshold of

[0074] determining a macronutrient loss rate based on the first macronutrient component and the second macronutrient component, determining a micronutrient loss rate based on the first micronutrient component and the second micronutrient component, correlating the macronutrient loss rate and micronutrient loss rate of peas of the same batch with corresponding historical storage and transportation environments to obtain a set of historical nutrient loss data, and obtaining multiple sets of historical nutrient loss data to construct a historical nutrient loss library;

[0075] In the actual evaluation, in the process of decision tree construction, the pruning judgment of a certain node is taken as an example. The split feature f of a certain node is the nutrient content. The corresponding split threshold t = 50 and the detection lower limit d = 20 are taken. That is, t = 50 > 2d = 40, then the detection confidence C (f, t, d) = 1. According to the nutrient type C n (macronutrients) and sample type C s (common pea) determines the bioavailability weight B(n,s) = 0.8, based on the temperature error ΔT = 2°C, humidity error ΔH = 5%, and maximum temperature error T max =5℃, maximum humidity error H max=10% Computational environment tolerance E(ΔT,ΔH)=0.65, then pruning decision function Prune(node)=0.52<0.7=τ(C n ), so prune the current node;

[0076] Inputting a first nutrient into a decision tree divides the nutrient into a first macronutrient and a first micronutrient, and inputting a second nutrient into a decision tree divides the nutrient into a second macronutrient and a second micronutrient;

[0077] Taking the determination of one set of historical nutrient loss data as an example, the macronutrient loss rate [0.1, 0.1, 0.033] was calculated based on the first macronutrient (protein, fat, carbohydrate, unit: g / 100g) [20, 2, 60] and the second macronutrient [18, 1.5, 58], and the first micronutrient (vitamin C, vitamin B group, potassium, magnesium, iron, zinc, dietary fiber, unit: mg / 100g) [50, 2, 300 ,50,2,1.5,10000], the second trace nutrient component [40,1.8,280,45,1.8,1.3,9000] was used to calculate the trace nutrient loss rate [0.2,0.1,0.067,0.1,0.1,0.133,0.1], and the macronutrient loss rate and trace nutrient loss rate of the same batch of peas were associated with the corresponding historical storage and transportation environment to obtain a set of historical nutrient loss data, and multiple sets of historical nutrient loss data were obtained to construct a historical nutrient loss library.

[0078] In this embodiment, the edge processing method includes:

[0079] Acquire historical monitoring data and preprocess the historical monitoring data; the historical monitoring data includes spectral data and pea images; the spectral data is collected by a near-infrared spectrometer; the pea images are collected by a high-resolution camera;

[0080] Edge processing is performed on historical monitoring data. The specific steps are as follows: principal component analysis is performed on the spectral data to obtain spectral features, and the pea image is input into the self-attention image processing model to obtain color texture features and shape texture features;

[0081] The self-attention image processing model includes an input layer, a distortion correction module, a color correction module, a feature self-attention module and an output layer;

[0082] The distortion correction module performs radial / tangential distortion correction on the pea image based on checkerboard calibration to output a pea geometric correction image; the color correction module performs CIE Lab color space correction on the pea geometric correction image based on a standard color card to obtain a pea color standardized image;

[0083] The feature self-attention module includes a color feature branch, a texture feature branch, and a shape feature branch connected in parallel; the color feature branch processes the pea color standardized image through HSV space conversion, dynamic kernel attention, and feature dimensionality reduction to obtain a color feature vector; the texture feature branch processes the pea color standardized image through Gabor filtering, direction-aware self-attention, and LBP encoding to obtain a texture feature vector; the shape feature branch processes the pea color standardized image through Canny edge detection, contour attention, and morphological refinement to obtain a shape feature vector;

[0084] The dynamic kernel attention expression is:

[0085]

[0086] Where DKA(X) is the output of the dynamic kernel attention mechanism, X is the input matrix, Q is the query matrix, K is the key matrix, and d k is the key vector dimension, σ(·) is the sigmoid function, DWConv 3×3 (X) is a 3*3 depth-separable convolution operation on the input matrix;

[0087] The direction-aware self-attention expression is:

[0088]

[0089] Where DASA(X) is the output of the direction-aware self-attention mechanism, Θ = {0°, 45°, 90°, 135°} is the preset direction set, and Q θ is the query matrix related to the direction, K θ is the direction-dependent bond matrix, W θ is the value matrix associated with the direction, is the global average pooling operation of the gradient features of the input matrix X in the direction θ, W θ is the trainable parameter vector associated with the direction θ;

[0090] The contour attention expression is:

[0091]

[0092] Where CAE) is the output of the contour attention mechanism, E is the Canny edge detection result, and Hough (E i ) is the edge feature E i Parameterized as line segment operation, N is the number of edge features, Length(E i ) is the edge feature E i Length, ξ T is the temperature coefficient;

[0093] The output layer includes a first fully connected layer and a second fully connected layer; the first fully connected layer connects the color feature branch and the texture feature branch to perform channel weighted splicing to obtain color and texture features; the second fully connected layer connects the shape feature branch and the texture feature branch to perform channel weighted splicing to obtain shape and texture features;

[0094] In the actual evaluation, the historical monitoring data is processed at the edge. In the dynamic kernel attention, the query matrix Q and the key matrix K are both 64×64 in dimension, and the key vector d k The dimension is 64, direction-aware self-attention: query matrix Q θ , key matrix K θ , value matrix V θ The dimensions are all 32×32, and the key vector d k The dimension is 32;

[0095] The pea monitoring data to be analyzed were edge processed to obtain spectral features (band ±100nm / absorbance) [760 / 0.45, 850 / 0.32, 1600 / 0.25], color and texture features (color, wrinkles, hairs, spots of leaves / pods / peas) [100 / 180 / 80, 0.2, 0.3, 0.1, 120 / 190 / 90, 0.25, 0.2, 0.15, 140 / 200 / 100, 0.1, 0, 0], and shape and texture features (color, wrinkles, hairs, spots of leaves, length / cm, width / cm of pods, diameter / cm of peas, fullness) [100 / 180 / 80, 0.2, 0.3, 0.1, 8.5, 1.8, 0.85, 5.5, 0.9].

[0096] In this embodiment, the method for constructing a macronutrient prediction model and a micronutrient prediction model includes:

[0097] Obtaining a historical growth environment of the peas, and inputting the historical growth environment into an environmental function to obtain a growth environment index; the historical growth environment includes an atmospheric growth environment and soil conditions;

[0098] The growth environment index expression is:

[0099]

[0100] Among them, PGI is the growth environment index, w i 、w j To dynamically assign weights, are atmospheric growth environment factors, representing temperature, humidity, light intensity, and carbon dioxide concentration, corresponding to temperature adaptability Humidity adaptability F H =0.5(1-|H air -70%| / 30%)+0.5(1-|Hoil -60%| / 40%), light adaptability Carbon dioxide concentration adaptation Among them H air is the atmospheric humidity, H oil is soil moisture, t L Average daily light intensity, Oil = {S, PH, F, O} is the soil condition, representing porosity, pH value, comprehensive fertility, organic matter, corresponding to porosity adaptability Acid-base adaptability Fertility index Organic matter index where c f is the nutrient element concentration, c f,0 is the reference value of nutrient element concentration, and the nutrient element categories include nitrogen, phosphorus, potassium, and magnesium;

[0101] Shape and texture features, spectral features and the first macronutrient component are combined into a macronutrient comprehensive set, and the macronutrient comprehensive set is divided into a macronutrient training set and a macronutrient test set according to a ratio of 6:3. The macronutrient training set is used to train the macronutrient prediction model, and the macronutrient test set is used to evaluate the performance of the macronutrient prediction model. The macronutrient prediction model includes an input layer, a Gaussian process layer, a feature fusion layer, a BP neural network and an output layer. The Gaussian process layer is used to construct a feature space kernel matrix, the feature fusion layer is used to weightedly fuse the shape and texture features with the spectral features to obtain macronutrient features, and the BP neural network is used to learn the relationship between the macronutrient features and the first macronutrient component to predict the macronutrient component. The macronutrient prediction model uses Huber Loss to evaluate the difference between the predicted value and the true value of the macronutrient component, and uses NAdam to optimize the model hyperparameters.

[0102] Color and texture features, growth environment index, spectral features and the first trace nutrient component are combined into a trace comprehensive set, and the trace comprehensive set is divided into a trace training set and a trace test set according to a ratio of 6:3. The trace training set is used to train the trace nutrient prediction model, and the trace test set is used to evaluate the performance of the trace nutrient prediction model. The trace nutrient prediction model includes an input layer, an LSTM network, an attention layer, a fully connected layer and an output layer. The LSTM network is used to learn the time dependency relationship between color and texture features, growth environment index, spectral features and the first trace nutrient component. The attention layer is used to calculate feature importance weights, and the fully connected layer is used to perform feature compression and activation to predict trace nutrients. The trace nutrient prediction model uses QuantileLoss to evaluate the difference between the predicted value and the true value of the trace nutrient component, and uses RMSprop-TF to optimize the model hyperparameters.

[0103] In the actual evaluation, the pea growth environment to be analyzed (temperature 18°C, air humidity 65%, soil moisture 58%, light intensity 200 lux, photoperiod 10 hours, carbon dioxide concentration 400 ppm, soil porosity 1.2, soil pH 6.8, nitrogen, phosphorus, potassium and magnesium content / standard amount mg / kg-100 / 80-50 / 40-80 / 60-30 / 25, organic matter 3%) was input into the environmental function to obtain a growth environment index of 0.75;

[0104] The shape, texture and spectral characteristics of the peas to be analyzed are input into the macronutrient prediction model to obtain the first macronutrient prediction value [22, 2.2, 62];

[0105] The color and texture characteristics, growth environment index, and spectral characteristics of the peas to be analyzed are input into the micronutrient prediction model to obtain the first micronutrient prediction value [55, 2.2, 320, 55, 2.2, 1.6, 11000].

[0106] In this embodiment, the method for obtaining similar nutrient loss rates and environmental similarities includes:

[0107] The historical storage and transportation environment of the historical nutrient loss database is subjected to a spatiotemporal coarse screening based on the time tags and spatial tags corresponding to the storage and transportation environment of the peas to be analyzed to obtain a first storage and transportation environment; the spatiotemporal coarse screening criteria are that the annual historical time distance is less than 15 days and the coordinate space distance is less than 500 km;

[0108] Calculate the comprehensive similarity of the characteristic vectors corresponding to the storage and transportation environment of the peas to be analyzed and the first storage and transportation environment, take the average of the nutrient loss rates corresponding to the highest comprehensive similarities in the first three groups as the similar nutrient loss rate, and take the average of the highest comprehensive similarities in the first three groups as the environmental similarity; the comprehensive similarity is determined by weighted calculation of cosine similarity and Jacobian similarity; the similar nutrient loss rate includes similar macro loss rate and similar micro loss rate;

[0109] In the actual evaluation, the time tag (harvest date: October 5, 2024) and spatial tag (origin coordinates: 116.3°E / 39.9°N) of the peas to be analyzed were used to screen for historical storage and transportation environments with annual harvesting dates between October 1st and October 29th and coordinate spatial distances less than 500 km, resulting in 28 sets of first storage and transportation environments.

[0110] Calculate the highest comprehensive similarity between the storage and transportation environment of the peas to be analyzed (temperature / °C, humidity / %, light intensity / lux, carbon dioxide concentration / ppm, storage and transportation time / day) [5, 70%, 100, 500, 5] and the first three groups of the first storage and transportation environment. The cosine similarity and Jacobian similarity are 0.8 / 0.75 / 0.78 and 0.7 / 0.72 / 0.71 respectively. The cosine similarity weight is 0.6 and the Jacobian similarity weight is 0.4. The calculated comprehensive similarities are 0.76, 0.738, and 0.752, corresponding to an environmental similarity of 0.75.

[0111] According to the macronutrient loss rates corresponding to the three groups of the first storage and transportation environments [0.1, 0.08, 0.05] / [0.12, 0.09, 0.06] / [0.09, 0.07, 0.04], [0.15, 0.1, 0.08, 0.06, 0.05, 0.07, 0.08], [0.16, 0.11, 0.09, 0.07, 0.06, 0.08, 0.009], and [0.14, 0.009, 0.007, 0.005, 0.004, 0.006, 0.07], similar macronutrient loss rates [0.103, 0.08, 0.05] and similar micronutrient loss rates [0.15, 0.1, 0.08, 0.06, 0.05, 0.007, 0.008] were determined.

[0112] In this embodiment, the method for obtaining the pea nutritional component analysis results includes:

[0113] Calculating a second macronutrient predicted value based on the first macronutrient predicted value and a similar macronutrient loss rate, calculating a second micronutrient predicted value based on the first micronutrient predicted value and a similar micronutrient loss rate, and correcting the second macronutrient predicted value and the second micronutrient predicted value using environmental similarity to obtain a third macronutrient predicted value and a third micronutrient predicted value;

[0114] The first macronutrient prediction value and the first micronutrient prediction value respectively reflect the macronutrient components and micronutrient components of the peas to be analyzed at the optimal picking period; the third macronutrient prediction value and the third micronutrient prediction value respectively reflect the macronutrient components and micronutrient components of the peas before consumption;

[0115] The first macronutrient predicted value, the first micronutrient predicted value, the third macronutrient predicted value, and the third micronutrient predicted value constitute a pea nutrient component analysis result;

[0116] In the actual evaluation, the second macronutrient predicted value [19.734, 2.024, 58.9] was calculated based on the first macronutrient predicted value and similar macronutrient loss rate. The second micronutrient predicted value [46.75, 1.98, 294.4, 51.7, 2.09, 1.589, 10912] was calculated based on the first micronutrient predicted value and similar micronutrient loss rate. The correction factor 1+0.1(0.75-1)=0.975 was determined based on the environmental similarity of 0.75. The second macronutrient predicted value and the second micronutrient predicted value were corrected to obtain the third macronutrient predicted value [19.24, 1.973, 57.428] and the third micronutrient predicted value [45.581, 1.931, 286.04, 50.408, 2.048, 1.549, 10649].

[0117] The first macronutrient predicted value, the first micronutrient predicted value, the third macronutrient predicted value and the third micronutrient predicted value are combined to form the pea nutrient component analysis result.

[0118] The second aspect is the pea nutritional analysis system based on machine learning, including:

[0119] Edge computing module: used to classify the historical nutrients into macronutrients and micronutrients, calculate the nutrient loss rate based on the historical nutrient classification results, construct a historical nutrient loss database based on the historical storage and transportation environment and the nutrient loss rate, perform edge processing on the historical monitoring data, and input the historical growth environment into the environmental function to obtain a growth environment index;

[0120] Prediction model module: used to construct a macronutrient prediction model and a micronutrient prediction model according to the edge processing result and the growth environment index, and input the monitoring data and growth environment of the peas to be analyzed into the macronutrient prediction model and the micronutrient prediction model to obtain a first macronutrient prediction value and a first micronutrient prediction value;

[0121] A cloud analysis module is configured to calculate the comprehensive similarity between the storage and transportation environment of the peas to be analyzed and the historical storage and transportation environment in the historical nutrient loss database to obtain a similar nutrient loss rate and an environmental similarity, and obtain a pea nutrient composition analysis result based on the environmental similarity, the similar nutrient loss rate, the first macronutrient predicted value, and the first micronutrient predicted value;

[0122] The management module is used to store, manage, and view the historical nutrient loss database and the pea nutrient analysis results, and to adjust the pea growth environment and storage and transportation environment based on the pea nutrient analysis results. The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A method for analyzing pea nutritional components based on machine learning, characterized in that: The following steps are involved: S1. Obtain historical nutrient composition and historical status data of peas; the historical nutrient composition includes a first nutrient composition and a second nutrient composition; the historical status data includes historical monitoring data and historical environmental parameters; the historical environmental parameters include historical growing environment and historical storage and transportation environment; S2. Classifying the historical nutritional components according to macronutrients and micronutrients, calculating the nutrient loss rate based on the historical nutrient classification results, and constructing a historical nutrient loss database based on the historical storage and transportation environment and the nutrient loss rate; the nutrient loss rate includes the macronutrient loss rate and the micronutrient loss rate; S3. Performing edge processing on the historical monitoring data, inputting the historical growth environment into an environmental function to obtain a growth environment index, and constructing a macronutrient prediction model and a micronutrient prediction model based on the edge processing results and the growth environment index, respectively; the edge processing results include spectral features, color and texture features, and shape and texture features; S4. Inputting the monitoring data and growth environment of the peas to be analyzed into the macronutrient prediction model and the micronutrient prediction model, respectively, to obtain a first macronutrient prediction value and a first micronutrient prediction value; S5. Calculate the comprehensive similarity between the storage and transportation environment of the peas to be analyzed and the historical storage and transportation environment of the historical nutrient loss database to obtain a similar nutrient loss rate and an environmental similarity, and obtain a pea nutrient analysis result based on the environmental similarity, the similar nutrient loss rate, the first macronutrient predicted value, and the first micronutrient predicted value.

2. The method for analyzing pea nutrients based on machine learning according to claim 1, characterized in that: The historical nutritional components are obtained by testing and analyzing pea samples; the first nutritional components represent the nutritional components corresponding to the optimal picking period of peas; and the second nutritional components represent the nutritional components of peas before consumption.

3. The method for analyzing pea nutritional components based on machine learning according to claim 1, wherein: The method for constructing a historical nutrient loss library comprises: Constructing a decision tree based on the content, type, and function of the nutrients, using the decision tree to divide the first nutrient into a first macronutrient and a first micronutrient, and using the decision tree to divide the second nutrient into a second macronutrient and a second micronutrient; The pruning conditions of the decision tree are: Where Prune(node) is the decision function for whether to prune the current node, C(f,t,d) is the detection confidence, which is related to the split feature f, the current split threshold t and the detection lower limit d, σ(·) is the sigmoid function, B(n,s) is the bioavailability weight function, which is related to the nutrient type C n and sample type C s E(ΔT, ΔH) is the environmental tolerance, which is related to the temperature error ΔT and humidity error ΔH, T max is the maximum temperature error within the calibration standard tolerance, H max is the maximum humidity error in the calibration standard tolerance, τ(C n ) is nutrient type C n Dynamic threshold of The macronutrient loss rate is determined based on the first macronutrient component and the second macronutrient component, and the micronutrient loss rate is determined based on the first micronutrient component and the second micronutrient component. The macronutrient loss rate and micronutrient loss rate of peas in the same batch are associated with the corresponding historical storage and transportation environment to obtain a set of historical nutrient loss data, and multiple sets of historical nutrient loss data are obtained to construct a historical nutrient loss library.

4. The method for analyzing pea nutritional components based on machine learning according to claim 1, wherein: The method for edge processing comprises: Acquire historical monitoring data and preprocess the historical monitoring data; the historical monitoring data includes spectral data and pea images; the spectral data is collected by a near-infrared spectrometer; the pea images are collected by a high-resolution camera; Edge processing is performed on historical monitoring data. The specific steps are as follows: principal component analysis is performed on the spectral data to obtain spectral features, and the pea image is input into the self-attention image processing model to obtain color texture features and shape texture features; The self-attention image processing model includes an input layer, a distortion correction module, a color correction module, a feature self-attention module and an output layer; The distortion correction module performs radial / tangential distortion correction on the pea image based on checkerboard calibration to output a pea geometric correction image; the color correction module performs CIE Lab color space correction on the pea geometric correction image based on a standard color card to obtain a pea color standardized image; The feature self-attention module includes a color feature branch, a texture feature branch, and a shape feature branch connected in parallel; the color feature branch processes the pea color standardized image through HSV space conversion, dynamic kernel attention, and feature dimensionality reduction to obtain a color feature vector; the texture feature branch processes the pea color standardized image through Gabor filtering, direction-aware self-attention, and LBP encoding to obtain a texture feature vector; the shape feature branch processes the pea color standardized image through Canny edge detection, contour attention, and morphological refinement to obtain a shape feature vector; The dynamic kernel attention expression is: Where DKA(X) is the output of the dynamic kernel attention mechanism, X is the input matrix, Q is the query matrix, K is the key matrix, and d k is the key vector dimension, σ(·) is the sigmoid function, DWConv 3×3 (X) is a 3*3 depth-separable convolution operation on the input matrix; The direction-aware self-attention expression is: Where DASA(X) is the output of the direction-aware self-attention mechanism, Θ = {0°, 45°, 90°, 135°} is the preset direction set, and Q θ is the query matrix related to the direction, K θ is the direction-dependent bond matrix, V θ is the value matrix associated with the direction, is the global average pooling operation of the gradient features of the input matrix X in the direction θ, W θ is the trainable parameter vector associated with the direction θ; The contour attention expression is: Among them, CA(E) is the output of the contour attention mechanism, E is the Canny edge detection result, and Hough(E i ) is the edge feature E i Parameterized as line segment operation, N is the number of edge features, Length(E i ) is the edge feature E i Length, ξ T is the temperature coefficient; The output layer includes a first fully connected layer and a second fully connected layer; the first fully connected layer connects the color feature branch and the texture feature branch to perform channel weighted splicing to obtain color and texture features; the second fully connected layer connects the shape feature branch and the texture feature branch to perform channel weighted splicing to obtain shape and texture features.

5. The method for analyzing pea nutritional components based on machine learning according to claim 1, wherein: The method for constructing a macronutrient prediction model and a micronutrient prediction model comprises: Obtaining a historical growth environment of the peas, and inputting the historical growth environment into an environmental function to obtain a growth environment index; the historical growth environment includes an atmospheric growth environment and soil conditions; The growth environment index expression is: Among them, PGI is the growth environment index, w i 、w j To dynamically assign weights, are atmospheric growth environment factors, representing temperature, humidity, light intensity, and carbon dioxide concentration, corresponding to temperature adaptability Humidity adaptability F H =0.5(1-|H air -70%| / 30%)+0.5(1-|H oil -60%| / 40%), light adaptability Carbon dioxide concentration adaptation Among them H air is the atmospheric humidity, H oil is soil moisture, t L Average daily light intensity, O il ={S, PH, F, O} are soil conditions, representing porosity, pH value, comprehensive fertility, and organic matter, respectively, corresponding to porosity adaptability Acid-base adaptability Fertility index Organic matter index where c f is the nutrient element concentration, c f,0 is the reference value of nutrient element concentration, and the nutrient element categories include nitrogen, phosphorus, potassium, and magnesium; Shape and texture features, spectral features and the first macronutrient component are combined into a macronutrient comprehensive set, and the macronutrient comprehensive set is divided into a macronutrient training set and a macronutrient test set according to a ratio of 6:

3. The macronutrient training set is used to train the macronutrient prediction model, and the macronutrient test set is used to evaluate the performance of the macronutrient prediction model. The macronutrient prediction model includes an input layer, a Gaussian process layer, a feature fusion layer, a BP neural network and an output layer. The Gaussian process layer is used to construct a feature space kernel matrix, the feature fusion layer is used to weightedly fuse the shape and texture features with the spectral features to obtain macronutrient features, and the BP neural network is used to learn the relationship between the macronutrient features and the first macronutrient component to predict the macronutrient component. The macronutrient prediction model uses Huber Loss to evaluate the difference between the predicted value and the true value of the macronutrient component, and uses NAdam to optimize the model hyperparameters. Color and texture features, growth environment index, spectral features and the first trace nutrient component are combined into a trace comprehensive set, and the trace comprehensive set is divided into a trace training set and a trace test set according to a ratio of 6:

3. The trace training set is used to train the trace nutrient prediction model, and the trace test set is used to evaluate the performance of the trace nutrient prediction model. The trace nutrient prediction model includes an input layer, an LSTM network, an attention layer, a fully connected layer and an output layer. The LSTM network is used to learn the time dependency between color and texture features, growth environment index, spectral features and the first trace nutrient component. The attention layer is used to calculate feature importance weights, and the fully connected layer is used to perform feature compression and activation to predict trace nutrients. The micronutrient prediction model uses Quantile Loss to evaluate the difference between the predicted value and the true value of the micronutrient component, and uses RMSprop-TF to optimize the model hyperparameters.

6. The method for analyzing pea nutritional components based on machine learning according to claim 1, wherein: The method for obtaining similar nutrient loss rates and environmental similarities comprises: The historical storage and transportation environment of the historical nutrient loss database is subjected to a spatiotemporal coarse screening based on the time tags and spatial tags corresponding to the storage and transportation environment of the peas to be analyzed to obtain a first storage and transportation environment; the spatiotemporal coarse screening criteria are that the annual historical time distance is less than 15 days and the coordinate space distance is less than 500 km; Calculate the comprehensive similarity of the characteristic vectors corresponding to the storage and transportation environment of the peas to be analyzed and the first storage and transportation environment, take the average of the nutrient loss rates corresponding to the highest comprehensive similarities in the first three groups as the similar nutrient loss rate, and take the average of the highest comprehensive similarities in the first three groups as the environmental similarity; the comprehensive similarity is determined by weighted calculation of cosine similarity and Jacobian similarity; the similar nutrient loss rate includes similar macro loss rate and similar micro loss rate.

7. The method for analyzing pea nutritional components based on machine learning according to claim 1, wherein: The method for obtaining pea nutritional component analysis results comprises: Calculating a second macronutrient predicted value based on the first macronutrient predicted value and a similar macronutrient loss rate, calculating a second micronutrient predicted value based on the first micronutrient predicted value and a similar micronutrient loss rate, and correcting the second macronutrient predicted value and the second micronutrient predicted value using environmental similarity to obtain a third macronutrient predicted value and a third micronutrient predicted value; The first macronutrient prediction value and the first micronutrient prediction value respectively reflect the macronutrient components and micronutrient components of the peas to be analyzed at the optimal picking period; the third macronutrient prediction value and the third micronutrient prediction value respectively reflect the macronutrient components and micronutrient components of the peas before consumption; The first macronutrient predicted value, the first micronutrient predicted value, the third macronutrient predicted value and the third micronutrient predicted value are combined to form the pea nutrient component analysis result.

8. A pea nutrient analysis system based on machine learning, for executing the method according to any one of claims 1 to 7, characterized in that: include: Edge computing module: used to classify the historical nutrients into macronutrients and micronutrients, calculate the nutrient loss rate based on the historical nutrient classification results, construct a historical nutrient loss database based on the historical storage and transportation environment and the nutrient loss rate, perform edge processing on the historical monitoring data, and input the historical growth environment into the environmental function to obtain a growth environment index; Prediction model module: used to construct a macronutrient prediction model and a micronutrient prediction model according to the edge processing result and the growth environment index, and input the monitoring data and growth environment of the peas to be analyzed into the macronutrient prediction model and the micronutrient prediction model to obtain a first macronutrient prediction value and a first micronutrient prediction value; A cloud analysis module is configured to calculate the comprehensive similarity between the storage and transportation environment of the peas to be analyzed and the historical storage and transportation environment in the historical nutrient loss database to obtain a similar nutrient loss rate and an environmental similarity, and obtain a pea nutrient composition analysis result based on the environmental similarity, the similar nutrient loss rate, the first macronutrient predicted value, and the first micronutrient predicted value; Management module: used to store, manage and view the historical nutrient loss library and the pea nutrient analysis results, and adjust the pea growth environment and storage and transportation environment according to the pea nutrient analysis results.