Agricultural product component content analysis method and system based on multispectral imaging

Extract the content of the content of agricultural products through multi -spectrometry imaging technology and establish a prediction model, solve the problem of difficulty predicting agricultural product composition in existing technology, realize fast and accurate composition analysis and quality assessment, improve the quality control and improvement science of agricultural products sex.

CN119339826AActive Publication Date: 2025-01-21JIANGSU GUANGHAI INSPECTION & TESTING CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

The prior art is difficult 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 used to obtain the spectral image data of agricultural products, process and extract the component content feature data, establish a content prediction model, predict the component content change trend in the future time period, and use quality assessment algorithms to evaluate agricultural products. quality.

Benefits of technology

It can quickly and accurately extract the ingredient content characteristics of agricultural products, predict future ingredient content change trends, help predict nutrient loss or quality changes of agricultural products, ensure that agricultural products are sold and eaten in the best condition, and improve the scientific quality control and improvement of agricultural products. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119339826A_ABST
    Figure CN119339826A_ABST
Patent Text Reader

Abstract

The invention discloses an agricultural product component content analysis method and system based on multispectral imaging, and relates to the technical field of agricultural product component content detection.The agricultural product component content analysis method comprises the following steps that component content characteristic data of an agricultural product is extracted; obtaining an agricultural product component content change trend in a future time period based on the content prediction model; judging whether the quality of the agricultural product meets requirements; and identifying the agricultural product component content related to the target index. Through the established component content prediction model, the component content change trend of the agricultural product in a period of time in the future can be predicted, so that prediction of nutrition loss or quality change of the agricultural product can be facilitated, and whether the quality of the agricultural product meets requirements can be accurately evaluated based on the component content change trend; the agricultural products can be sold and eaten in an optimal state, so that the quality standard of the whole agricultural products can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of agricultural product component content detection, and in particular to an agricultural product component content analysis method and system based on multispectral imaging. Background Art

[0002] Various ingredients in agricultural products, such as protein, sugar, vitamins, minerals, etc., play a vital role in human growth and development, immune system maintenance, and the normal operation of various biochemical processes. Therefore, accurate detection of the content of agricultural product ingredients 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 ingredient detection. Multispectral imaging not only combines the high precision of spectral analysis, but also provides rich spatial information. By capturing spectral data in different bands, different ingredients in agricultural products will show unique optical characteristics in different bands.

[0003] In the existing technology, it is not easy to quickly and accurately extract the characteristics of ingredient content, and it is not easy to predict the changing trend of the ingredient content of agricultural products in the future, so it cannot help predict the nutrient loss or quality change of agricultural products. At the same time, it is not easy to accurately evaluate whether the quality of agricultural products meets the requirements based on the changing trend of ingredient content, and it cannot ensure that agricultural products are sold and eaten in the best condition. In turn, it is not easy 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, thereby lowering the overall quality standards of agricultural products.

[0004] Currently, no effective solution has been proposed for the problems in the related technologies. Summary of the invention

[0005] In view of the deficiencies in the prior art, the present invention proposes a method and system for analyzing the ingredient content of agricultural products based on multispectral imaging, which solves the problems mentioned in the above background technology, such as it is not convenient to quickly and accurately extract the ingredient content characteristics, and it is not convenient to predict the changing trend of the ingredient content of agricultural products in the future, thereby failing to help predict the nutrient 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 based on the changing trend of the ingredient content, and it cannot ensure that the agricultural products are sold and eaten in the best condition, and thus it is not convenient to help optimize the quality control of agricultural products. It also cannot provide a scientific basis for the improvement, cultivation and production of agricultural products, thereby lowering the overall quality standards of agricultural products.

[0006] To achieve the above objectives, the present invention is implemented through the following technical solutions: According to one aspect of the present invention, a method for analyzing the content of agricultural product components based on multispectral imaging is provided. The method for analyzing the content of agricultural product components 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; Based on the characteristic data of the content of agricultural products, a content prediction model is established, and the change trend of the content of agricultural products in the future time period is obtained based on the content prediction model, which 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.

[0007] Furthermore, obtaining spectral image data of agricultural products based on multispectral imaging technology, and processing the spectral image data to extract 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.

[0008] Furthermore, extracting features from the spectral image data after reflectivity correction to obtain the characteristic data of the component content of the agricultural product includes 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.

[0009] Furthermore, the optimization formula is: ; In the formula, K a_new ( T +1) indicates the a The hyperparameters are configured in T +1 value at iteration; K a ( T ) is expressed as a The hyperparameters are configured in T The value at the iteration; K best ( T ) is expressed as T The best hyperparameter value among all hyperparameter configurations at iteration 1; Cauchy is represented as the Cauchy operator; K f ( T ) is expressed as T The values ​​of the randomly selected hyperparameter configurations at iteration .

[0010] Furthermore, the quality assessment algorithm is used to assess the changing trend of the content of agricultural products and determine whether the quality of agricultural products meets the requirements, including 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 the 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.

[0011] Furthermore, in the iterative optimization process of the quality assessment algorithm, the local search optimization of the current optimal agricultural product component content change trend is performed through the local sequence floating backward selection mechanism, including 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.

