A method and system for analyzing the component content of agricultural products based on multispectral imaging

Through multispectral imaging technology, the characteristics of agricultural product components are extracted and prediction models are established, which solves the problem of difficulty in predicting changes in agricultural product components in the existing technology, and achieves rapid and accurate component analysis and quality evaluation, which improves the quality control and improvement of agricultural products.

CN119339826BActive Publication Date: 2025-06-24JIANGSU GUANGHAI INSPECTION & TESTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411643713.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-06-24
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

It is difficult for the prior art to quickly and accurately extract the characteristics of agricultural product ingredient content and predict future changes in component content, resulting in the inability to effectively predict the nutritional loss or quality changes of agricultural products.

Method used

The agricultural product component content analysis method based on multispectral imaging is adopted. By obtaining the spectral image data of agricultural products, processing and extracting the component content characteristic data, establishing a content prediction model, predicting the change trend of component content in the future time period, and evaluating the quality of agricultural products using quality evaluation algorithms.

Benefits of technology

It has achieved rapid and accurate extraction of agricultural product component content characteristics, predict future changes in component content, help predict nutritional loss or quality changes of agricultural products, ensure that agricultural products are sold and consumed in the best condition, and improve the scientific nature of agricultural product quality control and improvement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119339826B_ABST
    Figure CN119339826B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for analyzing the component content of agricultural products based on multispectral imaging, which relates to the technical field of detecting the component content of agricultural products. The method for analyzing the component content of agricultural products includes the following steps: extracting the characteristic data of the component content of agricultural products; obtaining the change trend of the component content of agricultural products in a future time period based on a content prediction model; judging whether the quality of agricultural products meets the requirements; and identifying the component content of agricultural products related to target indicators. Through the established content prediction model, the present invention can predict the change trend of the component content of agricultural products in a future period of time, thereby helping to predict the nutrient loss or quality change of agricultural products. Based on the change trend of the component content, it can accurately evaluate whether the quality of agricultural products meets the requirements, ensure that agricultural products are sold and consumed in the best state, and further contribute to improving the overall quality standard of agricultural products.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of detecting the component content of agricultural products. Specifically, it relates to a method and system for analyzing the component content of agricultural products based on multispectral imaging. Background Art

[0002] All kinds of components in agricultural products, such as proteins, sugars, vitamins, minerals, etc., play a crucial role in the growth and development of the human body, the maintenance of the immune system, and the normal operation of various biochemical processes. Therefore, accurately detecting the component content of agricultural products not only helps to evaluate their nutritional value and quality, but also has important significance for consumer health protection, market supervision, and agricultural product production management. With the development of spectral imaging technology, multispectral imaging technology has shown great application potential in the field of agricultural product component detection. Multispectral imaging not only combines the high precision of spectral analysis but also can provide rich spatial information. By capturing spectral data in different bands, different components in agricultural products will exhibit unique optical characteristics in different bands.

[0003] In the prior art, it is not convenient to quickly and accurately extract the component content characteristics, and it is not convenient to predict the change trend of the component content of agricultural products in the next period of time, so it cannot help to predict the nutritional loss or quality change of agricultural products. At the same time, it is not convenient to accurately evaluate whether the quality of agricultural products meets the requirements according to the change trend of the component content, and it cannot ensure that agricultural products are sold and consumed in the best state. Furthermore, it is not convenient to help optimize the quality control of agricultural products, and it cannot provide a scientific basis for the improvement, cultivation, and production of agricultural products, reducing the overall quality standard of agricultural products.

[0004] In view of the problems in the related art, no effective solution has been proposed yet. Summary of the Invention

[0005] In view of the deficiencies of the prior art, the present invention proposes a method and system for analyzing the component content of agricultural products based on multispectral imaging, which solves the problems in the above-mentioned background art that it is not convenient to quickly and accurately extract the component content characteristics, and it is not convenient to predict the change trend of the component content of agricultural products in the next period of time, so it cannot help to predict the nutritional loss or quality change of agricultural products. At the same time, it is not convenient to accurately evaluate whether the quality of agricultural products meets the requirements according to the change trend of the component content, and it cannot ensure that agricultural products are sold and consumed in the best state. Furthermore, it is not convenient to help optimize the quality control of agricultural products, and it cannot provide a scientific basis for the improvement, cultivation, and production of agricultural products, reducing the overall quality standard of agricultural products.

[0006] To achieve the above objectives, the present invention is realized through the following technical solutions:

[0007] According to one aspect of the present invention, there is provided a method for analyzing the component content of agricultural products based on multispectral imaging. The method for analyzing the component content of agricultural products based on multispectral imaging includes the following steps:

[0008] S1. Obtain spectral image data of agricultural products based on multispectral imaging technology, process the spectral image data, and extract the characteristic data of the component content of agricultural products;

[0009] S2. Based on the characteristic data of the component content of agricultural products, establish a content prediction model, and obtain the change trend of the component content of agricultural products in a future time period based on the content prediction model;

[0010] S3. Use a quality evaluation algorithm to evaluate the change trend of the component content of agricultural products, and judge whether the quality of agricultural products meets the requirements;

[0011] S4. Analyze the judgment result based on a feature analysis algorithm to identify the component content of agricultural products related to the target index;

[0012] Based on the characteristic data of the component content of agricultural products, establishing a content prediction model, and obtaining the change trend of the component content of agricultural products in a future time period based on the content prediction model includes the following steps:

[0013] S21. Divide the characteristic data set of the component content of agricultural products into a training set and a test set;

[0014] S22. Randomly initialize the population of the optimization algorithm, set the maximum number of iterations and the population size, and preset the value range for the hyperparameters of the content prediction model;

[0015] S23. Construct a content prediction model, map the individual positions of the population of the optimization algorithm to the hyperparameter values of the content prediction model, and use the error after training through the content prediction model as the individual fitness value;

[0016] S24. Update the linear reduction factor of the optimization algorithm according to the iteration formula, update the hyperparameter values according to the optimization formula, and record the optimal hyperparameter values in the current iteration;

[0017] S25. Judge whether the current optimization algorithm reaches the preset maximum number of iterations. If it reaches, assign the optimal hyperparameter values to the content prediction model. Otherwise, return to step S23 to continue optimization;

[0018] S26. Construct the final content prediction model based on the optimal hyperparameters optimized by the optimization algorithm, and use the final content prediction model to obtain the change trend of the component content of agricultural products in a future time period.

[0019] Further, obtaining spectral image data of agricultural products based on multispectral imaging technology and processing the spectral image data to extract the component content characteristic data of agricultural products includes the following steps:

[0020] S11. Use a multispectral imaging device to obtain spectral image data of agricultural products at different bands;

[0021] S12. If there are dark pixels in the spectral image data, use the increase in the reflectivity of the dark pixels as an indicator of atmospheric influence, and subtract the corresponding band values of other pixels to achieve atmospheric correction;

[0022] S13. Set the size of the search block and the threshold of the highlighted area, find the area where the average value of the pixels in the search block is greater than the threshold, perform normalization processing on each pixel in the area where the average value is greater than the threshold, calculate the variance, and identify the continuously highlighted area with gentle changes through the variance matrix;

[0023] S14. Based on the continuously highlighted area, perform a reflectivity inversion operation and perform reflectivity correction on the spectral image data;

[0024] S15. Perform feature extraction on the spectral image data after reflectivity correction to obtain the component content characteristic data of agricultural products.

[0025] Further, performing feature extraction on the spectral image data after reflectivity correction to obtain the component content characteristic data of agricultural products includes the following steps:

[0026] S151. Determine the spectral range to be analyzed according to the preset spectral absorption characteristic parameters of agricultural product components;

[0027] S152. Perform an envelope removal operation on the spectral curve of each pixel point after reflectivity correction to eliminate the baseline drift in the spectral curve and obtain the processed pixel spectral characteristic parameters;

[0028] S153. Perform spectral feature matching analysis on the spectral characteristic parameters of each pixel point and the preset reference spectrum, and calculate the difference between the two;

[0029] S154. According to the results of spectral feature matching, calculate the goodness of fit pixel by pixel, evaluate the similarity between the spectral characteristic parameters of each pixel point and the preset reference spectrum parameters, calculate the spectral characteristic parameters corresponding to each pixel point, and extract the spectral characteristic parameters related to the preset spectral absorption characteristics of agricultural product components;

[0030] S155. Set a threshold value. Based on the goodness of fit and the spectral feature parameters extracted and related to the preset spectral absorption characteristics of agricultural product components, determine whether the spectral features of the pixel points conform to the preset spectral absorption characteristics of agricultural product components. If the goodness of fit is higher than the set threshold value, it is considered that the pixel points contain the preset spectral absorption characteristics of agricultural product components, and record their component content characteristics.

[0031] S156. Repeat steps S152 to S155, and process the entire spectral image data pixel by pixel to extract the component content characteristics of all pixels.

