Agricultural and sideline product distribution method and device, computer equipment and program product
By dynamically adjusting the attention weight of the shelf-life prediction model based on multidimensional quality indicators and local growth conditions of individual agricultural and sideline products, and combining conservative and lenient analyses to generate predicted shelf-life, high-risk batches are identified. This solves the loss risk caused by prediction bias in existing technologies and enables more accurate distribution planning.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-24
- Publication Date
- 2026-03-13
AI Technical Summary
In the logistics and distribution of agricultural and sideline products, existing technologies using shelf-life prediction models based on fixed attention weights lead to discrepancies between the predicted results and the actual shelf-life, increasing the risk of loss during the logistics and distribution process.
By randomly sampling batches of agricultural and sideline products, measuring the multidimensional quality indicators of each sampled individual, and obtaining data on the growth conditions in the place of origin, a fluctuation assessment text is generated using a fluctuation modulation text generation layer. The attention weight of the shelf life prediction model is dynamically adjusted, and the predicted shelf life is generated by combining conservative and lenient analysis perspectives. High-risk batches are identified and differentiated distribution plans are formulated.
It reduces the risk of loss during the logistics and distribution of agricultural and sideline products. By dynamically adjusting attention weights and using a bipolar fluctuation assessment mechanism, it improves the accuracy of forecasts and the reliability of distribution plans, and reduces the uncertainty caused by fluctuations in critical individuals and growth conditions.
Smart Images