[0012] Further, analyzing 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.

[0013] Further, obtaining an initial agricultural product component content subset, 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 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.

[0014] Furthermore, the update formula is: ; In the formula, Expressed as H i,j,c Updated values ​​of agricultural product ingredient content; H i,j,c Expressed as c In the iteration j The first i The value of the content of agricultural product ingredients; Expressed as i The content of each agricultural product ingredient corresponds to the value of the optimal ingredient content combination; Expressed as i The content of each agricultural product ingredient is at the value corresponding to the worst ingredient content combination; s 1 and s 2 are all random numbers.

[0015] According to another aspect of the present invention, 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 comprising: 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.

[0016] The beneficial effects of the present invention are: 1. The present invention obtains spectral data of agricultural products through multi-spectral imaging technology, can quickly and accurately extract component content characteristics, can greatly reduce the complex sample preparation and detection process in traditional methods, improve efficiency, and through the established component content prediction model, can predict the component content change trend of agricultural products in the future, so as to help predict the nutrient loss or quality change of agricultural products. Based on the changing trend of component content, it can accurately evaluate whether the quality of agricultural products meets the requirements, ensure that agricultural products are sold and eaten in the best state, and further analyze the evaluation results using feature analysis algorithms, so as to identify the key component contents related to the target indicators, which 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, thereby helping to improve the overall quality standards of agricultural products.

[0017] 2. The present invention uses multi-spectral imaging equipment to obtain spectral data of agricultural products in different bands, and after atmospheric correction and reflectance correction, the accuracy and consistency of the data are ensured. The reflectance of dark pixels is adjusted to eliminate the interference of atmospheric conditions on the detection of component content. Based on the spectral absorption characteristics of agricultural products, envelope removal, spectral matching and fitting analysis are used to effectively eliminate the error 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 are extracted and the component content is calculated. This full-pixel analysis method greatly improves the coverage of the detection, thereby ensuring that every part of the entire agricultural product sample is effectively detected and analyzed, thereby improving the accuracy, speed and non-destructiveness of the detection of agricultural product component content.

[0018] 3. The present invention constructs a content prediction model so as to more accurately reflect the future trend of ingredient content changes. It uses 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 ingredient prediction scenarios, the content prediction model can quickly converge to the optimal solution, effectively reducing the calculation time and improving the stability and robustness of the content prediction model. Moreover, based on the optimized content prediction model, the trend of ingredient content changes in agricultural products in future time periods can be predicted. By predicting ingredient changes, the storage time and transportation conditions of agricultural products can be planned in advance to maximize their nutritional value and market competitiveness. Then, according to the prediction results, preservation measures can be taken in advance or market decisions can be made to ensure that the quality of the product remains stable during the optimal period, reduce losses and increase profits.

[0019] 4. The present invention ensures that the quality judgment of agricultural products is more accurate by combining the quality assessment algorithm with the indicator of the trend of ingredient content changes, so as to capture the trend of ingredient content changes over time. It is not only used for current quality analysis, but also supports the prediction of future quality changes, helping agricultural product managers to make decisions in advance. By combining local sequence floating backward and forward selection, the components with the greatest impact on fitness are continuously screened out, and the ingredient content subset is dynamically adjusted, so that the quality assessment algorithm can find the optimal ingredient content change trend and output more reliable quality assessment results. In the local sequence floating selection mechanism, by deleting unimportant components and optimizing key components, the influence of irrelevant components is greatly reduced. Through the accurate prediction and analysis of the trend of ingredient content changes, 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.

[0020] 5. The present invention uses a feature analysis algorithm to perform multiple screening and combinations using optimized component subsets, and finally extracts the agricultural product components most relevant to the target indicators, which can effectively reduce data redundancy, highlight components related to key quality standards, and improve the accuracy of detection and evaluation. In addition, by adopting a component optimization algorithm, the update formula uses the difference between the optimal and worst component content combinations to generate updated combinations, so that the component combination after each iteration is closer to the target indicator. The optimization efficiency is improved, and the situation of falling into the local optimum is avoided. At the same time, by screening and combining components in multiple subsets, comprehensive coverage of agricultural product components is ensured, avoiding the deviation problem that may be caused by single feature analysis. The component content combination finally outputted can more comprehensively reflect the component characteristics of agricultural products after multiple rounds of optimization, thereby improving the analysis and detection efficiency of the component content of agricultural products. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0022] Figure 1 is a flow chart of a method for analyzing the content of agricultural products based on multispectral imaging according to an embodiment of the present invention; Figure 2 The present invention is a block diagram of a system for analyzing the content of agricultural products based on multispectral imaging.

[0023] In the figure: 1. Data acquisition module; 2. Model building module; 3. Quality assessment module; 4. Component analysis module. DETAILED DESCRIPTION

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

[0025] In the description of the present invention, unless otherwise specified, the meaning of "plurality" 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.

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