[0032] S157. Integrate the extracted spectral feature parameters and the goodness of fit information to generate the component content characteristic data of the agricultural products containing all pixel points.

[0033] Further, the optimization formula is:

[0034] ;

[0035] In the formula, K a_new ( T + 1) represents the value of the a th hyperparameter configuration at the T + 1th iteration;

[0036] K a ( T ) represents the value of the a th hyperparameter configuration at the T th iteration;

[0037] K best ( T ) represents the optimal hyperparameter value among all hyperparameter configurations at the T th iteration;

[0038] Cauchy represents the Cauchy operator;

[0039] K f ( T ) represents the value of the hyperparameter configuration randomly selected at the T th iteration.

[0040] Further, using a quality assessment algorithm to evaluate the change trend of the component content of agricultural products, determining whether the quality of agricultural products meets the requirements includes the following steps:

[0041] S31. Set the parameters of the quality assessment algorithm and initialize the component content data of agricultural products.

[0042] S32. Calculate the initial fitness function value of each agricultural product based on the relevant indicators of the change trend of the agricultural product components content;

[0043] S33. Update the content of each agricultural product component using the behavior rules;

[0044] S34. During the iterative optimization of the quality evaluation algorithm, perform local search optimization on the currently found optimal change trend of the agricultural product component content through the local sequence floating backward selection mechanism;

[0045] S35. When the quality evaluation algorithm reaches the maximum number of iterations, output the final change trend of the agricultural product component content and its corresponding fitness function value;

[0046] S36. Judge whether the quality of the agricultural product meets the requirements based on the optimal fitness value, and output the final quality evaluation result.

[0047] Further, during the iterative optimization of the quality evaluation algorithm, performing local search optimization on the currently found optimal change trend of the agricultural product component content through the local sequence floating backward selection mechanism includes the following steps:

[0048] S341. Preset a subset of the agricultural product component content. In the current subset of the agricultural product component content, perform the sequence floating backward selection operation, delete the component that has the greatest impact on the fitness value, update the subset of the agricultural product component content, and obtain a new subset of the agricultural product component content;

[0049] S342. Use the sequence floating forward selection mechanism to select new agricultural product component content from the remaining agricultural product component content set, add it to the current subset of the agricultural product component content, ensure that the impact on the fitness value is minimized after addition, and update the subset of the agricultural product component content;

[0050] S343. If the added agricultural product component content is the same as the previously deleted agricultural product component content, continue to perform the sequence floating backward selection operation to further delete the component that has the greatest impact on the fitness value;

[0051] S344. Search for new components from the remaining agricultural product component content set, and use the sequence floating forward selection mechanism to search for new components. If the fitness value increases after adding the new component, add the component to the subset and update it. If the fitness does not increase, terminate the local search and output the final change trend of the agricultural product component content.

[0052] Further, analyzing the judgment result based on the feature analysis algorithm to identify the agricultural product component content related to the target indicators includes the following steps:

[0053] S41. Obtain the initial agricultural product ingredient content subset, and optimize the initial agricultural product ingredient content subset through the ingredient optimization algorithm to preliminarily screen out the potentially relevant agricultural product ingredient content related to the target index;

[0054] S42. Select several optimal subsets related to the target index from the optimized agricultural product ingredient content subset to form a reference set;

[0055] S43. Generate several subsets in the reference set and combine each subset to produce a new agricultural product ingredient subset;

[0056] S44. Merge the current reference set with the newly generated agricultural product ingredient content subset, and select several optimized optimal subsets as the reference set for the next round of iteration;

[0057] S45. Determine whether the current agricultural product ingredient content subset meets the termination condition. If it does not meet, return to step S43 for further optimization. If it meets, output the agricultural product ingredient content related to the target index.

[0058] Further, obtaining the initial agricultural product ingredient content subset and optimizing the initial agricultural product ingredient content subset through the ingredient optimization algorithm to preliminarily screen out the potentially relevant agricultural product ingredient content related to the target index includes the following steps:

[0059] S411. Set the initial scale, variable quantity of the agricultural product ingredient content subset, and the termination condition of the optimization process;

[0060] S412. Evaluate the fitness of the currently generated agricultural product ingredient content subset to identify the optimal ingredient content combination and the worst ingredient content combination;

[0061] S413. Based on the difference between the optimal ingredient content combination and the worst ingredient content combination, use the update formula to generate an updated agricultural product ingredient content combination, making the new agricultural product ingredient content combination closer to the target index;

[0062] S414. Compare the updated agricultural product ingredient content combination with the previous agricultural product ingredient content combination. If the fitness value of the new agricultural product ingredient content combination is the best, use the new agricultural product ingredient content combination to replace the old one; otherwise, retain the old agricultural product ingredient content combination;

[0063] S415. Determine whether the current optimization reaches the preset termination condition. If it reaches the termination condition, output the optimal agricultural product ingredient content combination as the preliminarily screened potentially relevant agricultural product ingredient content related to the target index. Otherwise, return to step S412 for further optimization.

[0064] Further, the update formula is:

[0065] ;

[0066] In the formula, is expressed as H i,j,c the value of the updated content of agricultural products;

[0067] H i,j,c is expressed as the c th iteration of the j th population of the i value of the content of agricultural products;

[0068] is expressed as the i value of the content of agricultural products in the corresponding optimal combination of content;

[0069] is expressed as the i value of the content of agricultural products in the corresponding worst combination of content;

[0070] s 1 and s 2 are both expressed as random numbers.

[0071] According to another aspect of the present invention, there is also provided an agricultural product composition content analysis system based on multispectral imaging. The agricultural product composition content analysis system based on multispectral imaging includes:

[0072] A data acquisition module, configured to acquire spectral image data of agricultural products based on multispectral imaging technology, process the spectral image data, and extract the composition content feature data of agricultural products;

[0073] A model establishment module, configured to establish a content prediction model based on the composition content feature data of agricultural products, and obtain the change trend of the composition content of agricultural products in a future time period based on the content prediction model;

[0074] A quality evaluation module, configured to evaluate the change trend of the composition content of agricultural products by using a quality evaluation algorithm, and determine whether the quality of agricultural products meets the requirements;

[0075] A composition analysis module, configured to analyze the judgment result based on a feature analysis algorithm, and identify the composition content of agricultural products related to the target index;

[0076] Among them, the data acquisition module is connected through the model establishment module and the quality evaluation module, and the quality evaluation module is connected to the content analysis module.

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

[0078] 1. The present invention obtains spectral data of agricultural products through multispectral imaging technology, can quickly and accurately extract the component content characteristics, greatly reduces the complex sample preparation and detection processes in traditional methods, improves the efficiency, and through the established component content prediction model, can predict the change trend of the component content of agricultural products in the next period of time, so as to help predict the nutrient loss or quality change of agricultural products. Based on the change trend of the component content, it can accurately evaluate whether the quality of agricultural products meets the requirements, ensure that agricultural products are sold and consumed in the best state, and further analyze the evaluation results using feature analysis algorithms, can identify the key component contents related to the target indicators, not only helps to optimize the quality control of agricultural products, but also provides a scientific basis for the improvement, cultivation and production of agricultural products, thus contributing to the improvement of the overall quality standard of agricultural products.

[0079] 2. The present invention obtains spectral data of agricultural products at different bands by using a multispectral imaging device, and through processes such as atmospheric correction and reflectance correction, ensures the accuracy and consistency of the data. By adjusting the reflectance of dark pixels, the interference of atmospheric conditions on the detection of component content is eliminated, and based on the spectral absorption characteristics of agricultural products, means such as envelope removal, spectral matching and goodness-of-fit analysis are used to effectively eliminate the errors caused by spectral baseline drift, ensuring that the spectral data can accurately reflect the true content of agricultural product components. At the same time, the entire spectral image data is processed pixel by pixel, the spectral characteristics of each pixel point are extracted and the component content is calculated. This full-pixel analysis method greatly improves the detection coverage, thereby ensuring that every part of the entire agricultural product sample is effectively detected and analyzed, and further improving the accuracy, speed and non-destructiveness of the detection of agricultural product component content.

[0080] 3. The present invention constructs a content prediction model to more accurately reflect the future change trend of component content, and adopts a combination of a linear reduction factor and a Cauchy operator to gradually adjust the hyperparameter values of the content prediction model. This optimization process ensures that in complex agricultural product component prediction scenarios, the content prediction model can quickly converge to the optimal solution, effectively reduces the calculation time, and improves the stability and robustness of the content prediction model. Moreover, based on the optimized content prediction model, the change trend of the component content of agricultural products in the future time period can be predicted. By predicting the component changes, the storage time and transportation conditions of agricultural products can be planned in advance to maximize the preservation of their nutritional value and market competitiveness. Furthermore, according to the prediction results, preservation measures or market decisions can be taken in advance to ensure that the quality of the product remains stable during the best period, reduce losses and increase benefits.