Figure CN121660191A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of logistics management technology, and in particular to a method, apparatus, computer equipment and program product for the distribution of agricultural and sideline products. Background Technology
[0002] In the logistics and distribution of fresh fruits, vegetables, and other agricultural products, the accuracy of shelf-life prediction directly impacts transportation route planning, warehousing turnover, and last-mile delivery timeliness. Existing prediction methods typically establish unified models based on quality indicators, such as predicting shelf life using measurable parameters like color value and gloss.
[0003] When trained under laboratory conditions, these models are pre-trained on each quality indicator and assigned fixed attention weights, forming a general mapping relationship from agricultural product quality indicators to shelf life. During distribution planning, the prediction results obtained from this model can be used to combine logistics transportation batches and set delivery time windows.
[0004] However, existing technologies still have some problems, which means that if logistics companies rely on fixed predictions given by general models to formulate delivery plans after receiving batches sorted by appearance, the risk of loss during the logistics and distribution of agricultural and sideline products is still relatively high. Summary of the Invention
[0005] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this application provides a method, apparatus, computer equipment and program product for the distribution of agricultural and sideline products, which can reduce the risk of loss during the logistics and distribution of agricultural and sideline products.
[0006] In a first aspect, this application provides a method for distributing agricultural and sideline products, comprising the following steps: Multiple samples are obtained by sampling a batch of sorted agricultural products to obtain a sample set consisting of multiple sampled individuals; Each sampled individual was measured individually to obtain multidimensional quality indicators for each sampled individual; Obtain the data on the origin and growth conditions of the batch of agricultural and sideline products; A shelf-life prediction model is constructed, which includes a fluctuation modulation text generation layer and a shelf-life prediction network layer. For each sampled individual in the sampled individual set, the origin growth condition data is input into the fluctuation modulation text generation layer to generate fluctuation assessment text; The multidimensional quality indicators of the sampled individuals and the fluctuation assessment text are input into the shelf life prediction network layer. The fluctuation assessment text is used to modulate the attention weights of each quality indicator in the multidimensional quality indicators in the shelf life prediction network layer to output the predicted shelf life of the sampled individuals. The predicted shelf life of all sampled individuals in the sampled individual set is calculated to obtain the predicted shelf life of the batch corresponding to the sampled individual set; Based on the predicted shelf life of the batch, develop a distribution plan for the agricultural products in that batch.
[0007] Optionally, the following steps may also be included: The data on the growth conditions in the place of origin are analyzed from both a conservative and a lenient analysis perspective using the fluctuation modulation text generation layer to generate conservative fluctuation assessment text and lenient fluctuation assessment text, respectively. For each sampled individual in the sampled individual set, the multidimensional quality index of the sampled individual and the conservative fluctuation assessment text are input into the shelf life prediction network layer to obtain the first predicted shelf life of the sampled individual; The multidimensional quality index of the sampled individual and the loose fluctuation assessment text are input into the shelf life prediction network layer to obtain the second predicted shelf life of the sampled individual. Calculate the difference between the first predicted shelf life and the second predicted shelf life to obtain the prediction divergence degree of the sampled individual; Individuals whose predicted divergence exceeds a preset divergence threshold are taken as boundary samples, and the number of boundary samples in the set of sampled individuals is counted to obtain the boundary sample ratio. When the proportion of the boundary samples exceeds a preset proportion threshold, the batch is identified as a high-risk batch. For the high-risk batch, the safe shelf life of the batch is obtained based on the first predicted shelf life of all sampled individuals; The distribution plan for the high-risk batches is formulated based on the stated safe shelf life.
[0008] Optionally, the method for distributing agricultural and sideline products includes the following steps: The fluctuation modulation text generation layer is built based on a pre-trained large language model to receive local growth condition data and generate fluctuation assessment text. The shelf-life prediction network layer includes a quality feature encoding module, a fluctuation assessment text encoding module, an attention modulation module, and a shelf-life regression module; The quality feature encoding module receives multi-dimensional quality indicators of sampled individuals and extracts quality feature vectors. The fluctuation assessment text encoding module receives the fluctuation assessment text and extracts the fluctuation semantic feature vector; The attention modulation module receives the quality feature vector and the fluctuation semantic feature vector, and modulates the attention weights of the features corresponding to each quality index by the fluctuation semantic feature vector, and outputs a fused feature vector. The shelf life regression module receives the fused feature vector and outputs the predicted shelf life value.
[0009] Optionally, the shelf-life prediction model is trained in the following manner: Obtain a shelf life prediction training dataset, which contains multiple training samples. Each training sample includes multidimensional quality indicators of the sampled individuals, corresponding production area growth condition data, fluctuation assessment text annotations, and actual shelf life annotations. The fluctuation modulation text generation layer is trained using data on local growth conditions and corresponding fluctuation assessment text annotations. After the fluctuation modulation text generation layer is trained, the origin and growth condition data of the training samples are input into the fluctuation modulation text generation layer to generate fluctuation assessment text. The multidimensional quality indicators of the training samples and the fluctuation assessment text are input into the shelf life prediction network layer to output the predicted shelf life. The fluctuation modulation text generation layer and the shelf life prediction network layer are jointly trained using real shelf life annotations to obtain the shelf life prediction model.
[0010] Optionally, generating the conservative volatility assessment text includes: During the training process of the shelf life prediction model, conservative analysis angle instructions and local growth condition data are input into the fluctuation modulation text generation layer. The conservative analysis angle instructions guide the fluctuation modulation text generation layer to strengthen the evaluation of unfavorable factors of local growth conditions and generate conservative fluctuation evaluation text annotations. The wave modulation text generation layer is trained using the conservative wave assessment text annotation, so that the wave modulation text generation layer can generate conservative wave assessment text when receiving conservative analysis angle instructions.
[0011] Optionally, generating the easing volatility assessment text includes: During the training process of the shelf life prediction model, a relaxed analysis angle instruction and local growth condition data are input to the fluctuation modulation text generation layer. The relaxed analysis angle instruction guides the fluctuation modulation text generation layer to strengthen the evaluation of favorable factors of local growth conditions and generate relaxed fluctuation evaluation text annotations. The wave modulation text generation layer is trained using the relaxed wave evaluation text annotation, so that the wave modulation text generation layer can generate relaxed wave evaluation text when receiving a relaxed analysis angle instruction.
[0012] Optionally, obtaining the safe shelf life of the batch based on the first predicted shelf life of all sampled individuals includes the following steps: The first predicted shelf life of all sampled individuals in the sampled individual set is statistically analyzed, and the average value is calculated to obtain the safe shelf life of the high-risk batch.
[0013] Secondly, this application provides an agricultural and sideline product distribution device, the device comprising at least one module for performing the agricultural and sideline product distribution method described in any of the first aspects.
[0014] Thirdly, this application provides a computer device including a processor for executing a computer program stored in a memory to implement the agricultural and sideline product distribution method described in any of the first aspects.
[0015] Fourthly, this application provides a computer program product containing instructions that, when executed by a computer device, cause the computer device to perform the agricultural and sideline product distribution method as described in any of the first aspects.
[0016] The technical solution provided in this application has the following advantages compared with the prior art: One of its beneficial effects and its working principle is as follows: Even agricultural products from the same batch, sorted according to appearance indicators, may have different actual shelf lives, even if they have the same appearance grade. This difference stems from varying growing conditions in different production areas. Factors such as temperature fluctuations, rainfall distribution, and soil conditions can alter the relationship between quality indicators and shelf life. Traditional shelf-life prediction models, based on fixed attention weights, do not consider the contribution of production area growing conditions to determining different quality indicators, leading to discrepancies between predicted and actual shelf-life results.
[0017] This application involves randomly sampling batches of agricultural products, measuring the multidimensional quality indicators of each sampled individual, and simultaneously acquiring data on the growing conditions at the production site. The data on the growing conditions is input into a fluctuation modulation text generation layer to generate fluctuation assessment text. This fluctuation assessment text, along with the multidimensional quality indicators of the sampled individuals, is then input into a shelf-life prediction network layer. The fluctuation assessment text modulates the attention weights of each quality indicator, enabling the prediction model to dynamically adjust the weight allocation based on the actual deviation from the growing conditions at the production site. The predicted shelf-life of all sampled individuals in the sampled individual set is statistically analyzed, and the average value is calculated to obtain the batch's predicted average shelf-life.
[0018] This weighted modulation mechanism based on fluctuation assessment text relies on the ability of a large language model to understand the data on growing conditions in the production area. This data includes multi-source, heterogeneous information such as meteorological records and planting management data. Previously, the correlation between this information and the quality of agricultural products was difficult to quantify using traditional rule-based methods. However, the fluctuation-modulated text generation layer provided in this application, built on a large language model, can understand the impact mechanism of factors such as temperature fluctuations and abnormal rainfall in the growing conditions data on the intrinsic quality (shelf life) of agricultural products, generating fluctuation assessment text describing the degree of deviation.
[0019] Ultimately, this application adopts batch-based shelf-life forecasting that takes into account the impact of fluctuations in place of origin when formulating the delivery plan, avoiding the prediction bias caused by the fixed weights used in general models. This allows logistics companies to obtain a more accurate basis for setting delivery time windows.
[0020] Therefore, this application provides a method for distributing agricultural and sideline products, which can reduce the risk of loss of agricultural and sideline products during the logistics and distribution process.
[0021] Its second beneficial effect and its working principle are as follows: When sampling a batch and calculating the predicted average shelf life, directly using fluctuation assessment text can easily lead to misjudgments of certain sampled individuals. This is because when the quality indicators of a sampled individual are close to the critical values of the grading standards—for example, the color value just reaching the maturity standard for a certain grade—the quality characteristics of these critical individuals lie at the boundary between the mature and immature grading intervals, hence the term "critical individual." The inherent quality of critical individuals is difficult to accurately determine using quality indicators alone, and the fluctuations in growing conditions at the production site further increase the uncertainty in predicting their shelf life. Under different assessment perspectives of growing conditions at the production site, the predicted shelf life results for critical individuals will vary significantly more than those for individuals whose quality indicators are far from the critical values. If the proportion of critical individuals in a batch is high, relying solely on the average value to formulate a distribution plan will underestimate the overall risk of the batch.
[0022] This application generates conservative and relaxed volatility assessment texts by applying a volatility modulation text generation layer to the production area growth condition data from both conservative and relaxed analysis perspectives. For each sampled individual, its multidimensional quality indicators, along with the conservative and relaxed volatility assessment texts, are input into the shelf-life prediction network layer to obtain a first and a second predicted shelf-life. The difference between the two is calculated to obtain the prediction divergence degree for that sampled individual. Sampled individuals with prediction divergence degrees exceeding a preset divergence threshold are designated as boundary samples, and the proportion of boundary samples is statistically analyzed. When the proportion of boundary samples exceeds a preset proportion threshold, the batch is identified as a high-risk batch, and the average of the first predicted shelf-life of all sampled individuals is used as the safe shelf-life.
[0023] This bipolar volatility assessment mechanism identifies individuals within a batch whose growth conditions are uncertain due to fluctuations by using the difference between conservative and lenient forecasts. The boundary sample proportion serves as a batch risk indicator, reflecting the percentage of individuals in that batch with high shelf-life uncertainty. High-risk batches use the conservative forecast results to calculate their safe shelf life, allowing distribution plans to be set with differentiated time windows based on the degree of uncertainty within each batch. This risk assessment based on the boundary sample proportion avoids the masking effect of batch averages on high-risk individuals, providing agricultural product logistics and distribution companies with more reliable distribution data at the batch level.
[0024] Therefore, this application provides a method for distributing agricultural and sideline products, which can reduce the risk of loss of agricultural and sideline products during the logistics and distribution process. Attached Figure Description
[0025] Figure 1 This is a schematic diagram illustrating an application scenario of the agricultural and sideline product distribution method provided in the embodiments of this application; Figure 2 One of the flowcharts of the agricultural and sideline product distribution method provided in the embodiments of this application; Figure 3 A second schematic flowchart illustrating the agricultural and sideline product distribution method provided in this application embodiment; Figure 4 This is the third flowchart illustrating the agricultural and sideline product distribution method provided in this application embodiment. Detailed Implementation
[0026] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0027] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0028] Before providing a detailed explanation of the embodiments of this application, let's first introduce the application scenarios involved in the embodiments of this application.
[0029] Figure 1 This is a schematic diagram illustrating an application scenario of the agricultural and sideline product distribution method provided in this application embodiment. For example... Figure 1 As shown, logistics companies need to develop delivery plans for each batch of agricultural products sorted by fruit size and appearance in their daily distribution operations. Delivery dispatchers use agricultural product distribution devices to obtain multidimensional quality index measurement data and origin growth condition data for individual samples in each batch. The device outputs the predicted shelf life of the batch. For high-risk batches with a high proportion of boundary samples, the device calculates the safe shelf life and labels the risk level. Based on the prediction results, delivery dispatchers arrange transportation routes and / or delivery time windows, prioritizing the allocation of high-risk batches to nearby orders or routes with shorter delivery cycles.
[0030] The agricultural and sideline product distribution method provided in this application embodiment can be executed by an agricultural and sideline product distribution device, which includes at least one module for executing the agricultural and sideline product distribution method as described in the following embodiments.
[0031] In a first aspect, this application provides a method for distributing agricultural and sideline products, comprising the following steps: S201: Sample a batch of agricultural and sideline products that has been sorted to obtain multiple sample individuals, so as to obtain a sample individual set consisting of multiple sample individuals.
[0032] In this embodiment, agricultural products undergo visual sorting before entering the logistics and distribution process. The sorting process can classify agricultural products into different grades based on appearance standards such as fruit size, color, and surface quality, with products of the same grade forming a batch.
[0033] The sampling process for a batch of agricultural products employs random sampling. During the sampling operation, sampling personnel randomly select individuals from different locations within the batch to avoid concentrating sampling in a single area. The number of samples is determined based on the batch size, typically set at 20 to 50 individuals.
[0034] S202: Measure each sampled individual individually to obtain multidimensional quality indicators for each sampled individual.
[0035] In this embodiment, the multidimensional quality indicators include measurable quality parameters such as color value, hardness, and sugar content. These indicators are obtained manually using specialized testing equipment to quantify the quality characteristics of the sampled individuals.
[0036] Color values were measured using a colorimeter, converting the color of the sampled individuals into a numerical value. Firmness was measured using a fruit firmness meter, converting the firmness of the sampled individuals into a numerical value. Sugar content was measured using a handheld saccharimeter, converting the sugar content of the sampled individuals into a numerical value.
[0037] The measurement personnel performed measurements on each individual in the sampled set. After each individual's measurement was completed, the corresponding quality index values for each dimension were recorded.
[0038] S203: Obtain the data on the origin and growth conditions of the batch of agricultural and sideline products.
[0039] In this embodiment of the application, the data on the growing conditions at the place of origin includes two categories: meteorological records and planting management records, which are used to describe the environmental conditions experienced by the batch of agricultural products during their growth period.
[0040] Meteorological records were obtained by retrieving historical data from local weather stations, including environmental parameters such as temperature changes, rainfall distribution, and sunshine duration during the growing season. Planting management records included information on human interventions such as irrigation frequency, fertilization timing, and pesticide application.
[0041] There are multiple ways to obtain planting management records. Plantations equipped with intelligent agricultural management systems can directly export structured management data from the system. Growers without management systems can record key information such as watering intervals, fertilization intervals, and pesticide spraying intervals based on their practical experience, filling out a brief record form. Although this manual recording method is less accurate than automated systems, it still provides a basic description of the growing conditions.
[0042] This is also one of the effects of the embodiments of this application. The fluctuation modulation text generation layer used in this application is built based on a large language model, which has relatively relaxed requirements on the format and accuracy of the growing conditions data. Regardless of whether the data comes from precise sensor records or growers' experience estimates, the large language model can extract key growing conditions features and generate corresponding fluctuation assessment text. This tolerance for data quality allows the method of this application to adapt to growing entities of different sizes.
[0043] S204: Construct a shelf-life prediction model, which includes a fluctuation modulation text generation layer and a shelf-life prediction network layer.
[0044] In this embodiment, the shelf-life prediction model employs a two-layer structure. The first layer is a fluctuation modulation text generation layer, responsible for converting origin growth condition data into fluctuation assessment text. The second layer is a shelf-life prediction network layer, responsible for fusing quality indicators and fluctuation assessment text to output shelf-life prediction results.
[0045] The fluctuation modulation text generation layer is built based on a pre-trained large language model to receive local growth condition data and generate fluctuation assessment text.
[0046] In this embodiment, either the Qwen series or the DeepSeek series models are selected. The fluctuation modulation text generation layer receives local growth condition data as input and outputs fluctuation assessment text describing the degree of deviation from the growth conditions.
[0047] The shelf-life prediction network layer includes a quality feature encoding module, a fluctuation assessment text encoding module, an attention modulation module, and a shelf-life regression module.
[0048] The quality feature encoding module receives multidimensional quality indicators of sampled individuals and extracts quality feature vectors.
[0049] In this embodiment, the quality feature encoding module includes 3 to 5 fully connected layers for receiving multidimensional quality indicators of sampled individuals. The purpose is to convert the numerical quality indicators into high-dimensional feature vectors through a multi-layer fully connected neural network.
[0050] The fluctuation assessment text encoding module receives the fluctuation assessment text and extracts the fluctuation semantic feature vector.
[0051] The text encoder uses the Qwen3-Embedding model, but in essence, any embedding model will suffice; the purpose is to convert the text into a fixed-dimensional fluctuating semantic feature vector. In the embodiments of this application, the vector dimension is generally set to 768 or 1024 dimensions.
[0052] The attention modulation module receives the quality feature vector and the fluctuation semantic feature vector, and modulates the attention weights of the features corresponding to each quality index by the fluctuation semantic feature vector, and outputs a fused feature vector. In this embodiment, the attention modulation module modulates the attention weights corresponding to each quality indicator in the quality feature vector using the fluctuation semantic feature vector. The modulation mechanism employs an attention mechanism, with the fluctuation semantic feature vector serving as the query vector and each quality indicator in the quality feature vector as a key-value pair. Weight coefficients for each quality indicator are calculated through attention, and the quality feature vector is weighted to output a fused feature vector.
[0053] The shelf life regression module receives the fused feature vector and outputs the predicted shelf life value.
[0054] In this embodiment, the shelf-life regression module receives a fused feature vector and outputs a predicted shelf-life value through a regression neural network containing 2 to 3 fully connected layers. The last layer outputs a single value representing the predicted shelf-life in days.
[0055] Figure 3 This is a second schematic flowchart illustrating the agricultural and sideline product distribution method provided in this application. (Refer to...) Figure 3 As shown: Specifically, the shelf-life prediction model is trained in the following way: S301: Obtain a shelf life prediction training dataset. The training dataset contains multiple training samples. Each training sample includes multidimensional quality indicators of the sampled individuals, corresponding production area growth condition data, fluctuation assessment text annotations, and actual shelf life annotations.
[0056] In this embodiment of the application, the training dataset is constructed using historical agricultural and sideline product delivery records and laboratory test data.
[0057] Each training sample corresponds to a complete information record of a sampled individual. Multidimensional quality indicators are obtained through the aforementioned measurement method S202, recording parameters such as color value, firmness, and sugar content of the individual. Origin and growth condition data are extracted from the origin archives of the batch to which the individual belongs, including meteorological records and planting management records for that batch's growth period.
[0058] The fluctuation assessment text is annotated by experts. Based on data on local growing conditions, experts analyze the impact of factors such as temperature fluctuations, abnormal rainfall, and fertilization management on the quality of agricultural products, and then write the assessment text. The assessment text needs to clearly indicate which environmental factors may affect which quality indicators and to what extent.
[0059] For data on growth conditions in the same production area, experts labeled the assessment texts as ordinary fluctuation, conservative fluctuation, and lenient fluctuation. The ordinary fluctuation assessment text objectively describes deviations from standard environmental conditions, providing a neutral assessment of their impact on various quality indicators. The conservative fluctuation assessment text, from a risk control perspective, pays more attention to adverse factors and emphasizes the negative impact of deviations from growth conditions on quality. The lenient fluctuation assessment text, from an optimistic perspective, pays more attention to favorable factors and downplays the impact of adverse factors.
[0060] The true shelf life is determined through tracking tests. Sampled individuals are stored under standard storage conditions, and their quality is checked daily. The number of days from the sampling time to the point where the quality becomes unacceptable is recorded as the true shelf life. Criteria for determining unacceptable quality include objective indicators such as obvious surface rot, a decrease in hardness exceeding a threshold, and a loss of sugar content exceeding a threshold.
[0061] For example, taking a training sample as an example, this sample records the information of an individual peach: the multidimensional quality indicators are color value 82, firmness 5.8, and sugar content 12.8; Data on growing conditions in the production area show that this batch experienced continuous rainfall in late April and insufficient sunshine in early May; The text for the general fluctuation assessment is labeled as "Excessive rainfall during the growing season leads to a reduction in the duration of sunlight, which affects sugar accumulation and coloring to a certain extent. Therefore, the contribution of sugar content and color value indicators decreases, while the contribution of hardness indicator increases." The conservative fluctuation assessment text is marked as "Continuous rainfall during the growing season hinders sugar accumulation, thus significantly reducing the contribution of sugar content and color value indicators, while significantly increasing the contribution of hardness indicator." The text of the easing fluctuation assessment is marked as "Rainfall during the growing season increased slightly, but overall light conditions were still acceptable, which had a limited impact on sugar accumulation. Therefore, the contribution of sugar content and color value indicators decreased slightly, while the contribution of hardness indicator increased slightly." The actual shelf life is labeled as 6 days.
[0062] S302: Train the fluctuation modulation text generation layer using the origin growth condition data and its corresponding fluctuation assessment text annotations.
[0063] In this embodiment, the training of the fluctuation modulation text generation layer employs supervised fine-tuning. The fine-tuning process enables the model to learn the mapping relationship between the production site growth condition data and the generation of fluctuation assessment text.
[0064] The training input is local growing conditions data, and the training objective is the corresponding fluctuation assessment text annotation. The model receives structured meteorological records and planting management records, and outputs text describing the degree of deviation from growing conditions. The fine-tuning process employs a causal language modeling training approach, using the input local growing conditions data as the context and the annotated fluctuation assessment text as the context, to train the model's ability to predict the next term. The loss function uses cross-entropy loss, calculating the difference in probability distribution between each term generated by the model and its corresponding term in the annotated text, and optimizing the model parameters through gradient descent.
[0065] The training employs the LoRA low-rank adaptation method, which inserts low-rank decomposition matrices into the attention layer of the pre-trained model and achieves model adaptation by training these matrices.
[0066] The training process includes three modes. The first mode is the normal analysis mode, which directly inputs the origin and growth condition data, and the training objective is to provide text annotations for normal fluctuation assessment. The second mode is the conservative analysis mode, which inputs conservative analysis angle instructions and origin and growth condition data, and the training objective is to provide text annotations for conservative fluctuation assessment. The third mode is the relaxed analysis mode, which inputs relaxed analysis angle instructions and origin and growth condition data, and the training objective is to provide text annotations for relaxed fluctuation assessment.
[0067] In this embodiment, the conservative analysis perspective instruction is a guiding text added before the data on growing conditions in the production area as a prompt. This instruction requires the model to assess growing conditions from a risk control perspective, giving more attention to adverse factors.
[0068] In this application embodiment, an example of a conservative analysis angle instruction is as follows: Example of a conservative analysis angle command: Please analyze the following growing conditions from a conservative perspective, focusing on assessing the negative impacts of adverse factors such as abnormal temperature, rainfall deviation, and pest and disease risks on the quality of agricultural products. Therefore, please provide and list the changes in the contribution of each of the following {multidimensional quality indicators}.
[0069] During training, the input consists of a combination of conservative analysis angle instructions and local growth condition data, and the training objective is the conservative fluctuation assessment text labeled in S301. The fluctuation modulation text generation layer learns to output assessment text that is more sensitive to adverse factors when receiving conservative analysis angle instructions.
[0070] In this embodiment, the relaxed analysis perspective instruction acts in the opposite way to the conservative analysis perspective instruction. This instruction guides the model to evaluate growth conditions from an optimistic perspective, giving more attention to favorable factors and giving a lighter assessment of the impact of unfavorable factors.
[0071] In this application embodiment, an example of a relaxed analysis angle command is as follows: Example of a relaxed analysis angle command: Please analyze the following growing conditions from a lenient perspective, focusing on assessing the negative impacts of adverse factors such as abnormal temperatures, unfavorable rainfall, and pest and disease risks on the quality of agricultural products. However, the positive impacts of favorable factors such as suitable temperature, sufficient sunlight, and good management on the quality of agricultural products should also be considered. Therefore, the changes in the contribution level of each indicator in the following {multidimensional quality indicators} are given and listed separately.
[0072] The training input is a combination of relaxed analysis angle instructions and local growth condition data, and the training objective is the relaxed fluctuation assessment text labeled in S301. When receiving relaxed analysis angle instructions, the fluctuation modulation text generation layer outputs assessment text that focuses more on favorable factors.
[0073] After fine-tuning, the fluctuation modulation text generation layer can generate ordinary, conservative, or lenient fluctuation assessment texts for the same origin growth condition data based on different input patterns.
[0074] S303: After the training of the fluctuation modulation text generation layer is completed, the origin and growth condition data of the training samples are input into the fluctuation modulation text generation layer to generate fluctuation evaluation text. The multidimensional quality indicators of the training samples and the fluctuation evaluation text are input into the shelf life prediction network layer to output the predicted shelf life. The fluctuation modulation text generation layer and the shelf life prediction network layer are jointly trained using real shelf life annotations to obtain the shelf life prediction model.
[0075] In this embodiment, the fluctuation modulation text generation layer and the shelf-life prediction network layer are optimized end-to-end as a whole during the joint training phase. The fluctuation modulation text generation layer has been fine-tuned in S302 and is capable of generating fluctuation assessment texts in three modes: normal, conservative, and relaxed. However, joint training is only performed on the normal mode, so that the normal fluctuation assessment text can effectively modulate the attention weights of the shelf-life prediction network layer and accurately predict the shelf life.
[0076] During joint training, the origin and growth condition data of the training samples are directly input into the fluctuation modulation text generation layer to generate ordinary fluctuation assessment text. This ordinary fluctuation assessment text, along with the multidimensional quality indicators of the training samples, is then input into the shelf-life prediction network layer. Following the process described in S204, the shelf-life prediction network layer sequentially passes through the quality feature encoding module, the fluctuation assessment text encoding module, the attention modulation module, and the shelf-life regression module to output the predicted shelf-life value.
[0077] The loss function uses mean squared error loss to calculate the difference between the predicted shelf life and the actual shelf life label. The gradient updates the parameters of both the shelf life prediction network layer and the fluctuation modulation text generation layer simultaneously via backpropagation. During backpropagation, the shelf life prediction error is first passed to the shelf life regression module, then sequentially to the attention modulation module, the fluctuation assessment text encoding module, and finally to the fluctuation modulation text generation layer. The fluctuation modulation text generation layer receives the gradient signal from the shelf life prediction task and adjusts its generation strategy accordingly.
[0078] This joint optimization mechanism ensures that the description of the contribution of each quality indicator in the ordinary fluctuation assessment text directly affects the weight allocation calculated by the attention modulation module, and prompts the fluctuation modulation text generation layer to learn to generate assessment texts that are more conducive to accurately predicting shelf life.
[0079] Although joint training is only performed on the normal mode, the S302 training phase has already enabled the fluctuation modulation text generation layer to learn to generate two evaluation texts with distinctly different semantic tendencies: conservative and relaxed. During the inference phase, when the conservative and relaxed fluctuation evaluation texts are input into the shelf-life prediction network layer, the semantic differences in the texts naturally modulate the attention weights, producing different prediction results, thus providing a basis for calculating the degree of divergence for subsequent boundary sample identification.
[0080] S205: For each sampled individual in the sampled individual set, input the origin growth condition data into the fluctuation modulation text generation layer to generate fluctuation assessment text.
[0081] In this embodiment of the application, the origin and growth conditions data corresponding to the batch are directly input into the fluctuation modulation text generation layer, and ordinary fluctuation assessment text is generated using the ordinary analysis mode.
[0082] Taking the S301 peaches mentioned above as an example, data on the growing conditions of this batch's production area shows that it experienced continuous rainfall in late April and insufficient sunshine in early May.
[0083] After inputting the fluctuation modulation text generation layer, the ordinary fluctuation evaluation text is generated: "Excessive rainfall during the growing season leads to a reduction in sunshine duration, which affects sugar accumulation and coloring. Therefore, the contribution of sugar content and color value indicators decreases, while the contribution of hardness indicator increases."
[0084] Specifically, step S205 also includes the following steps: The data on the growth conditions in the place of origin are analyzed from both a conservative and a lenient analysis perspective using the fluctuation modulation text generation layer to generate conservative fluctuation assessment text and lenient fluctuation assessment text, respectively. Similarly, taking the peach information in S301 as an example, the data on the growing conditions of the place of origin are combined with the conservative analysis angle instruction and the relaxed analysis angle instruction respectively, and input into the fluctuation modulation text generation layer according to the training method in S302. Conservative fluctuation evaluation text and relaxed fluctuation evaluation text equivalent to the training set should also be generated.
[0085] S206: Input the multidimensional quality indicators of the sampled individual and the fluctuation assessment text into the shelf life prediction network layer. The fluctuation assessment text is used to modulate the attention weights of each quality indicator in the multidimensional quality indicators of the shelf life prediction network layer to output the predicted shelf life of the sampled individual.
[0086] In this embodiment, for each sampled individual in the sampled individual set, its multidimensional quality index and the ordinary fluctuation assessment text generated in S205 are input into the shelf-life prediction network layer. The shelf-life prediction network layer processes the data according to the process described in S204 and outputs the standard predicted shelf-life for that sampled individual.
[0087] Specifically, step S206 further includes the following steps: For each sampled individual in the sampled individual set, the multidimensional quality index of the sampled individual and the conservative fluctuation assessment text are input into the shelf life prediction network layer to obtain the first predicted shelf life of the sampled individual; The multidimensional quality index of the sampled individual and the loose fluctuation assessment text are input into the shelf life prediction network layer to obtain the second predicted shelf life of the sampled individual.
[0088] In this embodiment of the application, following the same process as described above, the multidimensional quality index of each sampled individual is input into the shelf life prediction network layer along with the conservative volatility assessment text and the relaxed volatility assessment text, respectively, to obtain the first predicted shelf life and the second predicted shelf life of each sampled individual.
[0089] S207: Calculate the predicted shelf life of all sampled individuals in the sampled individual set to obtain the predicted shelf life of the batch corresponding to the sampled individual set.
[0090] In this embodiment of the application, the standard predicted shelf life of all sampled individuals in the sampled individual set is statistically analyzed, and the average standard predicted shelf life is calculated as the standard predicted shelf life of the batch.
[0091] Specifically, the difference between the first predicted shelf life and the second predicted shelf life is calculated to obtain the prediction divergence degree of the sampled individual; Individuals whose predicted divergence exceeds a preset divergence threshold are taken as boundary samples, and the number of boundary samples in the set of sampled individuals is counted to obtain the boundary sample ratio.
[0092] In this embodiment of the application, for each sampled individual, the difference between its second predicted shelf life and its first predicted shelf life is calculated to obtain the prediction divergence degree for that sampled individual. The prediction divergence degree reflects the degree of difference in shelf life predictions under conservative and lenient analytical perspectives.
[0093] The predicted divergence is compared with a preset divergence threshold. Individuals with a predicted divergence exceeding the preset divergence threshold are identified as boundary samples. Boundary samples are individuals whose appearance indicators are close to the grading threshold and whose growth conditions have a high degree of uncertainty.
[0094] The number of boundary samples in the sampled individual set is counted, and the proportion of boundary samples to the total number of sampled individuals is calculated to obtain the boundary sample ratio. The boundary sample ratio serves as a batch risk assessment indicator, reflecting the proportion of individuals in that batch with high uncertainty in shelf-life prediction.
[0095] Figure 4 This is the third flowchart illustrating the agricultural and sideline product distribution method provided in this application. (Refer to...) Figure 4 As shown: S401: When the proportion of the boundary samples exceeds the preset proportion threshold, it indicates that the proportion of individuals with high uncertainty in the shelf life prediction in this batch is large, and the batch is identified as a high-risk batch. For the aforementioned high-risk batches: The safe shelf life of the batch is obtained based on the first predicted shelf life of all sampled individuals; Specifically, the safe shelf life is obtained through the following steps: The first predicted shelf life of all sampled individuals in the sampled individual set is statistically analyzed, and the average value is calculated to obtain the safe shelf life of the high-risk batch.
[0096] The first predicted shelf life is generated based on a conservative fluctuation assessment text. It uses a conservative approach to assess the impact of fluctuations in growth conditions, and the average value of this assessment is used as the safe shelf life to reduce the risk of loss during the distribution process.
[0097] The distribution plan for the high-risk batches is formulated based on the stated safe shelf life.
[0098] S402: When the proportion of the boundary samples does not exceed the preset proportion threshold, the batch is identified as a non-high-risk batch; For non-high-risk batches: The standard predicted shelf life of this batch will be used for the development of distribution plans for non-high-risk batches.
[0099] S208: Based on the predicted shelf life of the batch, formulate a distribution plan for the agricultural and sideline products of the batch.
[0100] In this embodiment, the delivery dispatcher formulates a delivery plan for the batch of agricultural products based on the shelf life determined in S401 or S402.
[0101] For high-risk batches, delivery plans are based on shelf-life. Delivery dispatchers prioritize allocating these batches to orders with shorter delivery cycles or arranging routes that shorten transit time.
[0102] For non-high-risk batches, the delivery plan is based on standard predicted shelf life. Delivery dispatchers arrange the transportation route and delivery time window for this batch according to the regular or relatively long delivery process.
[0103] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).
[0104] In the various embodiments of this application, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments are consistent and can be referenced mutually. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships. In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. In the textual description of the embodiments of this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. In this application, "first," "second," and various numerical designations are only for ease of description and are not used to limit the scope of the embodiments of this application. For example, they are used to distinguish different messages, rather than to describe a specific order or sequence.
[0105] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers does not imply the order of execution; the execution order of each process should be determined by its function and internal logic.
[0106] Finally, it should be noted that the above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for distributing agricultural and sideline products, characterized in that, Includes the following steps: Multiple samples are obtained by sampling a batch of sorted agricultural products to obtain a sample set consisting of multiple sampled individuals; Each sampled individual was measured individually to obtain multidimensional quality indicators for each sampled individual; Obtain the data on the origin and growth conditions of the batch of agricultural and sideline products; A shelf-life prediction model is constructed, which includes a fluctuation modulation text generation layer and a shelf-life prediction network layer. For each sampled individual in the sampled individual set, the origin growth condition data is input into the fluctuation modulation text generation layer to generate fluctuation assessment text; The multidimensional quality indicators of the sampled individuals and the fluctuation assessment text are input into the shelf life prediction network layer. The fluctuation assessment text is used to modulate the attention weights of each quality indicator in the multidimensional quality indicators in the shelf life prediction network layer to output the predicted shelf life of the sampled individuals. The predicted shelf life of all sampled individuals in the sampled individual set is calculated to obtain the predicted shelf life of the batch corresponding to the sampled individual set; Based on the predicted shelf life of the batch, develop a distribution plan for the agricultural products in that batch.
2. The method for distributing agricultural and sideline products according to claim 1, characterized in that, It also includes the following steps: The data on the growth conditions in the place of origin are analyzed from both a conservative and a lenient analysis perspective using the fluctuation modulation text generation layer to generate conservative fluctuation assessment text and lenient fluctuation assessment text, respectively. For each sampled individual in the sampled individual set, the multidimensional quality index of the sampled individual and the conservative fluctuation assessment text are input into the shelf life prediction network layer to obtain the first predicted shelf life of the sampled individual; The multidimensional quality index of the sampled individual and the loose fluctuation assessment text are input into the shelf life prediction network layer to obtain the second predicted shelf life of the sampled individual. Calculate the difference between the first predicted shelf life and the second predicted shelf life to obtain the prediction divergence degree of the sampled individual; Individuals whose predicted divergence exceeds a preset divergence threshold are taken as boundary samples, and the number of boundary samples in the set of sampled individuals is counted to obtain the boundary sample ratio. When the proportion of the boundary samples exceeds a preset proportion threshold, the batch is identified as a high-risk batch. For the high-risk batch, the safe shelf life of the batch is obtained based on the first predicted shelf life of all sampled individuals; The distribution plan for the high-risk batches is formulated based on the stated safe shelf life.
3. The method for distributing agricultural and sideline products according to claim 1, characterized in that, The method for distributing agricultural and sideline products includes the following steps: The fluctuation modulation text generation layer is built based on a pre-trained large language model to receive local growth condition data and generate fluctuation assessment text. The shelf-life prediction network layer includes a quality feature encoding module, a fluctuation assessment text encoding module, an attention modulation module, and a shelf-life regression module; The quality feature encoding module receives multi-dimensional quality indicators of sampled individuals and extracts quality feature vectors. The fluctuation assessment text encoding module receives the fluctuation assessment text and extracts the fluctuation semantic feature vector; The attention modulation module receives the quality feature vector and the fluctuation semantic feature vector, and modulates the attention weights of the features corresponding to each quality index by the fluctuation semantic feature vector, and outputs a fused feature vector. The shelf life regression module receives the fused feature vector and outputs the predicted shelf life value.
4. The method for distributing agricultural and sideline products according to claim 3, characterized in that, The shelf-life prediction model was trained in the following way: Obtain a shelf life prediction training dataset, which contains multiple training samples. Each training sample includes multidimensional quality indicators of the sampled individuals, corresponding production area growth condition data, fluctuation assessment text annotations, and actual shelf life annotations. The fluctuation modulation text generation layer is trained using data on local growth conditions and corresponding fluctuation assessment text annotations. After the fluctuation modulation text generation layer is trained, the origin and growth condition data of the training samples are input into the fluctuation modulation text generation layer to generate fluctuation assessment text. The multidimensional quality indicators of the training samples and the fluctuation assessment text are input into the shelf life prediction network layer to output the predicted shelf life. The fluctuation modulation text generation layer and the shelf life prediction network layer are jointly trained using real shelf life annotations to obtain the shelf life prediction model.
5. The method for distributing agricultural and sideline products according to claim 2, characterized in that, Generating the conservative volatility assessment text includes: During the training process of the shelf life prediction model, conservative analysis angle instructions and local growth condition data are input into the fluctuation modulation text generation layer. The conservative analysis angle instructions guide the fluctuation modulation text generation layer to strengthen the evaluation of unfavorable factors of local growth conditions and generate conservative fluctuation evaluation text annotations. The wave modulation text generation layer is trained using the conservative wave assessment text annotation, so that the wave modulation text generation layer can generate conservative wave assessment text when receiving conservative analysis angle instructions.
6. The method for distributing agricultural and sideline products according to claim 2, characterized in that, The generation of the easing volatility assessment text includes: During the training process of the shelf life prediction model, a relaxed analysis angle instruction and local growth condition data are input to the fluctuation modulation text generation layer. The relaxed analysis angle instruction guides the fluctuation modulation text generation layer to strengthen the evaluation of favorable factors of local growth conditions and generate relaxed fluctuation evaluation text annotations. The wave modulation text generation layer is trained using the relaxed wave evaluation text annotation, so that the wave modulation text generation layer can generate relaxed wave evaluation text when receiving a relaxed analysis angle instruction.
7. The method for distributing agricultural and sideline products according to claim 2, characterized in that, The safe shelf life of the batch is obtained based on the first predicted shelf life of all sampled individuals by the following steps: The first predicted shelf life of all sampled individuals in the sampled individual set is statistically analyzed, and the average value is calculated to obtain the safe shelf life of the high-risk batch.
8. An agricultural and sideline product distribution device, characterized in that, The apparatus includes at least one module for performing the agricultural and sideline product distribution method according to any one of claims 1-7.
9. A computer device, characterized in that, The computer device includes a processor for executing a computer program stored in a memory to implement the agricultural and sideline product distribution method according to any one of claims 1-7.
10. A computer program product containing instructions, characterized in that, When the instructions are executed by a computer device, the computer device performs the agricultural and sideline product distribution method as described in any one of claims 1-7.
Citation Information
Patent Citations
A method and a device for predicting the shelf life of harvested fresh grapes
CN109816150A
Fresh agricultural product shelf life quality intelligent control and early warning model device
CN118036887A
Farmland yield prediction method and system based on heterogeneous graph neural network
CN121146219A