[0027] The present invention is further described with reference to the accompanying drawings and specific embodiments. Figure 1 As shown, according to the method for analyzing the content of agricultural product components based on multispectral imaging according to an embodiment of the present invention, the method for analyzing the content of agricultural product components based on multispectral imaging includes 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; Specifically, multispectral imaging technology refers to the technology of generating 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 (containing only 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.

[0028] It should be explained that a special multispectral camera is used, which can capture light signals in different bands. These bands can span the range of visible light and invisible light (such as infrared light and ultraviolet light). Each band reflects the optical properties of different components on the surface and inside of agricultural products. The camera is usually equipped with filters or uses a spectroscopic device to decompose the spectral information into different bands. The agricultural products are then placed in the field of view of the multispectral camera and illuminated with a light source. 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 reflected light in different bands according to the set band range (for example, multiple bands between 400nm-1000nm), generates a series of band images (called multispectral image cubes), and records the images of each band to form multiple spectral images (one image for each band). These images are combined to form the "spectral image data" of agricultural products. The spectral image contains not only spatial information (such as pixel position), but also spectral information of each pixel in different bands.

[0029] Specifically, the spectral image data of agricultural products include: 1) Spatial information: Each pixel represents a certain location of the agricultural product. Through these pixels, the spectral image can provide spatial distribution information of the agricultural product, that is, the distribution of each component on the surface or inside the agricultural product.

[0030] 2) Spectral information: Each pixel contains not only the location information, but also the reflection or absorption spectrum value (i.e., spectral curve) of that location in different bands. This can describe the optical properties of the agricultural product components at that location in each band.

[0031] Spectral curves are usually used to analyze the absorption or reflection characteristics of different components in agricultural products (such as sugar, water, pigment, etc.) in different bands to form spectral characteristic data.

[0032] 3) Multi-band image set: Multispectral imaging generates images in multiple bands (one image per band), each of which captures the reflectance intensity of agricultural products in that band. Images in all bands form a complete multispectral dataset, which can be understood as a "spectral image cube".

[0033] 4) Spectral reflectance: When processing spectral image data, spectral reflectance correction is usually performed. Reflectance refers to the ability of agricultural products to reflect light of different wavelengths. This can be calibrated by comparing it with a known standard white or black board to ensure the accuracy of the data.

[0034] 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; Specifically, the trend of agricultural product content refers to the dynamic changes of different components (such as water, 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, picking, storage, transportation and sales of agricultural products, resulting in gradual changes in content, including: 1) Time series changes of each component: Dynamic changes in the time dimension: changes in the content of each component over a period of time in the future. The model can predict the rising or falling trend of the component content in the next few hours, days or even weeks.

[0035] Rate of component decay or accumulation: Predictive models can quantify the rate at which different components (e.g., water content, sugars) decay. For example, the water content of fruit decreases during storage, while sugars may accumulate or decompose over time.

[0036] 2) Changes in shelf life of ingredients: The pattern of changes in the nutritional content of agricultural products over time, such as the loss rate of water or vitamins under different storage conditions. By analyzing these changes, the best time to eat agricultural products and their shelf life can be predicted, helping the supply chain make reasonable transportation and sales decisions.

[0037] 3) Impact of environment on ingredient content: The impact of environmental factors such as temperature and humidity on composition changes. For example, at higher temperatures, agricultural products lose water faster, proteins may deteriorate, or sugars may change. Models can take these environmental factors into account and predict differences in composition changes under different conditions.

[0038] 4) Pattern analysis of changing trends: Based on the changes in component content over time, specific trend patterns can be extracted. For example: Linear change: The content of an ingredient decreases or increases steadily.

[0039] Non-linear change: The content of a component changes dramatically over a period of time and then tends to be stable.

[0040] Cyclic Variation: Under certain environmental conditions, the content of an ingredient may show cyclical fluctuations.

[0041] 5) Change nodes of key components: The model can identify critical time points, that is, the moment when the content of ingredients changes significantly. For example, on the fifth day of storage, the moisture content of a certain fruit may suddenly drop sharply, indicating that this is the best time to specially handle or sell it.

[0042] 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; Specifically, the basis for judging whether the quality of agricultural products meets the requirements includes: 1) Target ingredient standards for agricultural products: Each agricultural product usually has clear standards for the content of key ingredients, such as water, sugar, protein, vitamins, minerals, etc. The content of these ingredients plays a decisive role in quality assessment. For example: The sugar and acidity in fruit directly affect its taste and quality; The protein content in grains is an important indicator to measure their nutritional value.

[0043] If the predicted future trends in ingredient content deviate from these standards, it could mean that the agricultural product is of reduced quality or does not meet the requirements.

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

[0045] Freshness is also determined by analyzing spectral characteristics such as moisture content and color. A reduction in moisture will directly affect the freshness and market value of fruits and vegetables.

[0046] 3) Decay of nutrients: The nutritional content of many agricultural products (such as vitamin C, antioxidants, etc.) will gradually decay during storage. If the prediction model finds that certain nutrients drop below a certain threshold in the future time period, it may mean that the nutritional quality of the product no longer meets the requirements.