[0081] 4. The present invention combines a quality assessment algorithm with an index of the changing trend of component content, ensuring more accurate quality judgment of agricultural products. Thus, it can capture the trend of component content changing over time, which is not only used for current quality analysis but also supports predicting future quality changes, helping agricultural product managers make decisions in advance. By combining local sequence floating backward and forward selection, it continuously screens out the components that have the greatest impact on fitness and dynamically adjusts the subset of component content, enabling the quality assessment algorithm to find the optimal changing trend of component content and output a more reliable quality assessment result. In the local sequence floating selection mechanism, by deleting unimportant components and preferentially selecting key components, the influence of irrelevant components is significantly reduced. Through the accurate prediction and analysis of the changing trend of component content, both the quality status and future changes of agricultural products can be effectively grasped, thereby helping enterprises optimize storage and transportation conditions and reduce nutrient loss and quality risks.

[0082] 5. The present invention uses a feature analysis algorithm to perform multiple screenings and combinations on the optimized subset of components, and finally extracts the agricultural product components most relevant to the target index, which can effectively reduce data redundancy, highlight the components related to key quality standards, and improve the accuracy of detection and evaluation. Moreover, by adopting a component optimization algorithm, the update formula utilizes the difference between the optimal and worst component content combinations to generate an updated combination, making the component combination after each iteration closer to the target index, improving the optimization efficiency and avoiding falling into the local optimum situation. At the same time, by performing component screening and combination in multiple subsets, it ensures comprehensive coverage of agricultural product components and avoids the deviation problems that may be brought by single feature analysis. The finally output component content combination has been optimized through multiple rounds and can more comprehensively reflect the component characteristics of agricultural products, thereby improving the analysis and detection efficiency of agricultural product component content. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required to be used in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0084] Figure 1 is a flowchart of a method for analyzing the component content of agricultural products based on multispectral imaging according to an embodiment of the present invention;

[0085] Figure 2 is a schematic block diagram of a system for analyzing the component content of agricultural products based on multispectral imaging according to an embodiment of the present invention.

[0086] In the figure:

[0087] 1. Data acquisition module; 2. Model establishment module; 3. Quality assessment module; 4. Component analysis module. Detailed implementation manners

[0088] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments.

[0089] In the description of the present invention, unless otherwise specified, the meaning of "a plurality of" is two or more. In addition, the terms "first", "second", "third", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance.

[0090] According to an embodiment of the present invention, a method and system for analyzing the component content of agricultural products based on multispectral imaging are provided.

[0091] Now, the present invention will be further described in conjunction with the accompanying drawings and specific implementation manners. As Figure 1 shown, the method for analyzing the component content of agricultural products based on multispectral imaging according to an embodiment of the present invention includes the following steps:

[0092] S1. Obtain spectral image data of agricultural products based on multispectral imaging technology, and process the spectral image data to extract characteristic data of the component content of the agricultural products.

[0093] Specifically, multispectral imaging technology refers to a technology that generates images by capturing the reflection, absorption, or scattering characteristics of an object in multiple specific bands (i.e., light in different spectral ranges). Different materials, substances, or components have specific responses to light of different wavelengths, which enables multispectral imaging to distinguish the distribution and content of different components or substances in an object. Compared with ordinary RGB images (which only include three bands of red, green, and blue), multispectral imaging covers more spectral information, including multiple bands such as visible light, near-infrared, and short-wave infrared.

[0094] It should be noted that a dedicated multispectral camera is used, which can capture optical signals in different bands. These bands can span the visible and invisible light ranges (such as infrared and ultraviolet light). Each band reflects the optical properties of different components on and inside the agricultural product surface. The camera is usually equipped with filters or uses a spectroscopic device to decompose the spectral information into different bands. Then, the agricultural product is placed within the field of view of the multispectral camera, and a light source is used to irradiate the agricultural product. The light source usually includes a full-spectrum light source to ensure that reflection or absorption data can be obtained at different wavelengths. The multispectral camera collects the reflected light in different bands according to the set band range (for example, multiple bands between 400nm - 1000nm), generates a series of band images (referred to as a multispectral image cube), records the images of each band, and forms multiple spectral images (each band corresponds to one image). These images are combined together to form the "spectral image data" of the agricultural product. The spectral image not only contains spatial information (such as pixel positions) but also contains the spectral information of each pixel at different bands.

[0095] Specifically, the spectral image data of agricultural products includes:

[0096] 1) Spatial information:

[0097] Each pixel represents a certain position on the agricultural product. Through these pixels, the spectral image can provide the spatial distribution information of the agricultural product, that is, the distribution of each component on or inside the agricultural product surface.

[0098] 2) Spectral information:

[0099] Each pixel not only contains position information but also contains the reflection or absorption spectral values (i.e., spectral curves) at different bands at this position. This can describe the optical properties of the agricultural product components at this position at each band.

[0100] Spectral curves are usually used to analyze the absorption or reflection characteristics of different components (such as sugars, moisture, pigments, etc.) in agricultural products at different bands, forming spectral feature data.

[0101] 3) Multiband image set:

[0102] Multispectral imaging generates images of multiple bands (one image for each band). Each image captures the reflection intensity of the agricultural product at that band. The images of all bands form a complete multispectral data set, which can be understood as a "spectral image cube".

[0103] 4) Spectral reflectance:

[0104] When processing spectral image data, spectral reflectance is usually corrected. Reflectance refers to the ability of agricultural products to reflect light of different wavelengths, which can be calibrated by comparing with known standard white or black boards to ensure the accuracy of the data.

[0105] S2. Based on the characteristic data of the component content of agricultural products, establish a content prediction model, and obtain the changing trend of the component content of agricultural products in the future time period based on the content prediction model;

[0106] Specifically, the changing trend of the component content of agricultural products refers to the dynamic changes of different components (such as moisture, sugar, protein, minerals, etc.) in agricultural products over time. These components will be affected by environmental conditions (such as temperature, humidity, light) and other factors during the growth, harvesting, storage, transportation and sales of agricultural products, resulting in gradual changes in content, including:

[0107] 1) Time series changes of each component:

[0108] Dynamic changes in the time dimension: The changes in the content of each component over a period of time in the future. The model can predict the upward or downward trend of the component content in the next few hours, days or even weeks.

[0109] Component decay or accumulation rate: The prediction model can quantify the decay rate of different components (such as moisture, sugar). For example, the moisture content of fruits will decrease during storage, while sugar may accumulate or decompose over time.

[0110] 2) Shelf life changes of components:

[0111] The pattern of change of the nutritional components of agricultural products over time, such as the loss rate of moisture or vitamins under different storage conditions. By analyzing these changes, the best consumption time and shelf life of agricultural products can be predicted, helping the supply chain to make reasonable transportation and sales decisions.

[0112] 3) Influence of the environment on component content:

[0113] The influence of environmental factors such as temperature and humidity on component changes. For example, at higher temperatures, the moisture loss of agricultural products accelerates, proteins may deteriorate or sugars may change. The model can consider these environmental factors and predict the differences in component content changes under different conditions.

[0114] 4) Pattern analysis of the changing trend:

[0115] Based on the changes of component content over time, specific trend patterns can be extracted. For example:

[0116] Linear change: The component content decreases or increases steadily.

[0117] Non-linear change: The component content changes drastically within a certain period of time and then tends to be stable.

[0118] Periodic change: Under certain environmental conditions, the component content may show periodic fluctuations.

[0119] 5) Change nodes of key components:

[0120] The model can identify key time nodes, that is, the moments when the component content changes significantly. For example, when stored for the 5th day, the water content of a certain fruit may suddenly drop significantly, indicating that this is the best time for special treatment or sales.

[0121] S3. Use the quality assessment algorithm to evaluate the change trend of the component content of agricultural products and judge whether the quality of agricultural products meets the requirements;

[0122] Specifically, the basis for judging whether the quality of agricultural products meets the requirements includes:

[0123] 1) Target component standards of agricultural products:

[0124] Each type of agricultural product usually has clear key component content standards, such as water, sugar, protein, vitamins, minerals, etc. The content of these components plays a decisive role in quality assessment. For example:

[0125] The sugar and acidity in fruits directly affect their taste and quality;

[0126] The protein content in grains is an important indicator to measure their nutritional value.

[0127] If the predicted future component content trend deviates from these standards, it may mean that the quality of agricultural products has declined or does not meet the requirements.

[0128] 2) Shelf life and freshness:

[0129] The shelf life of agricultural products usually depends on the trend of their component changes. If some key components (such as water, nutrients) are rapidly lost during the prediction period, it may mean that the product is approaching or has exceeded its best consumption period or sales period.

[0130] Freshness is also judged by analyzing spectral characteristics such as water content and color. The reduction of water will directly affect the freshness and market value of fruits and vegetables.

[0131] 3) Decay of nutrients:

