Grain condition prediction processing method and system based on time sequence large model and storage medium
By using a grain condition prediction method based on a time-series large model, combined with structured pruning and model fine-tuning, accurate prediction of future grain conditions in grain depots has been achieved, solving the problem of unpredictability in existing technologies and improving the efficiency and economic benefits of grain depot management.
Patent Information
- Application Number
- CN202511468501.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-15
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-10-15
AI Technical Summary
Existing grain depot monitoring systems are unable to predict future grain conditions, leading to irreversible damage to grain quality and causing economic losses.
A grain condition prediction method based on a time-series large model is adopted. By acquiring grain condition data of the grain storage area, a pre-trained grain condition prediction model is used for prediction. Through structured pruning and model fine-tuning, ventilation time, fumigation cycle and temperature and humidity are adjusted in advance.
It improved the accuracy of grain condition forecasting, reduced model complexity and computational resource consumption, improved operational efficiency, and reduced unnecessary computational resource consumption.
Smart Images

Figure CN120952268B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of grain storage management, and in particular to a grain condition prediction processing method and system based on a time sequence large model and a storage medium. BACKGROUND
[0002] In the field of grain storage, grain quality safety and storage cost control are core management goals, while mold growth and insect breeding in grain piles are two key problems affecting grain storage safety. With the development of storage technology, existing grain condition management has gradually shifted from traditional manual inspection to automated control mode.
[0003] Current grain stores generally use a sensor network and basic control architecture, and develop around a real-time monitoring and passive response mode, but the monitoring object is an existing environmental anomaly (such as temperature exceeding the standard, insect population increasing), rather than future risks. Mold growth and insect breeding in grain piles are gradual processes, for example, it takes 3-7 days for grain temperature to rise from the normal range to the mold growth threshold, and 1-2 weeks for insects to go from a small amount of activity to large-scale reproduction. When the monitoring data triggers the threshold, the grain quality has already suffered irreversible damage (such as local mold growth causing grain discoloration and reduced germination rate), and the loss cannot be recovered. Therefore, there is an urgent need for a grain condition prediction method to monitor and maintain grain stores. SUMMARY
[0004] (I) Technical problems to be solved
[0005] In view of the above-mentioned shortcomings and deficiencies of the prior art, the present application provides a grain condition prediction processing method and system based on a time sequence large model and a storage medium, which solves the technical problem that the sensor network and basic control architecture cannot predict future grain conditions, resulting in irreversible damage to grain quality when the monitoring data triggers the threshold, and further causing economic losses.
[0006] (II) Technical solutions
[0007] In order to achieve the above-mentioned purposes, the main technical solutions adopted by the present application include:
[0008] In a first aspect, the present application provides a grain condition prediction processing method based on a time sequence large model, comprising:
[0009] obtaining grain condition data of a grain store area to be predicted;
[0010] grain condition data of the to-be-predicted grain storage area is input into a pre-trained grain condition prediction model for prediction processing to obtain a grain condition prediction result of the to-be-predicted grain storage area, wherein the grain condition prediction model is trained based on a time sequence large model, and in the process of training the time sequence large model, the time sequence large model is subjected to structured pruning processing based on a pre-configured model training set, and the time sequence large model after structured pruning processing is fine-tuned according to historical grain condition data of any grain storage area in the model training set, and the model training set includes historical grain condition data of multiple different grain storage areas.
[0011] Based on the grain condition prediction result, the ventilation time, fumigation cycle and temperature and humidity of the to-be-predicted grain storage area are adjusted in advance.
[0012] Optionally, in a specific embodiment, the process of structured pruning processing of the time sequence large model includes:
[0013] determining a fully connected layer in the time sequence large model that needs to be pruned;
[0014] based on a pre-set low-rank dimension, inserting a first low-rank matrix and a second low-rank matrix into the fully connected layer that needs to be pruned to update the time sequence large model, wherein the dimension of the first low-rank matrix is input feature dimension x low-rank dimension, and the dimension of the second low-rank matrix is low-rank dimension x output feature dimension;
[0015] inputting the historical grain condition data of multiple different grain storage areas into the updated time sequence large model for training respectively, and obtaining an update gradient corresponding to the first low-rank matrix and an update gradient corresponding to the second low-rank matrix through a back propagation algorithm, and removing part of the model parameters in the time sequence large model based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix.
[0016] Optionally, in a specific embodiment, the first output relationship of the fully connected layer after the first low-rank matrix and the second low-rank matrix are inserted is updated to obtain the updated time sequence large model, wherein the first output relationship is the sum of a first product and a second product, the first product is the product of the input of the fully connected layer and the initial weight of the model, and the second product is the product of the first low-rank matrix and the second low-rank matrix.
[0017] Optionally, in a specific embodiment, when the historical grain condition data of multiple different grain storage areas is input into the updated time sequence large model for training respectively, the historical grain condition data of each grain storage area is divided into a training window to obtain short-term window data and long-term window data, wherein,
[0018] The short-term window data is input into the updated time sequence large model for training, and first and second gradients corresponding to the first and second low-rank matrices are obtained through a back propagation algorithm;
[0019] The first low-rank matrix is updated based on the first gradient to obtain a corresponding first incremental matrix, and the second low-rank matrix is updated based on the second gradient to obtain a corresponding second incremental matrix;
[0020] The first and second incremental matrices are inserted into the full connection layer that needs to be pruned to update the time sequence large model again;
[0021] The long-term window data is input into the time sequence large model updated again for training, and update gradients corresponding to the first and second low-rank matrices are obtained through a back propagation algorithm.
[0022] Optionally, in a specific embodiment, the input-output relationship of the full connection layer after the insertion of the first and second incremental matrices is updated to obtain the time sequence large model updated again, wherein the input-output relationship is the sum of the product of the first and second incremental matrices and the first output relationship.
[0023] Optionally, in a specific embodiment, part of the model parameters in the time sequence large model are pruned based on the update gradients corresponding to the first and second low-rank matrices, including:
[0024] The importance of each model parameter is determined based on the update gradients corresponding to the first and second low-rank matrices.
[0025] Based on the importance of each model parameter, a structured parameter group is constructed, and group importance calculation is performed on the structured parameter group, and model parameters with group importance lower than a pre-set importance threshold are pruned.
[0026] Optionally, in a specific embodiment, when the part of the model parameters are pruned, the model parameters in the four full connection layers in the attention layer are divided into a group according to the same function positioning head to construct a structured parameter group.
[0027] The model parameters in the three full connection layers in the FFN are divided according to the channels responsible for the same feature to construct a structured parameter group.
[0028] The importance of all model parameters in each structured parameter group is weighted and summed to obtain the corresponding group importance.
[0029] Optionally, in a specific embodiment, when the part of the model parameters is pruned, the model parameters in the attention layer and the FFN layer are respectively grouped based on the parameter types of all the parameters in the historical grain condition parameters, and the importance of all the model parameters in each group is weighted and summed to obtain the corresponding group importance.
[0030] In a second aspect, the embodiments of the present application provide a grain condition prediction processing system based on a time sequence large model, comprising a memory, a processor and a computer program stored on the memory, and the processor executes the computer program to realize the grain condition prediction processing method based on the time sequence large model.
[0031] In a third aspect, the embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to realize the grain condition prediction processing method based on the time sequence large model.
[0032] (Three) beneficial effects
[0033] The grain condition prediction method based on the time sequence large model provided by the present application trains the pre-trained general time sequence large model combined with the historical data of the grain storage area, so that the model can capture the time sequence characteristics and change rules of the grain condition data, thereby making the prediction of future grain condition data more accurate; the structured pruning process can remove the redundant parameters and channels in the general time sequence large model that are irrelevant to the grain condition prediction, reduce the complexity of the model, make the model more lightweight, improve the running efficiency, and at the same time reduce unnecessary consumption of computing resources. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 A grain condition prediction method flowchart based on a time sequence large model is provided for the embodiments of the present application.
[0035] Figure 2 A structured pruning process schematic diagram is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0036] In order to better explain the present application, so as to be understood, the present application is described in detail in the specific embodiments, combined with the drawings.
[0037] In the field of grain storage, guaranteeing grain quality safety and controlling storage cost are core goals, and mold growth and insect infestation of grain piles are the main threats to grain storage safety. At present, the grain depot has changed from manual inspection to automatic mode of sensor network + basic control, but this mode focuses on real-time monitoring and passive response, and can only act on the environmental abnormalities that have occurred (such as temperature exceeding the standard and insect infestation increasing), while mold growth and insect infestation are gradual processes (it takes 3-7 days for grain temperature to rise to the mold growth threshold, and 1-2 weeks for insect infestation to reproduce on a large scale), and by the time the threshold is triggered, the grain quality has been irreversibly damaged, so there is an urgent need for a grain condition prediction scheme.
[0038] The application provides a grain condition prediction method based on a time sequence large model. The method can accurately capture the time sequence characteristics and change rules of grain conditions by pre-training a general time sequence large model combined with historical data of a warehouse area, thereby improving the prediction accuracy of future grain conditions. Meanwhile, the method removes redundant parameters and channels through structured pruning, reduces the complexity of the model, realizes lightweight, improves the operation efficiency, and reduces the consumption of computing resources.
[0039] In order to better understand the above technical solutions, the exemplary embodiments of the application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the application are shown in the drawings, it should be understood that the application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a clearer, more thorough understanding of the application and to convey the complete scope of the application to those skilled in the art.
[0040] The application provides a grain condition prediction method based on a time sequence large model, as shown in Figure 1 The method comprises the following steps.
[0041] S1, obtaining grain condition data of a grain warehouse area to be predicted;
[0042] S2, inputting the grain condition data of the grain warehouse area to be predicted into a pre-trained grain condition prediction model for prediction processing to obtain a grain condition prediction result of the grain warehouse area to be predicted, wherein the grain condition prediction model is trained based on a time sequence large model, and in the process of training the time sequence large model, the time sequence large model is subjected to structured pruning processing based on a pre-configured model training set, and the time sequence large model after the structured pruning processing is subjected to model fine-tuning according to historical grain condition data of any grain warehouse area in the model training set. The model training set comprises historical grain condition data of multiple different grain warehouse areas.
[0043] S3, based on the grain condition prediction result, the ventilation time, the fumigation cycle and the temperature and humidity of the grain warehouse area to be predicted are adjusted in advance.
[0044] Optionally, the process of structured pruning processing of the time sequence large model comprises the following steps. Figure 2
[0045] S21, determining a full connection layer in the time sequence large model that needs to be pruned;
[0046] S22, based on a pre-set low rank dimension, inserting a first low rank matrix and a second low rank matrix into the full connection layer that needs to be pruned to update the time sequence large model, wherein the dimension of the first low rank matrix is input feature dimension x low rank dimension, and the dimension of the second low rank matrix is low rank dimension x output feature dimension.
[0047] S23, input the historical grain condition data of a plurality of different grain storage areas into the updated time sequence large model for training, and obtain an update gradient corresponding to the first low-rank matrix and an update gradient corresponding to the second low-rank matrix through a back propagation algorithm, and eliminate part of the model parameters in the time sequence large model based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix.
[0048] Further, the first output relationship of the full connection layer after inserting the first low-rank matrix and the second low-rank matrix is updated to obtain an updated time sequence large model, wherein the first output relationship is the sum of a first product and a second product, the first product is the product of the input of the full connection layer and the initial weight of the model, and the second product is the product of the first low-rank matrix and the second low-rank matrix.
[0049] Specifically, for the full connection layer that needs to be pruned in the time sequence large model, two low-rank matrices are inserted according to the pre-set low-rank dimension, the first low-rank matrix has a dimension of [input feature dimension x low-rank dimension], and the second low-rank matrix has a dimension of [low-rank dimension x output feature dimension];
[0050] Wherein, the low-rank dimension is much smaller than the original input / output feature dimension (such as reduced from 2048 to 64), and the increment change of the original high-rank weight is approximated through the product of the first low-rank matrix and the second low-rank matrix.
[0051] The input / output relationship of the full connection layer is reconstructed as follows:
[0052] ;
[0053] Wherein, O is the output of the full connection layer, is the pre-set initial weight, Y is the first low-rank matrix, E is the second low-rank matrix, Y·E is the low-rank matrix product. While the original model capability is retained, the parameter increment that can be learned is introduced through the low-rank matrix, and x is the input of the full connection layer.
[0054] The historical grain condition data is input into the updated model to calculate the first loss value (such as prediction error), and only the gradients of the low-rank matrices Y and E are updated through back propagation:
[0055] Wherein, the first gradient is: , that is, the gradient of the first low-rank matrix; and the second gradient is , that is, the gradient of the second low-rank matrix.
[0056] The initial weight is fixed during the calculation process, so that only the correlation in the task can be captured through the low-rank matrix.
[0057] Based on the gradient of the first low-rank matrix and the weight value to evaluate the importance of the model parameter, for example, by:
[0058] , ;
[0059] wherein, is the element of the i-th row and the j-th column of the first low-rank matrix, is the element of the i-th row and the j-th column of the second low-rank matrix, is the partial derivative of the first loss value L S to Y i,j , is the partial derivative of the first loss value to , Importance( ) is the importance of the element of the i-th row and the j-th column of the first low-rank matrix, and Importance( ) is the importance of the element of the i-th row and the j-th column of the second low-rank matrix.
[0060] The contribution of each parameter (including the initial weight and the low-rank matrix element) in the fully connected layer to the model output is comprehensively evaluated.
[0061] The importance threshold is set, and the parameters (such as the low-contribution weight element or the low-rank matrix element) below the threshold are removed. The pruned model weight is the sum of the initial weight and the product of the retained low-rank matrix: wherein, is the pruned model weight, is the pre-set initial weight, is the first low-rank matrix after parameter removal, is the second low-rank matrix after parameter removal.
[0062] The application reduces the parameter scale through low-rank matrix decomposition, and the calculation amount and storage demand of the pruned model are significantly reduced, which is suitable for deployment of grain depot edge devices. The fixed initial weight ensures the basic ability of the model, the low-rank matrix focuses on task-specific feature learning, and the pruning efficiency and prediction accuracy are balanced.
[0063] Further, the historical grain condition data is input into the updated time sequence large model to obtain the corresponding loss value, and through the back propagation algorithm, the first gradient corresponding to the first low-rank matrix and the second gradient corresponding to the second low-rank matrix are obtained, so as to obtain the importance of each model parameter in the time sequence large model based on the first gradient and the second gradient, including:
[0064] Based on the pre-set different scale sliding time window, any historical grain condition data is divided into short-term window data and long-term window data by training window division;
[0065] The short-term window data is input into the updated time sequence large model to obtain a corresponding first loss value, and through a back propagation algorithm, a first gradient corresponding to the first low-rank matrix and a second gradient corresponding to the second low-rank matrix are obtained;
[0066] The first low-rank matrix is updated based on the first gradient to obtain a corresponding first incremental matrix, and the second low-rank matrix is updated based on the second gradient to obtain a corresponding second incremental matrix;
[0067] The first incremental matrix and the second incremental matrix are inserted into all full connection layers in which the first low-rank matrix and the second low-rank matrix are inserted, and a second input-output relationship of the inserted full connection layer is updated; the second input-output relationship is a product of the first incremental matrix and the second incremental matrix, and a sum of the first output relationship;
[0068] The long-term window data is input into the second updated time sequence large model to obtain a corresponding second loss value, and through a back propagation algorithm, a third gradient corresponding to the first low-rank matrix and a fourth gradient corresponding to the second low-rank matrix are obtained, so as to obtain the importance of each model parameter in the time sequence large model based on the third gradient and the fourth gradient; the third gradient and the fourth gradient are calculated by fixing the initial weight, the first incremental matrix and the second incremental matrix which are not derivable.
[0069] Further, the input-output relationship of the full connection layer after the first incremental matrix and the second incremental matrix are inserted is updated to obtain the second updated time sequence large model, wherein the input-output relationship is a product of the first incremental matrix and the second incremental matrix and a sum of the first output relationship.
[0070] Specifically, in order to consider the short-term fluctuation characteristics (such as sudden rise of grain temperature in a day) and long-term trend characteristics (such as seasonal moldy period) of the grain condition data, a sliding time window division strategy is adopted:
[0071] The short-term window data usually contains high-frequency sampling data (such as 1-hour / once grain temperature and humidity records) in recent days to a week, and focuses on capturing short-term sudden changes (such as rapid decline of grain temperature after ventilation and short-term active of insect pests); the long-term window data covers low-frequency sampling data (such as 1-day / once statistical value) in several weeks to several months, and focuses on extracting long-term trends (such as overall rise of grain temperature in summer and periodic fluctuation of humidity in rainy season).
[0072] The core value of double-window division lies in that, through data training of different time scales, the model parameter importance evaluation covers both short-term response ability and long-term prediction ability, avoiding evaluation deviation caused by single window.
[0073] Based on short-term window data training model, generate incremental matrix through gradient calculation, realize preliminary optimization of low-rank matrix:
[0074] Input short-term window data into the time series large model of low-rank matrix, get the difference between predicted value and true value (first loss value, such as risk weighted mean square error), which reflects the prediction accuracy of the model on short-term grain situation fluctuation; through back propagation algorithm, calculate the first gradient of the first low-rank matrix (Y) and the second gradient of the second low-rank matrix (E), the greater the absolute value of the gradient, the more significant the influence of the corresponding low-rank matrix element on short-term prediction accuracy.
[0075] Based on preset learning rate (η) and gradient descent method, update low-rank matrix to get incremental matrix: first incremental matrix (△Y): , second incremental matrix (△E): , where η is the learning rate, is the first gradient, is the second gradient, and the learning rate is used to control the update amplitude (such as 1e-4 in grain situation scenario), and the negative sign indicates adjustment along the loss reduction direction.
[0076] The second input-output relationship of the full connection layer is adjusted as:
[0077] That is, on the basis of the product of the initial weight and the original low-rank matrix, the product of the incremental matrix is added, so that the model can adapt to the change of short-term grain situation characteristics.
[0078] Based on the model after updating the incremental matrix, train through long-term window data, calculate the third / fourth gradient, and finally determine the parameter importance:
[0079] Input long-term window data into the model of incremental matrix, get the second loss value (such as time series trend weighted loss), which reflects the prediction accuracy of the model on long-term grain situation trend; calculate the gradient through back propagation, but the following parameters cannot be derived: initial weight (used to ensure that the basic ability of the pre-trained model is not disturbed), first / second incremental matrix (used to avoid the influence of short-term optimization results on long-term feature learning). Finally, the third gradient of the first low-rank matrix ( ) and the fourth gradient of the second low-rank matrix ( ) are obtained, where is the second loss value, is the third gradient, is the fourth gradient.
[0080] The importance of each parameter is evaluated by integrating the third / fourth gradient and the element value of the low-rank matrix, as follows: , wherein, is the element of the i-th row and j-th column in the first low-rank matrix, is the element of the i-th row and j-th column in the second low-rank matrix, is the second loss value is the partial derivative of , is the second loss value is the partial derivative of , and Importance( ) is the importance of the element of the i-th row and j-th column in the first low-rank matrix, and Importance( ) is the importance of the element of the i-th row and j-th column in the second low-rank matrix.
[0081] The higher the importance, the greater the contribution of the parameter to the long-term grain condition trend prediction, and the parameter should be retained first during pruning.
[0082] The embodiments of the present application optimize the response ability of the short-term window model to sudden grain conditions, focus on trend capture in the long-term window, make the parameter importance evaluation more comprehensive, and ensure that the long-term gradient calculation only reflects the contribution of the low-rank matrix to the core features by fixing the initial weight and the incremental matrix, avoiding noise interference. The gradient update strategy makes the low-rank matrix adaptive to the time-varying characteristics of the grain condition data, balancing the flexibility and stability of the model.
[0083] Optionally, in a specific embodiment, the part of the model parameters in the time series large model is pruned based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix, including:
[0084] The importance of each model parameter is determined based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix.
[0085] Based on the importance of each model parameter, a structured parameter group is constructed, and group importance calculation is performed on the structured parameter group, and model parameters with group importance lower than a pre-set importance threshold are pruned.
[0086] Further, when the part of the model parameters is pruned, the model parameters in the four fully connected layers in the attention layer are divided into a group according to the head with the same function positioning, so as to construct a structured parameter group.
[0087] The model parameters in the three fully connected layers in the FFN are divided according to the channels responsible for the same feature to construct a structured parameter group;
[0088] The importance of all model parameters in each structured parameter group is weighted and summed to obtain the corresponding group importance.
[0089] Further, when the part of the model parameters is removed, the model parameters in the attention layer and the FFN layer are respectively grouped based on the parameter types of all parameters in the historical grain condition parameters, and the importance of all model parameters in each group is weighted and summed to obtain the corresponding group importance.
[0090] Specifically, for the two core components of the time series large model (attention layer and FFN layer), the parameter groups are constructed according to the functional positioning consistency and feature correlation principle, ensuring that each group of parameters assumes an independent and complete functional module:
[0091] The attention layer captures the correlation of features in different dimensions (such as the coupling relationship between grain temperature and humidity, the correlation between insect pests and The grouping rule is as follows: the allocation object is the four fully connected layers in the Query (query), Key (key), Value (value), and Out (output) of the attention layer; the grouping standard is to divide the heads with the same functional positioning in the four fully connected layers into a group. For example, the 3rd head is responsible for generating the query vector of the grain temperature feature in the Query layer, generating the key vector of the grain temperature feature in the Key layer, generating the value vector of the grain temperature feature in the Value layer, and integrating the attention output of the grain temperature feature in the Out layer. The parameters of these four heads together constitute the grain temperature feature attention group; the group parameters are composed of all parameters of the four sub-modules Query_head_i, Key_head_i, Value_head_i, and Out_head_i in each group, ensuring that the group can independently complete the attention calculation of a certain feature dimension.
[0092] The feedforward network (FFN) realizes feature enhancement through channel conversion (e.g., mapping the original grain condition features to a high-dimensional space and then compressing them), and the grouping rules are as follows: the grouping objects are the Gate (gate), Up (dimension up), and Down (dimension down) three fully connected layers in the FFN layer; and the grouping standard is to divide the channels responsible for the same feature processing in the three fully connected layers into a group. For example, the 5th channel controls the activation strength of the pest feature in the Gate layer, is responsible for the high-dimensional mapping of the pest feature in the Up layer, and is responsible for the low-dimensional output of the pest feature in the Down layer. The parameters of these three channels jointly constitute the pest feature FFN group; the group parameter structure includes all parameters of the three submodules Gate_channel_j, Up_channel_j, and Down_channel_j in each group, ensuring that the group can independently complete the full connection conversion of a certain feature.
[0093] The core value of the grouping itself is to avoid random pruning from damaging the integrity of the model functional modules (e.g., removing Query_head_i alone while retaining Key_head_i will cause attention calculation to fail), and structured grouping ensures that the remaining parameters after pruning can still form a complete functional unit.
[0094] After the parameter group is constructed, the overall importance of each group to the model prediction needs to be quantified, and the calculation logic is as follows:
[0095] Single-parameter importance collection: extract the importance values of all model parameters in the group (calculated by multiplying the gradient and parameter value in the previous section);
[0096] Weighted summation rule: weight allocation, allocate weights according to the functional priority of parameters in the group, for example, the parameter weight of Out_head (0.3) in the attention layer is higher than Query_head (0.25), Key_head (0.25), and Value_head (0.2). Since the Out layer is responsible for attention result integration, it has a greater impact on the output, and the summation is performed.
[0097] According to the model compression target (e.g., reducing the parameter size by 50%) and the prediction accuracy constraint (e.g., the grain temperature prediction MAE is not more than 0.5°C), a preset group importance threshold (e.g., 0.3) is set;
[0098] Pruning execution: remove all parameter groups whose group importance is lower than the threshold, for example:
[0099] If the group importance of the low-frequency feature attention group is 0.2 (<0.3), it means that the contribution of this group to the grain condition prediction is limited, and the corresponding head parameters of the Query, Key, Value, and Out layers included in this group can be removed as a whole;
[0100] If the group importance of the redundant environmental feature FFN group is 0.15 (<0.3), the corresponding channel parameters of the Gate, Up and Down layers are removed as a whole;
[0101] The remaining parameter groups still maintain the complete attention calculation and FFN conversion functions, ensuring that the model can normally output grain condition prediction results, and only the function modules with less impact on prediction accuracy are removed.
[0102] The embodiments provided in the application avoid model function rupture caused by pruning by grouping according to functions, solve the problem of sudden drop in model performance after traditional random pruning, and perform screening and removal in groups, reducing the calculation amount of parameter-by-parameter judgment, and adapting to the high-efficiency pruning demand of large models.
[0103] Optionally, in a specific embodiment, based on the importance of each model parameter, structured parameter groups are constructed and group importance is calculated, and the group importance lower than the pre-set importance threshold is removed, including:
[0104] Based on the parameter types of all parameters in the historical grain condition parameters, the model parameters in the attention layer and the FFN layer are grouped respectively to construct structured parameter groups;
[0105] The importance of all model parameters in each structured parameter group is weighted and summed to obtain the corresponding group importance, and the group importance lower than the pre-set importance threshold is removed.
[0106] The embodiments take the parameter types in the historical grain condition data as the grouping basis, directly associate the model parameters with the actual monitoring indicators, and ensure that each group of parameters is specially served for a specific type of grain condition feature, and the grouping logic is as follows:
[0107] The attention layer is responsible for capturing the association between different grain condition parameters (such as the correlation between grain temperature and humidity, the association between concentration and insect pests), and the grouping rule is:
[0108] The grouping basis is the type of historical grain condition parameters (such as grain temperature, humidity, concentration, insect index, grain moisture, etc.); the grouping manner is to divide all heads in the attention layer specially processing a type of parameter and the corresponding fully connected layer parameters into a group, for example, the insect parameter group includes all attention hand parameters for capturing the activity rule of insect pests, the association between insect pests and concentration.
[0109] Each group of parameters directly corresponds to a grain condition indicator with clear physical meaning, and the importance reflects the contribution of the indicator to the overall prediction.
[0110] The FFN layer is responsible for feature enhancement of a single grain condition parameter (e.g., mapping the original grain temperature data to a temperature change rate, a temperature and humidity coupling feature, and other advanced features).
[0111] The present embodiment directly binds the model parameters to the physical indicators of grain condition monitoring, and the pruning decision has higher interpretability (e.g., eliminating the light outside the warehouse group because the parameter has a weak influence on the internal changes of the grain pile), and is more consistent with the business cognition of the warehouse management personnel.
[0112] Optionally, in a specific embodiment, the future grain condition data includes: predicted surface grain temperature, predicted bottom grain temperature, predicted humidity, predicted insect index, predicted outside temperature, predicted inside temperature, predicted dew point difference, predicted grain temperature, and predicted weather;
[0113] Based on the future grain condition data, the future ventilation time, fumigation cycle, refrigeration and dehumidification strategy of the to-be-predicted grain warehouse area are planned, including:
[0114] When the difference between the predicted surface grain temperature and the predicted bottom grain temperature is greater than 4°C, and the predicted dew point difference is less than 3°C, start the night forced ventilation;
[0115] When the difference between the predicted outside temperature and the predicted inside temperature is greater than 5 degrees Celsius, and the predicted humidity is less than 65%, start the downward ventilation;
[0116] When the predicted insect index is greater than 0.8, the predicted inside temperature is 18-30°C, and the indoor grain concentration is less than 3000 ppm, release low-concentration phosphine;
[0117] When the predicted insect index is greater than 0.8, the predicted inside temperature is 18-30°C, and the indoor grain concentration is greater than 3000 ppm, start high-concentration fumigation;
[0118] When the predicted outside temperature is greater than 30°C, and the predicted grain temperature is less than or equal to 20°C, start the grain cooler;
[0119] When the predicted weather is a cold wave, and the predicted grain temperature is less than or equal to 5°C, use natural temperature difference ventilation.
[0120] Specifically, ventilation control: predicted surface grain temperature > bottom grain temperature + 4°C, and dew point difference < 3°C, start night forced ventilation (22:00-6:00), predicted whole warehouse temperature difference > 5°C, and humidity < 65%, start downward ventilation, and adjust the fan speed.
[0121] Fumigation and insect killing: predicted insect index > 0.8, and temperature predicted value 18-30°C & predicted value < 3000 ppm, release low-concentration phosphine; predicted insect index > 0.8, and temperature predicted value 18-30°C & predicted value ≥ 3000 ppm, start high-concentration fumigation.
[0122] Temperature and humidity control: if the predicted outside temperature is greater than 30 DEG C and the target grain temperature is less than or equal to 20 DEG C, start the grain cooler; if the predicted cold wave weather and the target grain temperature is less than or equal to 5 DEG C, use natural temperature difference ventilation; if the predicted temperature difference of the grain pile is greater than or equal to 8 DEG C / 24h, stop ventilation and start local bin turning.
[0123] The predicted values (temperature, grain pile, environment, humidity, Concentration, insect activity index) are used as input models for preventive control.
[0124] The application provides a grain condition prediction method based on a time sequence large model. The time sequence large model is pre-trained and combined with historical data in a library area for training, so that the time sequence characteristics and change rules of the grain condition can be accurately captured, and the prediction accuracy of the future grain condition can be improved. Meanwhile, redundant parameters and channels are removed through structured pruning, so that the model complexity is reduced, the model is lightened, the operation efficiency is improved, and the consumption of computing resources is reduced.
[0125] In addition, the application provides a grain condition prediction system based on a time sequence large model, which includes a memory, a processor and a computer program stored in the memory. The processor executes the computer program to implement the above-mentioned grain condition prediction method based on a time sequence large model.
[0126] In addition, the application provides a computer readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned grain condition prediction method based on a time sequence large model is implemented.
[0127] In the description of the application, it should be understood that the terms "first", "second" are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features limited by "first" and "second" can explicitly or implicitly include one or more features. In the description of the application, the meaning of "multiple" is two or more, unless otherwise specifically limited.
[0128] In the present application, unless otherwise specifically defined and limited, the terms "installation", "connection", "connection", "fixation" and the like should be understood in a broad sense, for example, it can be fixed connection, or detachable connection, or integrated; it can be mechanical connection, or electrical connection; it can be directly connected, or indirectly connected through an intermediate medium; it can be the internal communication of two elements or the interaction relationship between two elements. For those skilled in the art, the specific meaning of the above terms in the present application can be understood according to the specific circumstances.
[0129] In the present application, unless specifically defined and limited otherwise, the first feature is "on" or "under" the second feature, which can be that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, the first feature is "over", "above" and "on top of" the second feature, which can be that the first feature is directly above or obliquely above the second feature, or only indicates that the first feature is higher than the second feature in horizontal height. The first feature is "under", "below" and "underneath" the second feature, which can be that the first feature is directly below or obliquely below the second feature, or only indicates that the first feature is lower than the second feature in horizontal height.
[0130] In the description of the present application, the description of the terms "one embodiment", "some embodiments", "embodiment", "example", "specific example" or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are contained in at least one embodiment or example of the present application. In the present application, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present application and the features of the different embodiments or examples without contradiction.
[0131] Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and cannot be construed as limiting the present application, and the person skilled in the art can modify, modify, replace and modify the above embodiments within the scope of the present application.
Claims
1. A grain condition prediction processing method based on a timing large model, characterized by, The method comprises the following steps: acquiring grain condition data of a grain depot to be predicted; inputting the grain condition data of the grain depot to be predicted into a pre-trained grain condition prediction model for prediction processing to obtain a grain condition prediction result of the grain depot to be predicted, wherein the grain condition prediction model is trained based on a time sequence large model, and in the process of training the time sequence large model, the time sequence large model is subjected to structured pruning processing based on a pre-configured model training set, and the time sequence large model after the structured pruning processing is fine-tuned according to historical grain condition data of any grain depot in the model training set, and the model training set comprises historical grain condition data of multiple different grain depots; based on the grain condition prediction result, the ventilation time, fumigation cycle and temperature and humidity of the grain depot to be predicted are adjusted in advance; the process of structured pruning processing of the time sequence large model comprises the following steps: determining a fully connected layer in the time sequence large model that needs to be subjected to pruning processing; based on a pre-set low-rank dimension, a first low-rank matrix and a second low-rank matrix are inserted into the fully connected layer that needs to be subjected to pruning processing to update the time sequence large model, wherein the dimension of the first low-rank matrix is input feature dimension x low-rank dimension, and the dimension of the second low-rank matrix is low-rank dimension x output feature dimension; the historical grain condition data of multiple different grain depots are input into the updated time sequence large model for training, and through a back propagation algorithm, an update gradient corresponding to the first low-rank matrix and an update gradient corresponding to the second low-rank matrix are obtained, and part of the model parameters in the time sequence large model are removed based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix.
2. The method according to claim 1, wherein, by updating a first output relationship of the fully connected layer after the first low-rank matrix and the second low-rank matrix are inserted, an updated time sequence large model is obtained, wherein the first output relationship is a sum of a first product and a second product, the first product is a product of the input of the fully connected layer and the initial weight of the model, and the second product is a product of the first low-rank matrix and the second low-rank matrix.
3. The grain condition prediction processing method based on a timing large model according to claim 2, characterized in that, when the historical grain condition data of multiple different grain depots are input into the updated time sequence large model for training, the historical grain condition data of each grain depot is divided into a training window to obtain short-term window data and long-term window data, wherein the short-term window data are input into the updated time sequence large model for training, and through a back propagation algorithm, a first gradient corresponding to the first low-rank matrix and a second gradient corresponding to the second low-rank matrix are obtained; based on the first gradient, the first low-rank matrix is updated to obtain a corresponding first incremental matrix, and based on the second gradient, the second low-rank matrix is updated to obtain a corresponding second incremental matrix; the first incremental matrix and the second incremental matrix are inserted into the fully connected layer that needs to be subjected to pruning processing to update the time sequence large model for a second time; the long-term window data are input into the time sequence large model updated for the second time for training, and through a back propagation algorithm, an update gradient corresponding to the first low-rank matrix and an update gradient corresponding to the second low-rank matrix are obtained.
4. The grain condition prediction processing method based on a timing large model according to claim 3, characterized in that, The input-output relationship of the full connection layer after the first incremental matrix and the second incremental matrix are inserted is updated to obtain a second updated time sequence large model, wherein the input-output relationship is a sum of the product of the first incremental matrix and the second incremental matrix and the first output relationship.
5. The method according to any one of claims 2-4, wherein, Based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix, the part of model parameters in the time sequence large model is pruned, including: Based on the update gradient corresponding to the first low-rank matrix and the update gradient corresponding to the second low-rank matrix, the importance of each model parameter is determined. Based on the importance of each model parameter, a structured parameter group is constructed, and group importance calculation is performed on the structured parameter group, and the model parameters with group importance lower than the pre-set importance threshold are pruned.
6. The grain condition prediction processing method based on a timing large model according to claim 5, characterized in that, When the part of model parameters is pruned, the model parameters in the four full connection layers in the attention layer are divided into a group according to the head with the same function positioning, so as to construct a structured parameter group. The model parameters in the three full connection layers in the FFN are divided according to the channel responsible for the same feature, so as to construct a structured parameter group. The importance of all model parameters in each structured parameter group is weighted and summed to obtain the corresponding group importance.
7. The grain condition prediction processing method based on a timing large model according to claim 5, characterized in that, When the part of model parameters is pruned, based on the parameter type of all parameters in the historical grain condition parameters, the model parameters in the attention layer and the FFN layer are respectively grouped, and the importance of all model parameters in each group is weighted and summed to obtain the corresponding group importance.
8. A grain condition prediction processing system based on a timing large model, comprising a memory, a processor and a computer program stored on the memory, characterized in that, The processor executes the computer program to realize the grain condition prediction processing method based on the time sequence large model in any one of claims 1-7.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the grain condition prediction processing method based on the time sequence large model in any one of claims 1-7.
Citation Information
Patent Citations
Grain storage ventilation temperature prediction method for optimizing CNN-BiGRU-Attention network model based on IPSO algorithm
CN116720620A
Complex dynamic system multi-task model fine tuning method based on low-rank adaptation and token pruning
CN118643876A