[0047] 4) Sensory quality indicators: 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 ingredient content. For example: Changes in sugar and acid levels can affect the sweetness and acidity of the fruit; Color changes (such as browning) may be related to changes in pigment composition, affecting visual freshness.

[0048] Through multispectral imaging data and ingredient change trends, changes in these sensory qualities can be predicted to determine whether they meet consumer expectations.

[0049] 5) Physical properties: The physical properties of some agricultural products, such as firmness, shape, and size, are directly related to the content of ingredients. By looking at the trend of ingredient changes, the quality assessment algorithm can predict whether these physical properties are still within the standard range. For example, the firmness of fruit may be closely related to the moisture and fiber content.

[0050] 6) Industry and market standards: The industry standards of different agricultural products are an important reference for quality assessment. For example, some agricultural products have specific quality grades in the food industry, such as Grade A and Grade B, which are directly linked to the content of ingredients. Changes in market quality requirements will also affect the judgment standards.

[0051] 7) Adaptability to environmental factors and storage conditions: The impact of environmental factors (such as temperature and humidity) on ingredient changes also needs to be considered during the evaluation process. If the predicted trend of ingredient content changes indicates that the quality deteriorates faster under specific storage conditions over a certain period of time in the future, it may be necessary to adjust the storage method or sell in advance.

[0052] S4. Analyze the judgment results based on the feature analysis algorithm to identify the content of agricultural product ingredients related to the target indicators; Specifically, the target indicators include: Sugar content change trend: For example, whether the sugar content of apples remains stable, gradually increases, or reaches a certain ideal level during storage or production.

[0053] Overall quality assessment: whether the fruit's sweetness, acidity, moisture content and other components are within the specified range and meet consumer or market standards.

[0054] Ingredient stability: Evaluate the fluctuation of a certain ingredient (such as protein, vitamin) in agricultural products to ensure that its content fluctuates minimally within the ideal value range.

[0055] Ingredient relevance: The strength of the correlation between a certain ingredient combination and a quality characteristic (such as shelf life or taste). The goal is to find the most relevant ingredient combination to optimize the product.

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

[0057] Based on the characteristic data of the content of agricultural products, a content prediction model is established, and the change trend of the content of agricultural products in the future time period is obtained based on the content prediction model, which includes the following steps: S21, dividing the ingredient content feature data set of agricultural products into a training set and a test set; It should be explained that, taking the change in moisture content of rice during storage as an example, multispectral imaging technology and experimental data were used to obtain the moisture content characteristic data of rice under different storage days, temperature and humidity conditions. Each sample includes storage conditions, spectral characteristics (reflectivity, etc.) and the moisture content of rice at the corresponding time point. The data set is divided into a training set (80%) and a test set (20%) to ensure the effect of training and verification.

[0058] S22, randomly initializing the population of the optimization algorithm (i.e., the improved locust optimization algorithm), setting the maximum number of iterations and the population size, and presetting the value range for the hyperparameters of the content prediction model; It should be explained that the population is initialized using the improved locust optimization algorithm, and each individual in the population represents a different combination of long short-term memory neural network (LSTM) hyperparameters. For example, the hyperparameters of LSTM may include: Learning rate: range 0.001-0.1.

[0059] Number of LSTM hidden layer units: range 50-200.

[0060] Regularization coefficient: range 0-1.

[0061] The population size is set to 30 individuals and the maximum number of iterations is set to 100.

[0062] 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; It should be explained 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 changes in rice moisture content over time. In each iteration, the positions of the population individuals generated by the improved locust 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. The model error (such as the mean square error MSE) is calculated as the individual fitness value of the improved locust optimization algorithm.

[0063] 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; Specifically, the iteration formula is: ; In the formula, m (T) Expressed as T The updated value of the linear reduction factor at the iteration; M max Expressed as the initial maximum value of the linear reduction factor; M min Expressed as the final minimum value of the linear reduction factor; T max Expressed as the maximum number of iterations.

[0064] 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; It should be explained that if the maximum number of iterations (e.g., 100) is reached, the currently optimal hyperparameter value is selected. If not, the process returns to step S23 to continue optimization until the globally optimal hyperparameter combination is found.

[0065] 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.

[0066] It should be explained that the optimal hyperparameters obtained by optimizing 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 test set is used to verify the prediction ability of the content prediction model and predict the moisture content change trend of rice in the future. For example, the moisture content change curve of rice under certain storage conditions in the next 30 days is predicted.

[0067] For example, assuming that rice is stored at different temperatures and humidities, the content prediction model predicts the change trend of its moisture content as follows: Storage temperature: 25°C, humidity: 50%: The moisture content of rice will gradually decrease from 14% to 12% over the next 7 days.

[0068] Storage temperature: 5°C, humidity: 80%: The moisture content will change little in the next 7 days and remain at around 14%.

[0069] Specifically, the optimization algorithm is the locust optimization algorithm, which is a swarm intelligence optimization algorithm inspired by the group behavior of locusts. The group behavior of locusts in nature, especially their foraging, movement and aggregation patterns, shows a high degree of coordination and intelligence.