[0132] The nutritional components of many agricultural products (such as vitamin C, antioxidants, etc.) will gradually decay during storage. If it is found through a prediction model that certain nutritional components drop below a specific threshold within a future time period, it may mean that the nutritional quality of the product no longer meets the requirements.

[0133] 4) Sensory quality indicators:

[0134] This refers to the subjective experience of consumers when eating or using, such as taste, smell, color, texture, etc. These sensory qualities are usually highly correlated with the component content. For example:

[0135] Changes in sugar content and acidity will affect the sweetness and acidity of fruits;

[0136] Changes in color (such as browning) may be related to changes in pigment components, affecting visual freshness.

[0137] Through multispectral imaging data and the trend of component changes, the changes in these sensory qualities can be predicted to determine whether they meet the expectations of consumers.

[0138] 5) Physical properties:

[0139] The physical properties of certain agricultural products, such as hardness, shape, size, are directly related to the component content. Through the trend of component changes, the quality assessment algorithm can predict whether these physical properties are still within the standard range. For example, the hardness of fruits may be closely related to the water content and fiber content.

[0140] 6) Industry and market standards:

[0141] The industry standards of different agricultural products are important references for quality assessment. For example, certain agricultural products have specific quality grade divisions in the food industry, such as Grade A and Grade B, which are directly linked to the component content. Changes in market quality requirements will also affect the judgment criteria.

[0142] 7) Adaptability to environmental factors and storage conditions:

[0143] During the assessment process, the impact of environmental factors (such as temperature, humidity) on component changes also needs to be considered. If the predicted trend of component content changes indicates that the quality deterioration rate accelerates under specific storage conditions within a future period of time, it may be necessary to adjust the storage method or sell in advance.

[0144] S4. Analyze the judgment results based on the feature analysis algorithm to identify the component content of agricultural products related to the target indicators;

[0145] Specifically, the relevant target indicators include:

[0146] Trend of sugar content: Whether the sugar content of apples, for example, remains stable, gradually increases, or reaches an ideal level during storage or production.

[0147] Overall quality assessment: Whether components such as the sweetness, acidity, and moisture content of fruits are within the specified range and meet the standards of consumers or the market.

[0148] Component stability: Evaluate the fluctuations of a certain component (such as protein, vitamin) in agricultural products to ensure that its content fluctuates minimally within the ideal value range.

[0149] Component correlation: The strength of the correlation between a certain component combination and quality characteristics (such as shelf life or taste). The goal is to find the most relevant component combination to optimize the product.

[0150] Specifically, the component content of agricultural products related to the target indicators includes nutritional components (such as protein, sugar, vitamins, etc.), sensory quality components (such as sugar-acid ratio, pigments, moisture, etc.), shelf-life related components (such as antioxidants, lipid oxidation degree, etc.), and market standard components (such as pesticide residues, heavy metals, etc.).

[0151] Based on the component content characteristic data of agricultural products, establish a content prediction model, and the steps for obtaining the trend of the component content change of agricultural products in the future time period based on the content prediction model are as follows:

[0152] S21. Divide the component content characteristic data set of agricultural products into a training set and a test set;

[0153] It should be explained that taking the change of the moisture content of rice during storage as an example, using multi-spectral imaging technology and experimental data, obtain the moisture content characteristic data of rice under different storage days, temperatures, and humidity conditions. Each sample includes storage conditions, spectral characteristics (such as reflectivity), and the moisture content of rice at the corresponding time point. Divide the data set into a training set (80%) and a test set (20%) to ensure the training and verification effects.

[0154] S22. Randomly initialize the population of the optimization algorithm (i.e., the improved locust optimization algorithm), set the maximum number of iterations and the population size, and preset the value range for the hyperparameters of the content prediction model;

[0155] It should be explained that use the improved locust optimization algorithm to initialize the population. Each individual in the population represents a different combination of hyperparameters of the long short-term memory neural network (LSTM). For example, the hyperparameters of LSTM may include:

[0156] Learning rate: Range 0.001 - 0.1.

[0157] Number of LSTM hidden layer units: Range 50 - 200.

[0158] Regularization coefficient: range 0 - 1.

[0159] Set the population size to 30 individuals and the maximum number of iterations to 100 times.

[0160] S23. Construct a content prediction model, map the positions of the population individuals of the optimization algorithm to the hyperparameter values of the content prediction model, and use the error after training through the content prediction model as the individual fitness value.

[0161] It should be noted that the long short - term memory neural network model is selected as the content prediction model. The long short - term memory neural network model has the advantage of processing time - series data and can capture the change of rice moisture content over time. In each iteration, the positions of the population individuals generated by the improved grasshopper optimization algorithm (corresponding to the hyperparameter values of the long short - term memory neural network model) are applied to the long short - term memory neural network model, and the content prediction model is trained. Calculate the model error (such as mean square error MSE) as the individual fitness value of the improved grasshopper optimization algorithm.

[0162] S24. Update the linear reduction factor of the optimization algorithm according to the iteration formula, update the hyperparameter values according to the optimization formula, and record the optimal hyperparameter values in the current iteration.

[0163] Specifically, the iteration formula is:

[0164] ;

[0165] In the formula, m (T) represents the value of the updated linear reduction factor at the T -th iteration;

[0166] M max represents the initial maximum value of the linear reduction factor;

[0167] M min represents the final minimum value of the linear reduction factor;

[0168] T max represents the maximum number of iterations.

[0169] S25. Determine whether the current optimization algorithm has reached the preset maximum number of iterations. If so, assign the optimal hyperparameter values to the content prediction model; otherwise, return to step S23 to continue the optimization.

[0170] It should be noted that if the maximum number of iterations (e.g., 100 times) is reached, the current optimal hyperparameter values are selected. If not, return to step S23 to continue the optimization until the global optimal hyperparameter combination is found.

[0171] S26. Construct the final content prediction model based on the optimal hyperparameters optimized by the optimization algorithm, and use the final content prediction model to obtain the changing trend of the agricultural product component content in the future time period.

[0172] It should be noted that the optimal hyperparameters optimized by using the improved locust optimization algorithm are used to construct the final content prediction model (i.e., the long short-term memory neural network model). The prediction ability of the content prediction model is verified by using the test set, and the changing trend of the moisture content of rice in the future for a period of time is predicted. For example, predict the changing curve of the moisture content of rice under certain storage conditions in the next 30 days.

[0173] For example, assume that under different storage temperatures and humidities of rice, the content prediction model predicts the changing trend of its moisture content as follows:

[0174] Storage temperature: 25°C, humidity: 50%: The moisture content of rice gradually decreases from 14% to 12% within the next 7 days.

[0175] Storage temperature: 5°C, humidity: 80%: The change in moisture content is small within the next 7 days and remains at about 14%.

[0176] Specifically, the optimization algorithm is the locust optimization algorithm. The locust optimization algorithm is a swarm intelligence optimization algorithm inspired by the swarm behavior of locusts. The swarm behavior of locusts in nature, especially its foraging, moving and aggregating patterns, demonstrates a high degree of coordination and intelligence.

[0177] Preferably, the spectral image data of agricultural products are obtained based on the multispectral imaging technology, and the spectral image data are processed to extract the component content feature data of agricultural products, including the following steps:

[0178] S11. Use a multispectral imaging device to obtain the spectral image data of agricultural products at different bands;

[0179] It should be noted that taking grapes as an example, the multispectral imaging device is used to capture the reflectance images of grapes at different bands (such as visible light band, near-infrared band, short-wave infrared band). Multispectral imaging can obtain the spectral characteristics of the grape skin and pulp, record the reflectance data, and reflect the content of its internal components such as sugar and moisture. The grape samples are imaged multiple times under different storage days and storage conditions to collect the spectral data at different time points. The spectral reflection characteristics of different components are different at different bands. For example, sugar has a specific absorption peak in the near-infrared band, and the change in reflectance can indicate its content.

[0180] S12. If there are dark pixels in the spectral image data, use the increase in the reflectance of the dark pixels as an indicator of atmospheric influence, and subtract the corresponding band values of other pixels to achieve atmospheric correction.

[0181] It should be noted that when checking for dark pixels in the spectral image data, they are usually pixel regions with reflectance close to 0. The increase in the reflectance of these regions is usually related to external interferences such as atmospheric scattering and optical instrument effects.

[0182] Atmospheric correction: Use the change in the reflectance of dark pixels as a reference for atmospheric influence, subtract the reflectance value of the dark pixels from the corresponding band reflectance of other pixels, thereby correcting the atmospheric influence.

[0183] S13. Set the size of the search block and the threshold of the highlighted region, find the regions where the average value of the pixels within the search block is greater than the threshold, perform normalization processing on each pixel within the regions where the average value is greater than the threshold, calculate the variance, and identify the continuous highlighted regions with gentle changes through the variance matrix.