[0070] Preferably, obtaining spectral image data of agricultural products based on multispectral imaging technology, and processing the spectral image data to extract 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; It should be explained that, taking grapes as an example, multispectral imaging equipment is used to capture the reflectance images of grapes in different bands (such as visible light band, near infrared band, and short-wave infrared band). Multispectral imaging can obtain the spectral characteristics of the grape skin and pulp, record reflectance data, and reflect the content of its internal components such as sugar and water. Grape samples are imaged multiple times under different storage days and storage conditions to collect spectral data at different time points. Different components have different spectral reflectance characteristics in different bands. For example, sugar has a specific absorption peak in the near-infrared band, and changes in reflectance can indicate its content.

[0071] 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; It should be explained that the dark pixels in the spectral image data are usually some pixel areas with reflectivity close to 0. The increased reflectivity in these areas is usually related to external interference such as atmospheric scattering and optical instrument effects.

[0072] Atmospheric correction: Use the reflectance change of dark pixels as a reference for atmospheric influence, and subtract the reflectance value of dark pixels from the corresponding band reflectance of other pixels to correct for atmospheric influence.

[0073] 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; It is necessary to explain that the search block size and highlight area threshold are set: in the spectral image, select a search block of a certain size (such as 5×5 pixels), calculate the average reflectance value of the pixels in each block, set a threshold (such as 0.7), find the area in the search block where the average reflectance is greater than the threshold, and mark it as a highlight area.

[0074] Normalization: Each pixel in these highlight areas is normalized to ensure that the reflectivity is between 0 and 1.

[0075] Calculate the variance of pixels in the highlight area. The smaller the variance, the more gradual the change. Identify the continuous highlight area with gentle changes. The highlight area usually corresponds to the specific reflectance characteristics of the grape skin, which is related to the maturity of the grape and the internal components such as sugar and water content. Normalization can ensure the consistency of the data, and variance analysis can help identify areas with stable reflectance characteristics in specific bands.

[0076] S14, performing a reflectance inversion operation based on the continuous highlight area, and performing reflectance correction on the spectral image data; It should be explained that the reflectivity inversion is performed on the identified continuous highlight areas, and the actual reflectivity distribution is calculated based on the spectral data of the highlight areas. Reflectivity correction is performed to eliminate the influence of equipment and environmental factors to ensure the consistency and accuracy of reflectivity values ​​in different bands. Reflectivity inversion is a technology that uses observed spectral data to derive the actual reflectivity of an object, which can convert surface reflectivity characteristics into real physical reflectivity values.

[0077] S15. Extract features from the spectral image data after reflectivity correction to obtain component content feature data of the agricultural product.

[0078] It should be explained that the corrected spectral image data is subjected to feature extraction to extract key reflectance values ​​or spectral absorption features in different bands, especially bands related to sugar content (such as near-infrared bands). These spectral features are converted into quantitative features (such as reflectance value, absorption peak intensity, etc.), and a correlation model between features and component content is established in combination with experimental data, and finally the sugar content characteristics of grapes at different storage days are obtained.

[0079] Preferably, extracting features from the spectral image data after reflectance 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; It should be explained that the spectral curve of each pixel after correction is subjected to continuum removal to remove the spectral baseline drift. This operation helps to eliminate errors caused by changes in lighting conditions or background effects, making the spectral curve smoother. After processing, the spectral features of each pixel are more prominent, making it easier to identify absorption features related to sugar content. Envelope removal technology can more accurately highlight the absorption features of interest in the spectrum, especially near the absorption peak of the band, making the features more obvious and reducing interference from environmental and equipment noise.

[0080] 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; It should be explained that the spectral characteristic parameters (such as reflectance value, absorption peak intensity) of each pixel point are matched with the preset reference spectrum.

[0081] The reference spectrum is usually obtained from laboratory spectral analysis of apple samples with known sugar content, which contains standard sugar absorption features. Matching analysis calculates the difference between the two, for example, using methods such as Euclidean distance or spectral angle matching (SAM) to quantify the degree of match.

[0082] 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; It should be explained that the degree of fit of each pixel is calculated based on the results of spectral matching. The degree of fit can reflect the similarity between the spectral feature and the reference spectrum. The higher the degree of fit, the closer the pixel is to the preset sugar feature. The degree of fit is combined with the spectral feature parameters to extract the spectral feature parameters related to the sugar absorption characteristics.

[0083] 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; It should be explained that a fitting threshold is set. If the fitting degree of a certain pixel point is higher than the threshold, it is judged that the pixel point contains spectral parameters that meet the sugar absorption characteristics, and the corresponding component content is recorded. If the fitting degree is lower than the threshold, it is considered that the spectral characteristics of the pixel point have no significant correlation with the sugar content, and the point is ignored.

[0084] S156, repeating steps S152 to S155, and processing the entire spectral image data pixel by pixel to extract component content characteristics of all pixels; It should be explained that envelope removal, spectrum matching, fit calculation and threshold judgment are repeatedly performed on each pixel in the entire spectral image to extract the spectral characteristic parameters related to sugar pixel by pixel. After processing each pixel, these data are recorded to obtain the characteristic data of sugar content of each pixel.

[0085] 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.

[0086] It should be explained that the extracted spectral feature parameters are integrated with the fitting information to generate a complete apple spectral image, showing the sugar content characteristics of each pixel.

[0087] For example, a sugar content distribution map can be generated to show the sugar concentration in different areas. Using different colors to represent different sugar contents, you can clearly see which areas have higher sugar content and which areas have lower sugar content.

[0088] Preferably, the optimization formula is: ; In the formula, K a_new ( T +1) indicates the a The hyperparameters are configured in T +1 value at iteration; K a ( T ) is expressed as a The hyperparameters are configured in T The value at the iteration; K best ( T ) is expressed as T The best hyperparameter value among all hyperparameter configurations at iteration 1; Cauchy is represented as the Cauchy operator; K f ( T ) is expressed as T The values ​​of the randomly selected hyperparameter configurations at iteration .

[0089] Preferably, using a quality assessment algorithm to assess the changing 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; It should be explained that, taking the sugar content of apples as an example, the parameters of the improved dragonfly algorithm are set, including 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 comes from the spectral feature parameters extracted by multispectral imaging technology.

[0090] 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; It should be explained that the initial fitness function value of each agricultural product sample is calculated. The design of the fitness function is based on the evaluation criteria for agricultural product quality, such as the stability of sugar content, the deviation of the change rate from the standard value, etc. The fitness function value measures the difference between the change trend of the sugar content of each sample and the expected change trend (such as maintaining stability or slowly rising). It can be calculated using the least squares method or other error measurement methods.

[0091] S33, using the behavioral rules to update the content of each agricultural product ingredient; It should be explained that the dragonfly algorithm is used to simulate the behavior of dragonfly groups, including rules such as attraction, dispersion, and alignment, and these behavioral rules guide the algorithm to conduct local and global searches. In each iteration, the component content of each sample (such as the change trend of sugar content) is updated to move it in the optimization direction.

[0092] 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; It should be explained that the local sequence floating backward selection mechanism is used to perform local search on the currently found optimal sugar content 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 the local optimum and find a more accurate optimization solution by fine-tuning the search results each time.

[0093] 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; It should be explained that the maximum number of iterations of the algorithm is set, for example, 100 iterations or stopping when the convergence condition is reached. At this time, the sugar content change trend of each apple sample and the corresponding fitness function value are output.

[0094] 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.

[0095] It should be explained that the sugar content of the apples meets the requirements according to the set fitness threshold. If it is higher than the set fitness threshold, it is considered to be of good quality, and if it is lower than the set fitness threshold, it is considered to be of unqualified quality. The final quality evaluation result is output to determine which apples meet the sugar content requirements and which need to be further processed or eliminated.

[0096] Specifically, the quality evaluation algorithm is an improved dragonfly algorithm. The traditional dragonfly algorithm is a swarm intelligence optimization algorithm. The traditional dragonfly algorithm mainly learns two behavior modes of dragonfly groups - static groups and dynamic groups, and approximately corresponds these two group behaviors to the global exploration and local development of the swarm intelligence algorithm. The improved dragonfly algorithm of the present invention inherits the good convergence of the traditional dragonfly algorithm and introduces a local sequence floating backward selection mechanism, which increases the global search capability of the algorithm while improving the solution accuracy of the algorithm.

[0097] Preferably, in the iterative optimization process of the quality assessment algorithm, the local search optimization of the currently found 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; It should be explained that an initial subset of apple component contents is set, assuming that the subset contains multiple components (such as sugar, acidity, moisture, etc.) or spectral characteristics of sugar in different bands.

[0098] 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; It should be explained that the sequential floating backward selection operation is used to delete the component with the greatest impact on the fitness value. After deletion, the agricultural product component content subset is updated to generate a new subset. The sequential floating backward selection aims to find the component combination with the least impact on fitness by removing the components that have a greater impact on the results.

[0099] 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; 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 component that has a greater impact on the fitness. This ensures that in different component combinations, the optimization effect of the model will not be affected by repeated additions. Repeated deletion and addition can further optimize the component combination.

[0100] 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.

[0101] It should be explained that new ingredients are continuously searched from the remaining agricultural product ingredients, and the sequence floating forward selection mechanism is used to find ingredients that can optimize fitness. If the new ingredient found can improve fitness, it will be added to the subset and updated; if the fitness does not increase significantly, the local search is terminated. In local search optimization, the combination of forward selection and backward selection helps to reduce ingredient redundancy and find the optimal combination for the trend of ingredient content changes. Finally, the optimal trend of agricultural product ingredient content changes is output.

[0102] In order to facilitate understanding of the above technical solution of the present invention, the present invention will be described in detail below on how to use a quality assessment algorithm to assess the changing trend of the content of agricultural product ingredients in the actual process to determine whether the quality of the agricultural product meets the requirements.

[0103] Step 1: Set the maximum number of iterations to 100 times, take the balance of each component content as the goal, and set the target value within the standard range. For example, the applicable 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%.