[0184] It should be noted that setting the size of the search block and the threshold of the highlighted region: In the spectral image, select a search block of a certain size (such as 5×5 pixels), and calculate the average reflectance value of the pixels in each block. Set a threshold (such as 0.7), find the regions where the average reflectance within the search block is greater than the threshold, and mark them as highlighted regions.

[0185] Normalization processing: Perform normalization processing on each pixel within these highlighted regions to ensure that the reflectance is between 0 and 1.

[0186] Calculate the variance of the pixels within the highlighted region. The smaller the variance, the gentler the change. Identify the continuous highlighted regions with gentle changes. The highlighted regions usually correspond to specific reflection characteristics of the grape skin, which are related to the maturity of the grapes and internal components such as sugar and moisture content. Normalization can ensure the consistency of the data, and variance analysis can help identify the regions with stable reflection characteristics under specific bands.

[0187] S14. Based on the continuous highlighted regions, perform reflectance inversion operations and perform reflectance correction on the spectral image data.

[0188] It should be noted that for the identified continuous highlighted regions, perform reflectance inversion. Based on the spectral data of the highlighted regions, calculate the actual reflectance distribution. Perform reflectance correction to eliminate the influence of equipment and environmental factors, and ensure the consistency and accuracy of the reflectance values under different bands. Reflectance inversion is a technique that uses the observed spectral data to deduce the actual reflectance of an object, which can convert the surface reflection characteristics into real physical reflectance values.

[0189] S15. Extract features from the spectrally image data after reflectivity correction to obtain the characteristic data of the component content of the agricultural product.

[0190] It should be noted that for the spectrally image data after correction, key reflectivity values or spectral absorption characteristics in different bands are extracted, especially the bands related to sugar content (such as the near-infrared band). These spectral features are converted into quantitative features (such as reflectivity values, absorption peak intensities, etc.), and an association model between the features and the component content is established in combination with experimental data, and finally the sugar content characteristics of grapes at different storage days are obtained.

[0191] Preferably, the steps for extracting the characteristic data of the component content of the agricultural product from the spectrally image data after reflectivity correction include the following:

[0192] S151. Determine the spectral range to be analyzed according to the preset spectral absorption characteristic parameters of the agricultural product components.

[0193] S152. Perform an operation to remove the envelope line on the spectral curve of each pixel point after reflectivity correction to eliminate the baseline drift in the spectral curve and obtain the processed pixel spectral characteristic parameters.

[0194] It should be noted that for the spectral curve of each pixel point after correction, the envelope line is removed (continuum removal) to remove the spectral baseline drift. This operation helps to eliminate the errors caused by changes in lighting conditions or background effects, making the spectral curve smoother. After processing, the spectral characteristics of each pixel are more prominent, and it is easier to identify the absorption characteristics related to sugar content. The envelope line removal technique can more accurately highlight the absorption characteristics of interest in the spectrum, especially near the absorption peak of the band, making the characteristics more obvious and reducing the interference of environmental and equipment noise.

[0195] S153. Perform spectral feature matching analysis on the spectral characteristic parameters of each pixel point and the preset reference spectrum, and calculate the difference between the two.

[0196] It should be noted that spectral feature matching analysis is performed on the spectral characteristic parameters (such as reflectivity values, absorption peak intensities) of each pixel point and the preset reference spectrum.

[0197] The reference spectrum usually comes from the spectral analysis of apple samples with known sugar content in the laboratory and contains standard sugar absorption characteristics. The matching analysis calculates the difference between the two, and methods such as Euclidean distance or spectral angle matching (SAM) are used to quantify the matching degree.

[0198] S154. Calculate the goodness of fit for each pixel based on the results of spectral feature matching, evaluate the similarity between the spectral feature parameters of each pixel and the preset reference spectral parameters, calculate the spectral feature parameters corresponding to each pixel, and extract the spectral feature parameters related to the spectral absorption characteristics of the preset agricultural product components;

[0199] It should be noted that according to the results of spectral matching, the goodness of fit for each pixel is calculated. The goodness of fit can reflect the similarity between the spectral features and the reference spectrum. The higher the goodness of fit, the closer the pixel is to the preset sugar characteristics. Combining the goodness of fit with the spectral feature parameters, the spectral feature parameters related to the sugar absorption characteristics are extracted.

[0200] S155. Set a threshold. Based on the goodness of fit and the extracted spectral feature parameters related to the spectral absorption characteristics of the preset agricultural product components, determine whether the spectral features of the pixel meet the preset spectral absorption characteristic parameters of the agricultural product components. If the goodness of fit is higher than the set threshold, it is considered that the pixel contains the preset spectral absorption characteristic parameters of the agricultural product components, and record its component content characteristics;

[0201] It should be noted that a goodness of fit threshold is set. If the goodness of fit of a certain pixel is higher than this threshold, it is determined that the pixel contains spectral parameters that meet the sugar absorption characteristics, and record its corresponding component content. If the goodness of fit is lower than the threshold, it is considered that the spectral features of the pixel have no significant correlation with the sugar content, and this point is ignored.

[0202] S156. Repeat steps S152 to S155, and process the entire spectral image data pixel by pixel to extract the component content characteristics of all pixels;

[0203] It should be noted that for each pixel in the entire spectral image, repeat the operations of envelope removal, spectral matching, goodness of fit calculation, and threshold judgment, and extract the spectral feature parameters related to sugar pixel by pixel. After processing each pixel, record these data to obtain the sugar content characteristic data of each pixel.

[0204] S157. Integrate the extracted spectral feature parameters and the goodness of fit information to generate the component content characteristic data of the agricultural product containing all pixels.

[0205] It should be noted that integrate the extracted spectral feature parameters and the goodness of fit information to generate a complete spectral image of the apple, showing the sugar content characteristics of each pixel.

[0206] For example, finally, a sugar content distribution map can be generated to show the sugar concentration in different regions. Using different colors to represent different sugar contents, it can be clearly seen which regions have higher sugar contents and which regions have lower sugar contents.

[0207] Preferably, the optimization formula is:

[0208] ;

[0209] In the formula, K a_new ( T + 1) represents the value of the a th hyperparameter configuration at the T + 1-th iteration;

[0210] K a ( T ) represents the value of the a th hyperparameter configuration at the T th iteration;

[0211] K best ( T ) represents the optimal hyperparameter value among all hyperparameter configurations at the T th iteration;

[0212] Cauchy represents the Cauchy operator;

[0213] K f ( T ) represents the value of the hyperparameter configuration randomly selected at the T th iteration.

[0214] Preferably, a quality assessment algorithm is used to evaluate the change trend of the component content of agricultural products, and judging whether the quality of agricultural products meets the requirements includes the following steps:

[0215] S31. Set the parameters of the quality assessment algorithm and initialize the data of the component content of agricultural products;

[0216] It should be explained that taking the sugar content of apples as an example, setting the parameters of the improved dragonfly algorithm includes the number of dragonfly groups, the maximum number of iterations, the weight parameters of the fitness function, etc. The parameters of the quality assessment algorithm mainly determine the efficiency and accuracy of the optimization search. Initialize the component content data of apples, such as the sugar content under different storage conditions. Assume that the initial data is from the spectral feature parameters extracted by multi-spectral imaging technology.

[0217] S32. Calculate the initial fitness function value of each agricultural product based on the relevant indicators of the change trend of the component content of agricultural products;

[0218] It should be noted that the initial fitness function values of each agricultural product sample are calculated. The design of the fitness function is based on the evaluation criteria for the quality of agricultural products, such as the stability of sugar content, the deviation of the change rate from the standard value, etc. The fitness function value measures the gap between the change trend of the sugar content of each sample and the expected change trend (such as remaining stable or rising slowly). The least squares method or other error measurement methods can be used for calculation.

[0219] S33. Update the content of each agricultural product component using the behavioral rules.

[0220] It should be noted that the dragonfly algorithm is used to simulate the behavior of a dragonfly swarm, including rules such as attraction, dispersion, and alignment. Through such behavioral rules, the algorithm is guided to perform local and global searches. In each iteration process, the component content of each sample (such as the change trend of sugar) is updated to move it in the optimization direction.

[0221] S34. During the iterative optimization process of the quality evaluation algorithm, perform local search optimization on the currently found optimal change trend of the agricultural product component content through the local sequence floating backward selection mechanism.

[0222] It should be noted that the local sequence floating backward selection mechanism is used to perform local search on the currently found optimal sugar change trend. This mechanism further improves the accuracy of local search by making small parameter adjustments near the optimal solution. This mechanism can effectively avoid falling into local optima and find a more accurate optimization solution through fine-tuning of each search result.

[0223] S35. When the quality evaluation algorithm reaches the maximum number of iterations, output the final change trend of the agricultural product component content and its corresponding fitness function value.

[0224] It should be noted that the maximum number of iterations of the algorithm is set, for example, stop after 100 iterations or when the convergence condition is reached. At this time, output the change trend of the sugar content of each apple sample and the corresponding fitness function value.