[0104] Initial agricultural product data sample: Sample 1: Vitamin C content = 55mg / 100g, sugar content = 15g / 100g, water content = 83%; Sample 2: Vitamin C content = 65mg / 100g, sugar content = 13g / 100g, water content = 84%; Sample 3: Vitamin C content = 75mg / 100g, sugar content = 16g / 100g, water content = 86%.

[0105] Step 2: The default fitness function is: ; In the formula, F It is expressed as the fitness function value of agricultural products; n Indicates the total number of ingredients in the agricultural product; z d Expressed as d The actual value of each component; H d Expressed asd target value for each component.

[0106] According to the above fitness function, the fitness function value of sample 1 is: Vitamin C: target value = 85 mg / 100 g, actual value = 55 mg / 100 g, fitness score = 1-|55-85| / 85=0.65; Sugar content: target value = 15g / 100g, actual value = 15g / 100g, fitness score = 1-|15-15| / 15=1; Moisture: target value = 85%, actual value = 83%, fitness score = 1-|83-85| / 85=0.976; Therefore, the total fitness score of sample one is: F 1=(0.65+1+0.976) / 3=0.875.

[0107] According to the calculation process of the fitness function value of sample 1, similarly, the fitness values ​​of sample 2 and sample 3 are calculated as follows: Sample 2 is F 2=0.873; Sample 3 is F 3=0.934.

[0108] Step 3: Use the behavior rules of the Dragonfly algorithm to update the behavior rules of each agricultural product ingredient content: 1) Attraction: The sugar content of samples one and two is close to the target value, which has an attractive effect on other ingredients, causing vitamin C and water to move towards the optimization target.

[0109] Assume that attraction increases vitamin C content by 2\%2% and water content by 0.5\%0.5%.

[0110] 2) Repulsion: The dispersal rule acts on the sugar content of samples 2 and 3 to prevent the sugar content from being too high or too low.

[0111] Assume that the sugar content of sample three is reduced by 1%.

[0112] 3) Alignment: 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.

[0113] 4) Updated ingredient content: Sample 1 update: Vitamin C increased by 2%, updated to: 55×1.02=56.1mg / 100g; The moisture content increases by 0.5%, and is updated to: 83×1.005=83.415%; Sample 2 update: Vitamin C increased by 2%, updated to: 65×1.02=66.3mg / 100g; Sugar content increased by 1%, updated to: 13×1.01=13.13g / 100g; The moisture content increases by 0.5%, updated to: 84×1.005=84.42%.

[0114] Sample 3 update: Vitamin C increased by 2%, updated to: 75×1.02=76.5mg / 100g; Sugar content decreased by 1%, updated to: 16×0.99=15.84g / 100g; The moisture content increases by 0.5%, updated to: 86×1.005=86.43%.

[0115] Step 4: Local search optimization: Deleting the component with the greatest impact on the fitness value: The vitamin C content of sample 1 is far from the target value, so we choose to delete vitamin C and optimize the remaining sugar and water.

[0116] Select new ingredients to add: In the remaining ingredient set, reintroduce new vitamin C content. Assume that the new vitamin C content is selected as: 56.1+2=58.156.1+2=58.1mg / 100g.

[0117] Continue to delete the ingredients with the greatest impact: Check the fitness values ​​of sugar and water, and find that sugar is already optimal, so no more deletion is required.

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

[0119] Step 5. After multiple iterations, the composition change trend of each optimized sample is as follows: 1) Sample 1: Vitamin C updated to 58.1mg / 100g.

[0120] The sugar content is maintained at 15g / 100g.

[0121] Moisture content updated to 83.415%.

[0122] 2) Sample 2: Vitamin C updated to 66.3mg / 100g.

[0123] Sugar content updated to 13.13g / 100g.

[0124] Moisture content updated to 84.42%.

[0125] 3) Sample 3: Vitamin C updated to 76.5mg / 100g.

[0126] Sugar content updated to 15.84g / 100g.

[0127] Moisture content updated to 86.43%.

[0128] Substitute the above optimized component change trend values ​​of each sample into the fitness function formula, and the final fitness function value is: 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.

[0129] Step 6: Determine whether the quality of the agricultural products meets the requirements based on the optimal fitness value, and output the final evaluation results. For example, assuming that the fitness value threshold of the quality requirement is 0.90, only agricultural products with a fitness value greater than 0.90 are considered to meet the quality standards.

[0130] According to the calculated final fitness value of each sample: Sample 1: 0.888 (did not reach the threshold, failed).

[0131] Sample 2: 0.883 (did not reach the threshold, failed).

[0132] Sample 3: 0.942 (reached the threshold, qualified).

[0133] Preferably, analyzing 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; It should be explained that, taking the sugar content of apples as an example, an initial subset of apple component content is obtained, which includes multiple components (such as sugar, water, acidity, etc.) and related spectral features. The initial subset is optimized through a component optimization algorithm (such as the Jaya algorithm) to preliminarily screen out potential component contents related to the target indicator (such as the stability or volatility of sugar).