[0225] S36. Based on the optimal fitness value, judge whether the quality of the agricultural product meets the requirements and output the final quality evaluation result.

[0226] It should be noted that according to the set fitness threshold, judge whether the sugar change of the apple meets the requirements. If it is higher than the set fitness threshold, it is considered of excellent quality; if it is lower than the set fitness threshold, it is considered of unqualified quality. Finally, output the quality evaluation result to judge which apples meet the sugar content requirements and which need further processing or rejection.

[0227] Specifically, the quality assessment algorithm is an improved dragonfly algorithm. The traditional dragonfly algorithm is a swarm intelligence optimization algorithm. The traditional dragonfly algorithm mainly learns two behavioral patterns of dragonfly swarms - static swarms and dynamic swarms, and approximately corresponds these two swarm behaviors to the global exploration and local development of swarm intelligence algorithms. The improved dragonfly algorithm of the present invention, while inheriting the good convergence of the traditional dragonfly algorithm, introduces a local sequence floating backward selection mechanism, which improves the solution accuracy of the algorithm while increasing the global search ability of the algorithm.

[0228] Preferably, during the iterative optimization of the quality assessment algorithm, local search optimization of the current found optimal change trend of agricultural product component content is performed through the local sequence floating backward selection mechanism, including the following steps:

[0229] S341. Preset a subset of agricultural product component content. In the current subset of agricultural product component content, perform a sequence floating backward selection operation to delete the component that has the greatest impact on the fitness value, update the subset of agricultural product component content, and obtain a new subset of agricultural product component content;

[0230] It should be explained that an initial subset of apple component content is set. Assume that the subset contains various components (such as sugar, acidity, moisture, etc.) or spectral characteristics under different bands of sugar.

[0231] S342. Use the sequence floating forward selection mechanism to select new agricultural product component content from the remaining agricultural product component content set and add it to the current subset of agricultural product component content, ensuring that the impact on the fitness value is minimized after addition, and update the subset of agricultural product component content;

[0232] It should be explained that the sequence floating backward selection operation is used to delete the component that has the greatest impact on the fitness value. After deletion, the subset of agricultural product component content is updated to generate a new subset. The sequence floating backward selection aims to find the combination of components with the least impact on the fitness by removing the components with greater impact on the result.

[0233] S343. If the added agricultural product component content is the same as the previously deleted agricultural product component content, continue to perform the sequence floating backward selection operation to further delete the component that has the greatest impact on the fitness value;

[0234] It should be explained that if, in step S342, the newly added component is the same as the previously deleted component, the backward selection operation is re - executed to continue deleting the components with greater impact on the fitness. This can ensure that in different component combinations, the optimization effect of the model will not be affected by repeated addition. Repeated deletion and addition can further optimize the component combination.

[0235] S344. Search for new components from the concentrated content of residual agricultural products, and use the sequential floating forward selection mechanism to find new components. If the fitness value increases after adding a new component, add this component to the subset and update it. If the fitness does not increase, terminate the local search and output the final change trend of the agricultural product component content.

[0236] It should be explained that continue to search for new components from the remaining agricultural product component content, and use the sequential floating forward selection mechanism to find the components that can optimize the fitness. If the found new component can improve the fitness, add it to the subset and update it; if the fitness does not increase significantly, terminate the local search. In the local search optimization, the combination of forward selection and backward selection helps to reduce component redundancy and find the optimal combination for the change trend of component content. Finally, output the optimal change trend of the agricultural product component content.

[0237] To facilitate the understanding of the above technical solution of the present invention, the following will detail how the present invention uses the quality evaluation algorithm to evaluate the change trend of the agricultural product component content in the actual process and determine whether the quality of the agricultural product meets the requirements.

[0238] Step 1: Set the maximum number of iterations to 100 times, and take the balance of each component content as the goal, and set the target value within the standard range. For example, the suitable content range of vitamin C is [70, 100] mg / 100g, the target value = 85 mg / 100g, the sugar content is [10, 20] g / 100g, the target value = 15 g / 100g, and the water content is [80, 90]%, the target value = 85%.

[0239] Initial agricultural product data samples:

[0240] Sample 1: Vitamin C content = 55 mg / 100g, sugar content = 15 g / 100g, water content = 83%;

[0241] Sample 2: Vitamin C content = 65 mg / 100g, sugar content = 13 g / 100g, water content = 84%;

[0242] Sample 3: Vitamin C content = 75 mg / 100g, sugar content = 16 g / 100g, water content = 86%.

[0243] Step 2: Preset the fitness function as:

[0244] ;

[0245] In the formula, F represents the fitness function value of the agricultural product; n represents the total number of components in the agricultural product; z dDenoted as the d actual value of the H d th component; d Denoted as the target value of the

[0246] th component.

[0247] Vitamin C: Target value = 85 mg / 100 g, actual value = 55 mg / 100 g, fitness score = 1 - |55 - 85| / 85 = 0.65;

[0248] Sugar: Target value = 15 g / 100 g, actual value = 15 g / 100 g, fitness score = 1 - |15 - 15| / 15 = 1;

[0249] Moisture: Target value = 85%, actual value = 83%, fitness score = 1 - |83 - 85| / 85 = 0.976;

[0250] Therefore, the total fitness score of Sample 1 is: F 1 = (0.65 + 1 + 0.976) / 3 = 0.875.

[0251] Based on the above calculation process of the fitness function value of Sample 1, similarly, the fitness values of Sample 2 and Sample 3 are calculated as follows: For Sample 2, F 2 = 0.873; for Sample 3, F 3 = 0.934.

[0252] Step 3. Update the content behavior rules of each agricultural product component using the behavior rules of the dragonfly algorithm:

[0253] 1) Attraction:

[0254] The sugar content of Sample 1 and Sample 2 is close to the target value, which has an attraction effect on other components, making the vitamin C and moisture tend to the optimization target.

[0255] Assume that the attraction increases the vitamin C content by 2% and the moisture content by 0.5%.

[0256] 2) Repulsion:

[0257] The repulsion rule acts on the sugar content of Sample 2 and Sample 3 to avoid the sugar content being too high or too low.

[0258] Assume that the sugar content of Sample 3 decreases by 1%.

[0259] 3) Alignment:

[0260] The alignment rule optimizes the components of Sample One, Sample Two, and Sample Three in a balanced manner, and the components gradually approach the target value.

[0261] 4) Updated component content:

[0262] Update of Sample One:

[0263] The vitamin C increases by 2%, updated to: 55 × 1.02 = 56.1 mg / 100g;

[0264] The moisture increases by 0.5%, updated to: 83 × 1.005 = 83.415%;

[0265] Update of Sample Two:

[0266] The vitamin C increases by 2%, updated to: 65 × 1.02 = 66.3 mg / 100g;

[0267] The sugar content increases by 1%, updated to: 13 × 1.01 = 13.13 g / 100g;

[0268] The moisture increases by 0.5%, updated to: 84 × 1.005 = 84.42%.

[0269] Update of Sample Three:

[0270] The vitamin C increases by 2%, updated to: 75 × 1.02 = 76.5 mg / 100g;

[0271] The sugar content decreases by 1%, updated to: 16 × 0.99 = 15.84 g / 100g;

[0272] The moisture increases by 0.5%, updated to: 86 × 1.005 = 86.43%.

[0273] Step Four: Local search optimization:

[0274] Delete the component that has the greatest impact on the fitness value: The vitamin C content in Sample One has a large gap from the target value, so vitamin C is selected for deletion, and the remaining sugar and moisture are optimized.

[0275] Select a new component for addition: In the remaining component set, reintroduce a new vitamin C content. Assume the selected new vitamin C content is: 56.1 + 2 = 58.1 56.1 + 2 = 58.1 mg / 100g.

[0276] Continue to delete the component with the greatest impact: Check the fitness values of sugar and moisture and find that the sugar is already optimal and no longer deleted.

[0277] Termination of optimization: After further optimization, after adding the new sugar content, the fitness value no longer increases, so the local search is terminated and the final change trend is output.

[0278] Step Five: After multiple iterations, the changing trends of the components of each optimized sample are as follows:

[0279] 1) Sample One:

[0280] The vitamin C is updated to 58.1 mg / 100 g.

[0281] The sugar content remains at 15 g / 100 g.

[0282] The moisture is updated to 83.415%.

[0283] 2) Sample Two:

[0284] The vitamin C is updated to 66.3 mg / 100 g.

[0285] The sugar content is updated to 13.13 g / 100 g.

[0286] The moisture is updated to 84.42%.

[0287] 3) Sample Three:

[0288] The vitamin C is updated to 76.5 mg / 100 g.

[0289] The sugar content is updated to 15.84 g / 100 g.

[0290] The moisture is updated to 86.43%.

[0291] Substitute the changing trend values of the components of each optimized sample above into the fitness function formula. The final fitness function values are: F 1 = (0.683 + 1 + 0.981) / 3 = 0.888; F 2 = (0.781 + 0.875 + 0.993) / 3 = 0.883; F 3 = (0.9 + 0.944 + 0.983) / 3 = 0.942.

[0292] Step Six: Judge whether the quality of the agricultural product meets the requirements based on the optimal fitness value and output the final evaluation result. For example, assume that the fitness value threshold for quality requirements is 0.90, that is, only agricultural products with fitness values greater than 0.90 are considered to meet the quality standards.

[0293] According to the final fitness values of each sample calculated:

[0294] Sample One: 0.888 (not reaching the threshold, unqualified).

[0295] Sample Two: 0.883 (not reaching the threshold, unqualified).

[0296] Sample three: 0.942 (reached the threshold, qualified).

[0297] Preferably, based on the feature analysis algorithm, the judgment result is analyzed, and the steps for identifying the content of agricultural product components related to the target index include the following:

[0298] S41. Obtain the initial subset of agricultural product component content, and optimize the initial subset of agricultural product component content through the component optimization algorithm to preliminarily screen out the potential agricultural product component content related to the target index;

[0299] It should be explained that taking the sugar content of apples as an example, obtain the initial component content subset of apples, which contains various components (such as sugar, moisture, acidity, etc.) and related spectral features. Optimize the initial subset through the component optimization algorithm (such as the Jaya algorithm) to preliminarily screen out the potential component content related to the target index (such as the stability or volatility of sugar).

[0300] S42. Select several optimal subsets related to the target index from the optimized subset of agricultural product component content to form a reference set;

[0301] It should be explained that from the optimized component subset, further select several components with the strongest correlation with the target index to form an optimal subset as the reference set. Step S42 depends on the analysis of the strong correlation between the components and the target quality index (such as the stability and upward trend of sugar), and selects the most representative components. Methods such as correlation coefficient analysis or regression analysis can be used to screen the components most relevant to the change trend of the target quality index.

[0302] S43. Generate several subsets in the reference set, and combine each subset to generate a new subset of agricultural product components;

[0303] It should be explained that in the reference set, multiple new subsets of agricultural product components are generated. These new subsets are generated by different component combinations, further enriching the potential association patterns of the components. Combine and evaluate each subset, and calculate its fitness value or correlation with the target index. The generation of new subsets is based on the characteristics of the scatter search algorithm, and new subsets are generated through random combination and mutation mechanisms while ensuring the diversity of combinations.

[0304] S44. Merge the current reference set with the newly generated subset of agricultural product component content, and select several optimized optimal subsets as the reference set for the next round of iteration;

[0305] It should be noted that the current reference set is merged with the newly generated subset, and the relevance or fitness value of each subset is calculated. Through the optimization mechanism of the scatter search algorithm, several optimized optimal subsets are selected as the reference set for the next round of iteration. The merging and optimization balance global and local searches to ensure that the optimal subset is selected in each iteration, gradually approaching the component combination most relevant to the target index.

[0306] S45. Determine whether the current subset of agricultural product component contents meets the termination condition. If not, return to step S43 for continued optimization. If so, output the agricultural product component contents related to the target index.

[0307] It should be noted that it is determined whether the current subset of agricultural product component contents meets the termination condition (such as reaching the number of iterations or convergence of relevance). If the termination condition is met, the agricultural product component contents related to the target index (such as the sugar change trend) are output; if not, return to step S43 for continued optimization. The termination condition can be based on the fact that the improvement of the fitness value is no longer significant or the number of iterations reaches a preset value. This termination condition ensures that the algorithm does not fall into ineffective long-term calculations.

[0308] Specifically, the feature analysis algorithm is the scatter search algorithm, which is a heuristic evolutionary algorithm. The basic idea is: construct a set of reference solutions according to the diversification principle, and then obtain a better new solution set through a series of selection, combination, and improvement operations. The most obvious difference between the scatter search algorithm and the genetic algorithm is that a series of its operation strategies are no longer based on the randomness principle, but use the intelligent iteration mechanism of dispersion-convergence-aggregation.

[0309] Preferably, to obtain the initial subset of agricultural product component contents and optimize the initial subset of agricultural product component contents through the component optimization algorithm, and preliminarily screen out the potential agricultural product component contents related to the target index, the following steps are included:

[0310] S411. Set the initial scale, number of variables of the subset of agricultural product component contents, and the termination condition of the optimization process;

[0311] S412. Conduct a fitness evaluation on the currently generated subset of agricultural product component contents, and identify the optimal component content combination and the worst component content combination;

[0312] S413. Based on the difference between the optimal component content combination and the worst component content combination, use the update formula to generate an updated agricultural product component content combination, making the new agricultural product component content combination closer to the target index;

[0313] S414. Compare the updated agricultural product ingredient content combination with the previous one. If the fitness value of the new agricultural product ingredient content combination is the best, replace the old agricultural product ingredient content combination with the new one; otherwise, retain the old agricultural product ingredient content combination.

[0314] S415. Determine whether the current optimization has reached the preset termination condition. If the termination condition is reached, output the optimal agricultural product ingredient content combination as the potentially relevant agricultural product ingredient content initially screened for the target index; otherwise, return to step S412 to continue the optimization.

[0315] Specifically, the ingredient optimization algorithm is the Jaya algorithm, which is a new type of meta - heuristic algorithm. The working principle of the Jaya algorithm is continuous improvement, that is, the solution tends to move towards the optimal solution and away from the worst solution. The Jaya algorithm is a single - stage algorithm, and only one equation needs to be evaluated in each iteration to obtain the value of the new solution. It also has an advantage that it is a parameter - free algorithm, only requiring two control parameters: the population size and the number of iterations. Therefore, the additional computational workload required to optimize the parameters to obtain the optimal solution is eliminated.

[0316] Preferably, the update formula is:

[0317] ;

[0318] In the formula, represents H i,j,c the value of the updated agricultural product ingredient content;

[0319] H i,j,c represents the value of the c th iteration, the j th agricultural product ingredient content in the i th population;

[0320] represents the value of the i th agricultural product ingredient content in the corresponding optimal ingredient content combination;

[0321] represents the value of the i th agricultural product ingredient content in the corresponding worst ingredient content combination;

[0322] s Both 1 and s 2 represent random numbers.

[0323] Specifically, s both 1 and s 2 are random numbers between (0, 1). It is to move the current solution towards the optimal solution (i.e., the value of the optimal combination of component contents), and to move the current solution away from the worst solution (i.e., the value of the worst combination of component contents).

[0324] According to another embodiment of the present invention, as Figure 2 shown, there is also provided an agricultural product component content analysis system based on multispectral imaging. The agricultural product component content analysis system based on multispectral imaging includes:

[0325] A data acquisition module 1, which is used to acquire spectral image data of agricultural products based on multispectral imaging technology, process the spectral image data, and extract the component content characteristic data of agricultural products;

[0326] A model establishment module 2, which is used to establish a content prediction model based on the component content characteristic data of agricultural products, and obtain the change trend of the component content of agricultural products in a future time period based on the content prediction model;

[0327] A quality evaluation module 3, which is used to evaluate the change trend of the component content of agricultural products by using a quality evaluation algorithm, and judge whether the quality of agricultural products meets the requirements;

[0328] A component analysis module 4, which is used to analyze the judgment result based on a feature analysis algorithm, and identify the component content of agricultural products related to the target index;

[0329] Among them, the data acquisition module 1 is connected through the model establishment module 2 and the quality evaluation module 3, and the quality evaluation module 3 is connected to the content analysis module 4.

[0330] The above are only the preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for analyzing the content of agricultural products based on multispectral imaging, characterized in that: The agricultural product component content analysis method based on multispectral imaging comprises the following steps: S1. Acquire spectral image data of agricultural products based on multispectral imaging technology, process the spectral image data, and extract component content characteristic data of agricultural products; S2. Based on the characteristic data of the content of agricultural products, a content prediction model is established, and the content change trend of agricultural products in the future time period is obtained based on the content prediction model; S3. Use the quality assessment algorithm to assess the changing trend of the content of agricultural products and determine whether the quality of agricultural products meets the requirements; S4. Analyze the judgment results based on the feature analysis algorithm to identify the content of agricultural product ingredients related to the target indicators; The method of using a quality assessment algorithm to assess the variation trend of the content of agricultural product ingredients and determining whether the quality of the agricultural product meets the requirements includes the following steps: S31, setting the parameters of the quality assessment algorithm and initializing the agricultural product ingredient content data; S32, calculating the initial fitness function value of each agricultural product based on the relevant indicators of the changing trend of the content of agricultural product ingredients; S33, using behavioral rules to update the content of each agricultural product ingredient; S34. During the iterative optimization process of the quality assessment algorithm, the local search optimization is performed on the current optimal agricultural product component content change trend through the local sequence floating backward selection mechanism; S35. When the quality assessment algorithm reaches the maximum number of iterations, the final trend of the change in the content of the agricultural product ingredients and its corresponding fitness function value are output; S36. Determine whether the quality of the agricultural products meets the requirements based on the optimal fitness value, and output the final quality evaluation result.

2. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 1, characterized in that: The method of obtaining spectral image data of agricultural products based on multispectral imaging technology, processing the spectral image data, and extracting component content characteristic data of agricultural products includes the following steps: S11. Use multispectral imaging equipment to obtain spectral image data of agricultural products in different bands; S12. If there are dark pixels in the spectral image data, the reflectivity increase of the dark pixels is used as an indicator of atmospheric influence, and the corresponding band values ​​of other pixels are subtracted to achieve atmospheric correction; S13, setting the size of the search block and the threshold of the highlight area, finding the area in the search block where the average value of the pixels is greater than the threshold, normalizing each pixel in the area where the average value is greater than the threshold, calculating the variance, and identifying the continuous highlight area with a smooth change through the variance matrix; S14, performing a reflectance inversion operation based on the continuous highlight area, and performing reflectance correction on the spectral image data; S15. Extract features from the spectral image data after reflectivity correction to obtain component content feature data of the agricultural product.

3. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 2, characterized in that: The feature extraction of the spectral image data after reflectivity correction to obtain the component content feature data of the agricultural product comprises the following steps: S151, determining the spectral range to be analyzed according to the preset spectral absorption characteristic parameters of the agricultural product components; S152, performing an envelope removal operation on the spectral curve of each pixel point after reflectivity correction to eliminate the baseline drift in the spectral curve, and obtaining the processed pixel spectral characteristic parameters; S153, performing spectral feature matching analysis on the spectral feature parameters of each pixel point and a preset reference spectrum, and calculating the difference between the two; S154, according to the result of spectral feature matching, the degree of fit is calculated pixel by pixel, the similarity between the spectral feature parameters of each pixel point and the preset reference spectral parameters is evaluated, and the spectral feature parameters corresponding to each pixel point are calculated, and the spectral feature parameters related to the preset spectral absorption characteristics of the agricultural product components are extracted; S155, setting a threshold, judging whether the spectral characteristics of the pixel point meet the preset agricultural product component spectral absorption characteristic parameters based on the fitting degree and the extracted spectral characteristic parameters related to the preset agricultural product component spectral absorption characteristic parameters, if the fitting degree is higher than the set threshold, it is considered that the pixel point contains the preset agricultural product component spectral absorption characteristic parameters, and recording its component content characteristics; S156, repeating steps S152 to S155, and processing the entire spectral image data pixel by pixel to extract component content characteristics of all pixels; S157, integrating the extracted spectral characteristic parameters with the fitting information to generate component content characteristic data of the agricultural products including all pixel points.

4. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 1, characterized in that: The method of establishing a content prediction model based on the characteristic data of the content of the agricultural products and obtaining the change trend of the content of the agricultural products in the future time period based on the content prediction model includes the following steps: S21, dividing the ingredient content feature data set of agricultural products into a training set and a test set; S22, randomly initialize the population of the optimization algorithm, set the maximum number of iterations and the population size, and preset the value range for the hyperparameters of the content prediction model; S23, constructing a content prediction model, mapping the population individual positions of the optimization algorithm to the hyperparameter values ​​of the content prediction model, and using the error after training the content prediction model as the individual fitness value; S24, updating the linear reduction factor of the optimization algorithm according to the iterative formula, updating the hyperparameter value according to the optimization formula, and recording the optimal hyperparameter value in the current iteration; S25, determining whether the current optimization algorithm has reached a preset maximum number of iterations, if so, assigning the optimal hyperparameter value to the content prediction model, otherwise returning to step S23 to continue optimization; S26. Construct a final content prediction model based on the optimal hyperparameters after optimization by the optimization algorithm, and use the final content prediction model to obtain the changing trend of the content of agricultural product ingredients in the future time period.

5. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 4, characterized in that: The optimization formula is: In the formula, K a_new (T+1) represents the value of the ath hyperparameter configuration at the T+1th iteration; K a (T) represents the value of the ath hyperparameter configuration at the Tth iteration; K best (T) represents the best hyperparameter value among all hyperparameter configurations at the Tth iteration; Cauchy is represented by the Cauchy operator; K f (T) represents the value of the randomly selected hyperparameter configuration at the Tth iteration.

6. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 1, characterized in that: In the iterative optimization process of the quality assessment algorithm, the local search optimization of the current optimal agricultural product component content change trend through the local sequence floating backward selection mechanism includes the following steps: S341, preset a subset of agricultural product component content, and in the current subset of agricultural product component content, use a sequence floating backward selection operation to delete the component with the greatest impact on the fitness value, update the subset of agricultural product component content, and obtain a new subset of agricultural product component content; S342, using a sequence floating forward selection mechanism to select new agricultural product component contents from the remaining agricultural product component content set, adding them to the current agricultural product component content subset, ensuring that the fitness value is minimally affected after the addition, and updating them to the agricultural product component content subset; S343, if the content of the added agricultural product component is the same as the content of the previously deleted agricultural product component, continue to perform the sequence floating backward selection operation to further delete the component that has the greatest impact on the fitness value; S344. Find new components from the remaining agricultural product component content set, and use the sequence floating forward selection mechanism to find new components. If the fitness value increases after adding the new component, add the component to the subset and update it. If the fitness value does not increase, terminate the local search and output the final trend of agricultural product component content changes.

7. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 1, characterized in that: The analysis of the judgment results based on the feature analysis algorithm to identify the content of agricultural product components related to the target indicator includes the following steps: S41, obtaining an initial agricultural product component content subset, and optimizing the initial agricultural product component content subset through a component optimization algorithm, and preliminarily screening out potential agricultural product component contents related to the target indicator; S42, from the optimized agricultural product component content subsets, select several optimal subsets related to the target indicators to form a reference set; S43, generating a plurality of subsets in the reference set, and combining each subset to generate a new subset of agricultural product components; S44, merging the current reference set with the newly generated agricultural product component content subset, and selecting several optimized optimal subsets as reference sets for the next round of iteration; S45. Determine whether the current agricultural product component content subset meets the termination condition. If not, return to step S43 to continue optimization. If so, output the agricultural product component content related to the target indicator.

8. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 7, characterized in that: The steps of obtaining an initial agricultural product component content subset, optimizing the initial agricultural product component content subset by a component optimization algorithm, and preliminarily screening out potential agricultural product component contents related to the target indicator include the following steps: S411. Set the initial scale of the agricultural product ingredient content subset, the number of variables, and the termination conditions of the optimization process; S412, performing fitness evaluation on the currently generated agricultural product component content subset, and identifying the optimal component content combination and the worst component content combination; S413, based on the difference between the optimal component content combination and the worst component content combination, using an update formula to generate an updated agricultural product component content combination, and the new agricultural product component content combination is closer to the target indicator; S414, comparing the updated agricultural product component content combination with the previous agricultural product component content combination, if the new agricultural product component content combination has the best fitness value, replacing the old agricultural product component content combination with the new agricultural product component content combination; otherwise, retaining the old agricultural product component content combination; S415. Determine whether the current optimization has reached the preset termination condition. If so, output the optimal agricultural product component content combination as a preliminary screening of potential agricultural product component contents related to the target indicator. Otherwise, return to step S412 to continue optimization.

9. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 8, characterized in that: The update formula is: In the formula, H′ i,j,c Indicated as H i,j,c Updated values ​​of agricultural product ingredient content; H i,j,c It is expressed as the value of the content of the i-th agricultural product component in the j-th population in the c-th iteration; It is expressed as the value of the i-th agricultural product ingredient content in the corresponding optimal ingredient content combination; It is expressed as the value of the i-th agricultural product ingredient content in the corresponding worst ingredient content combination; Both s1 and s2 are expressed as random numbers.

10. A system for analyzing the content of agricultural product components based on multispectral imaging, used to implement the method for analyzing the content of agricultural product components based on multispectral imaging according to any one of claims 1 to 9, characterized in that: The agricultural product component content analysis system based on multispectral imaging includes: A data acquisition module is used to acquire spectral image data of agricultural products based on multispectral imaging technology, and process the spectral image data to extract component content characteristic data of agricultural products; A model building module is used to build a content prediction model based on the characteristic data of the component content of agricultural products, and obtain the change trend of the component content of agricultural products in the future time period based on the content prediction model; The quality assessment module is used to evaluate the changing trend of the content of agricultural products using the quality assessment algorithm to determine whether the quality of agricultural products meets the requirements; The component analysis module is used to analyze the judgment results based on the feature analysis algorithm and identify the content of agricultural product components related to the target indicators; The data acquisition module is connected with the quality evaluation module through the model building module, and the quality evaluation module is connected with the content analysis module.