[0134] S42, from the optimized agricultural product component content subsets, select several optimal subsets related to the target indicators to form a reference set; It should be explained that, from the optimized component subset, several components with the strongest correlation with the target index are further selected to form the optimal subset as the reference set. Step S42 relies on analyzing the strong correlation between the components and the target quality index (such as the stability and rising trend of sugar content) to select the most representative components. Methods such as correlation coefficient analysis or regression analysis can be used to screen the components that are most relevant to the change trend of the target quality index.

[0135] S43, generating a plurality of subsets in the reference set, and combining each subset to generate a new subset of agricultural product components; It should be explained that in the reference set, multiple new subsets of agricultural product components are generated. These new subsets are generated by combining different components to further enrich the potential association patterns of the components. Each subset is evaluated in combination to calculate its fitness value or correlation with the target indicator. The generation of new subsets is based on the characteristics of the decentralized search algorithm, which generates new subsets through random combination and mutation mechanisms while ensuring the diversity of the combinations.

[0136] 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; It is necessary to explain 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 decentralized search algorithm, several optimized optimal subsets are selected as the reference set for the next iteration. The merging and optimization ensures that the optimal subset is selected in each iteration by balancing global and local searches, gradually approaching the component combination that is most relevant to the target indicator.

[0137] 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.

[0138] It should be explained that it is determined whether the current agricultural product component content subset meets the termination condition (such as reaching the number of iterations or the correlation convergence). If the termination condition is met, the agricultural product component content related to the target indicator (such as the sugar content change trend) is output; if not, it returns to step S43 to continue optimization. The termination condition can be based on the fitness value improvement is no longer significant, or the number of iterations reaches a preset value. This termination condition ensures that the algorithm does not fall into invalid long-term calculations.

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

[0140] Preferably, 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 comprises 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.

[0141] Specifically, the component optimization algorithm is the Jaya algorithm, which is a new 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 the advantage that it is a parameter-free algorithm that only requires two control parameters: population size and number of iterations. Therefore, the additional computational workload required to optimize the parameters to obtain the optimal solution is eliminated.

[0142] Preferably, the update formula is: ; In the formula, Expressed as H i,j,c Updated values ​​of agricultural product ingredient content; H i,j,c Expressed as c In the iteration j The first i The value of the content of agricultural product ingredients; Expressed as i The content of each agricultural product ingredient corresponds to the value of the optimal ingredient content combination; Expressed as i The content of each agricultural product ingredient is at the value corresponding to the worst ingredient content combination; s 1 and s 2 are all random numbers.

[0143] Specifically, s 1 and s 2 is a random number between (0, 1), is to move the current solution towards the optimal solution (i.e. the value of the optimal component content combination), It is the value that makes the current solution away from the worst solution (that is, the worst combination of component contents).

[0144] According to another embodiment of the present invention, Figure 2 As shown, a system for analyzing the content of agricultural product components based on multispectral imaging is also provided. The system for analyzing the content of agricultural product components based on multispectral imaging includes: The data acquisition module 1 is used to acquire the spectral image data of the agricultural products based on the multi-spectral imaging technology, and process the spectral image data to extract the component content characteristic data of the agricultural products; Model building module 2, used to build a content prediction model based on the characteristic data of the content of the agricultural products, and obtain the change trend of the content of the agricultural products in the future time period based on the content prediction model; The quality assessment module 3 is used to assess 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 4 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 indicator; The data acquisition module 1 is connected to the quality evaluation module 3 via the model building module 2 , and the quality evaluation module 3 is connected to the content analysis module 4 .

[0145] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should 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 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.

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 1, 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 optimization formula is: ; In the formula, K a_new ( T +1) indicates the a The hyperparameters are configured in T +1 value at iteration; K a ( T ) is expressed as a The hyperparameters are configured in T The value at the iteration; K best ( T ) is expressed as T The best hyperparameter value among all hyperparameter configurations at iteration 1; Cauchy is represented as the Cauchy operator; K f ( T ) is expressed as T The values ​​of the randomly selected hyperparameter configurations at iteration .

5. The method for analyzing the content of agricultural products based on multispectral imaging according to claim 1, characterized in that: 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 the 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.

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 1, 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 1, characterized in that: The update formula is: ; In the formula, Expressed as H i,j,c Updated values ​​of agricultural product ingredient content; H i,j,c Expressed as c In the iteration j The first i The value of the content of agricultural product ingredients; Expressed as i The content of each agricultural product ingredient corresponds to the value of the optimal ingredient content combination; Expressed as i The content of each agricultural product ingredient is at the value corresponding to the worst ingredient content combination; s 1 and s 2 are all 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.

Citation Information

Patent Citations

  • Near-infrared nondestructive online quality detection method and system for nutritional ingredients of agricultural products

    CN114324233A

  • Method and device for nondestructive detection of fruit phosphorus content of Huangguan pears

    CN117538287A

  • Fresh agricultural product shelf life quality intelligent control and early warning model device

    CN118036887A

  • Evaluation and analysis method suitable for postharvest storage quality of broccoli

    CN118310977A

  • Enterprise evaluation analysis and cultivation method and system

    CN118966834A

Cited By

  • Hyperspectral screening method for pesticide residues of crops

    CN121476084A