Crop disease and pest data prediction method and device, electronic equipment and storage medium

By decomposing historical time sequences into seasonal and trend sequences, and extracting relevant vectors for cross -attention prediction, the problem of high hardware equipment memory and computing power requirements in existing technologies has been solved. Pests and insect pest data prediction.

CN119357764APending Publication Date: 2025-01-24NINGBO LVHE TIMES TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411223454.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

In the prior art, the memory space and computing power required for pest and disease data prediction are high, and it is difficult to meet the needs of hardware devices with lower performance.

Method used

By decomposing historical time sequences into seasonal sequences and trend sequences, it is divided into multiple sub -sequences to extract the query vector, key vector, and value vector. Complex.

Benefits of technology

This method greatly reduces the requirements for pest and disease prediction on the memory space and computing power of hardware devices, can be run on hardware devices with lower performance, reduces hardware costs, and improves the accuracy of predictions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119357764A_ABST
    Figure CN119357764A_ABST
Patent Text Reader

Abstract

The invention provides a crop disease and insect pest data prediction method and device, electronic equipment and a storage medium, and relates to the technical field of agriculture, the crop disease and insect pest data prediction method comprises the following steps: decomposing a historical time sequence to obtain a seasonal sequence and a trend sequence; dividing the seasonal sequence into N1 seasonal subsequences, and extracting query vectors from the N1 seasonal subsequences to obtain a query vector set; dividing the trend sequence into N2 trend subsequences, and extracting key vectors and value vectors from the N2 trend subsequences to obtain a key vector set and a value vector set; and predicting a target time sequence according to the query vector set, the key vector set and the value vector set. According to the invention, the requirements of pest and disease prediction on the memory space and computing power of hardware equipment are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of agricultural technology, and in particular to a method, device, electronic equipment and storage medium for predicting crop disease and insect pest data. Background Art

[0002] In modern agricultural production, pest and disease prevention is a key link to ensure the healthy growth of crops and high and stable yields. The importance of pest and disease data prediction is self-evident. It can help agricultural producers understand the occurrence trend of pests and diseases in a timely manner and take effective prevention and control measures in advance, thereby reducing economic losses and protecting the ecological environment. Through accurate prediction, not only can the use of chemical pesticides be reduced and environmental pollution be reduced, but also the quality of agricultural products can be improved and market competitiveness can be enhanced.

[0003] In related technologies, deep models used for disease and insect pest data prediction usually adopt an encoder-decoder architecture. Although the deep model of the encoder-decoder architecture performs well in many tasks, the encoder and decoder are usually composed of multi-layer neural networks, contain a large number of parameters and are highly complex, which leads to large memory usage and high computing power requirements for hardware devices. Summary of the invention

[0004] The problem solved by the present invention is how to reduce the requirements of pest prediction on the memory space and computing power of hardware devices.

[0005] In order to solve the above problems, the present invention provides a method, device, electronic device and storage medium for predicting crop disease and insect pest data.

[0006] In a first aspect, the present invention provides a method for predicting crop pest and disease data, comprising:

[0007] Decomposing the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of data on plant diseases and insect pests in the target area during the historical period arranged in chronological order;

[0008] Divide the seasonal sequence into N1 seasonal subsequences, extract query vectors from the N1 seasonal subsequences respectively, and obtain a query vector set;

[0009] Divide the trend sequence into N2 trend subsequences, extract key vectors and value vectors from the N2 trend subsequences respectively, and obtain a key vector set and a value vector set;

[0010] A target time series is predicted based on the query vector set, the key vector set, and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

[0011] Optionally, predicting the target time series based on the query vector set, the key vector set and the value vector set includes: determining an attention output sequence based on the query vector set, the key vector set and the value vector set; and determining the sum of the attention output sequence and the trend sequence as the target time series.

[0012] Optionally, determining the attention output sequence according to the query vector set, the key vector set, and the value vector set includes: for each query vector in the query vector set, performing a first operation to obtain N1 attention output vectors; concatenating the N1 attention output vectors to obtain the attention output sequence;

[0013] The query vector when performing the first operation is the current query vector, and the first operation includes: starting from j=1, loopingly performing the second operation until j is greater than N2, and stopping the second operation to obtain N2 first vectors; superimposing the N2 first vectors to obtain the attention output vector corresponding to the current query vector;

[0014] The second operation includes: obtaining the jth vector combination, wherein the jth vector combination includes the jth key vector in the key vector set and the jth value vector in the value vector set; determining the jth first vector among N2 first vectors according to the jth vector combination and the current query vector; and executing j+1.

[0015] Optionally, determining the jth first vector among N2 first vectors based on the jth vector combination and the current query vector includes: determining the similarity between the jth key vector and the current query vector to obtain the jth attention score; normalizing the jth attention score to obtain the jth attention weight matrix; weighting the jth value vector according to the jth attention weight matrix to obtain the jth first vector.

[0016] Optionally, decomposing the historical time series to obtain a seasonal sequence and a trend sequence includes: performing a filling operation on the historical time series to obtain a first sequence; performing an average pooling operation on the first sequence to obtain the trend sequence; and determining the seasonal sequence based on the trend sequence and the historical time series.

[0017] Optionally, determining the seasonal sequence according to the trend sequence and the historical time series includes: determining the seasonal sequence by a sequence obtained by subtracting the trend sequence from the historical time series.

[0018] Optionally, dividing the seasonal sequence into N1 seasonal subsequences includes: inputting the seasonal sequence into a feedforward neural network layer, performing a nonlinear transformation on the seasonal sequence through the feedforward neural network layer to obtain a feedforward output sequence; and performing segmentation processing on the feedforward output sequence to obtain N1 seasonal subsequences.

[0019] In a second aspect, the present invention provides a crop pest data prediction device, comprising:

[0020] A decomposition module is used to decompose the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of pest and disease data of crops in the target area within a historical period arranged in chronological order;

[0021] A first extraction module is used to divide the seasonal sequence into N1 seasonal subsequences, and extract query vectors from the N1 seasonal subsequences respectively to obtain a query vector set;

[0022] A second extraction module is used to divide the trend sequence into N2 trend subsequences, and extract key vectors and value vectors from the N2 trend subsequences respectively to obtain a key vector set and a value vector set;

[0023] A prediction module is used to predict a target time series based on the query vector set, the key vector set and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

[0024] In a third aspect, the present invention provides an electronic device, including a memory and a processor;

[0025] The memory is used to store computer programs;

[0026] The processor is used to implement the crop disease and insect pest data prediction method as described in the first aspect when executing the computer program.

[0027] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the crop disease and insect pest data prediction method as described in the first aspect is implemented.

[0028] The beneficial effects of the crop disease and insect pest data prediction method, device, electronic device and storage medium of the present invention are as follows: first, the crop disease and insect pest data of the historical time period is taken as the historical time series, for example, the crop disease and insect pest data in the past seven days (such as the number of specific pests and diseases appearing in the target area, or the area of ​​crops infested by pests and diseases in the target area), the historical time series is decomposed into a seasonal series and a trend series, the seasonal series is divided into N1 seasonal subsequences, the trend series is divided into N2 trend subsequences, the length of the seasonal subsequence obtained after the division is less than the seasonal series and the length of the trend subsequence obtained after the division is less than the trend series, so that the amount of calculation in the subsequent process of extracting the query vector, the key vector and the value vector is greatly reduced, and the query vector set is extracted from the N1 seasonal subsequences and the value vector is extracted from the N2 trend subsequences. To the key vector set and the value vector set, the query vector set and the key vector set and the value vector set are sets from two different sequences. Predicting the target time series based on the query vector set, the key vector set and the value vector set establishes a more flexible connection between different sequences, improves the sequence crossover capability, and helps to reduce the risk of overfitting. The present invention abandons the encoder-decoder architecture, divides the historical time series into a seasonal sequence and a trend sequence, and extracts the query vector set, the key vector set and the value vector by segmenting the seasonal sequence and the trend sequence. The target time series is predicted based on the three sets, which greatly reduces the number of parameters and complexity in the prediction process, thereby reducing the occupation of hardware device memory space and the requirements for the computing power of the hardware device for pest and disease prediction, can be applied to hardware devices with lower performance, and reduces hardware costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A schematic diagram of a process flow of a crop disease and insect pest data prediction method according to an embodiment of the present invention;

[0030] Figure 2 A schematic diagram of a cross-attention mechanism according to an embodiment of the present invention;

[0031] Figure 3 A schematic diagram of a crop disease and insect pest data prediction model according to an embodiment of the present invention;

[0032] Figure 4This is a schematic diagram of the structure of a device for predicting crop pest and disease data according to an embodiment of the present invention;

[0033] Figure 5 The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0034] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be interpreted as being limited to the embodiments described herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.

[0035] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0036] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to"; the term "based on" means "based at least in part on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0037] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0038] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.

[0039] In view of the problems existing in the above-mentioned related technologies, this embodiment provides a method, device, electronic device and storage medium for predicting crop disease and insect pest data.

[0040] like Figure 1As shown, a crop pest data prediction method provided by an embodiment of the present invention includes:

[0041] S100, decomposing the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of plant disease and insect pest data of crops in a target area within a historical period arranged in chronological order.

[0042] Specifically, to predict the pest and disease data of crops in the target area, firstly, the pest and disease data of crops in the target area are continuously collected during the historical time period, and the pest and disease data collected during the historical time period are arranged in chronological order, and the formed series is recorded as the historical time series.

[0043] A time series can contain multiple components, including trend series and seasonal series. The trend series reflects the overall change direction and speed of the time series in the long term, and describes the trend of the data rising, falling or remaining stable over time. The seasonal series reflects the repetitive pattern of the time series at fixed time intervals. The seasonal pattern usually has a fixed cycle length, and the data repeats in each cycle.

[0044] When analyzing historical time series to predict pest and disease data in future time periods to obtain the target time series, these components are separated from the original data, namely the historical time series, to obtain trend series and seasonal series, so as to better understand the dynamic characteristics of the historical time series and make effective predictions.

[0045] S200, dividing the seasonal sequence into N1 seasonal subsequences, respectively extracting query vectors from the N1 seasonal subsequences to obtain a query vector set.

[0046] Specifically, the seasonal sequence is segmented to obtain N1 seasonal subsequences, and a query vector is extracted from each seasonal subsequence. Therefore, the query vector set includes N1 query vectors, that is, the query vectors in the query vector set correspond one-to-one to the seasonal subsequences in the N1 seasonal subsequences.

[0047] For any seasonal subsequence, its corresponding query vector is obtained by the following formula:

[0048] Q i =X Si W Q

[0049] Among them, X Si is the ith seasonal sequence among the N1 seasonal subsequences, Q i is the query vector corresponding to the ith seasonal subsequence, WQ Extract the matrix for the query vector, i=1, 2, ... N1, N1 is an integer greater than 1.

[0050] S300, dividing the trend sequence into N2 trend subsequences, respectively extracting key vectors and value vectors from the N2 trend subsequences to obtain a key vector set and a value vector set;

[0051] Specifically, the trend sequence is segmented to obtain N1 trend sub-sequences, wherein a key vector and a value vector are extracted from each trend sub-sequence respectively. Therefore, the key vector set includes N2 key vectors, that is, the key vectors in the key vector set correspond one-to-one to the trend sub-sequences in the N2 trend sub-sequences, and the value vector set includes N2 value vectors, that is, the value vectors in the value vector set correspond one-to-one to the trend sub-sequences in the N2 trend sub-sequences, and the value vectors in the value vector set correspond one-to-one to the key vectors in the key vector set.

[0052] Among them, for any trend subsequence, its corresponding key vector is obtained by the following formula:

[0053] K j =X Sj W K

[0054] Among them, X Sj is the jth trend sequence among the N2 trend subsequences, K j is the key vector corresponding to the j-th trend subsequence, W Q Extract the matrix for the key vector, j=1, 2, ... N2, where N2 is an integer greater than 1.

[0055] For any trend subsequence, its corresponding value vector is obtained by the following formula:

[0056] V j =X Sj W V

[0057] Among them, X Sj is the jth trend sequence among the N2 trend subsequences, V j is the value vector corresponding to the jth trend subsequence, W V Extract the matrix for the value vector, j=1, 2, ... N2, N2 is an integer greater than 1.

[0058] S400, predicting a target time series based on the query vector set, the key vector set, and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

[0059] Specifically, the pest data may specifically refer to the number of specific pests and diseases that appear in the target area within each minimum time unit, or the area of ​​crops infested by pests and diseases in the target area. The time interval between the historical time period and the future time period is less than the first preset time length, so that the historical data that is closer in time scale is used to predict the future pest and disease data, and the use of historical data with a time interval that is too long leads to a decrease in the accuracy of the prediction result. The first preset time length and the second preset time length are smaller preset values. For example, the first preset time length can be 1 day, 2 days, and the second preset time length can be 5 days, 6 days, 7 days, etc.

[0060] Taking the example that the length of the historical time period and the future time period are both 5 days, the historical time series includes the pest and disease data in each minimum time unit (such as daily or half a day) in the past five days. By decomposing the historical time series and segmenting the decomposed sequence to extract the query vector set, key vector set and value vector set, the pest and disease data in the next 5 days is predicted. At this time, the time interval between the historical time period and the future time period is one day.

[0061] The query vector, key vector, and value vector are the core components of the self-attention mechanism. The query vector and key vector are used to calculate the attention score, which reflects the importance of the elements in the sequence to the current element. Finally, the attention weight is obtained. According to the attention weight and the value vector, the predicted time series is obtained. A time series, i.e., the target time series, is determined according to the query vector set, the key vector set, and the value vector set. The target time series is the predicted pest and disease data of crops in the target area in the future time period. It should be noted that in step S400, the query vector, key vector, and value vector corresponding to the same sequence are not used to determine a new sequence. The query vector set and the key vector set in the above-mentioned target time series are not from the same sequence, and the query vector set and the value vector set are not from the same sequence. The target time series is determined according to the query vector set corresponding to the seasonal sequence and the key vector set and value vector set corresponding to the trend sequence.

[0062] It should be noted that the duration of the historical time period and the future time period may be equal or unequal. Pest and disease data may be related to influencing factors such as temperature, humidity, precipitation and soil conditions. Since the data related to the influencing factors of the same target area in a short period of time usually does not change significantly, short-term predictions can be made based on historical time series. Further, considering that weather data such as temperature, humidity, precipitation, etc. may change significantly in a short period of time, while soil conditions (such as pH value) will not change significantly in a short period of time, the pest and disease data prediction method of this embodiment can be mainly used to predict the development of pests and diseases when the weather data does not change much (for example, the temperature difference in the same period is less than a preset threshold, the precipitation is less than a preset rainfall, etc.), that is, it is mainly used to predict pest and disease data in the future time period when the weather does not change significantly.

[0063] In an embodiment, crop disease and insect pest data of a historical time period is first used as a historical time series. For example, crop disease and insect pest data of the past seven days (such as the number of specific diseases and insect pests appearing in a target area, or the area of ​​crops infested by diseases and insect pests in a target area) is used to decompose the historical time series into a seasonal series and a trend series. The seasonal series is divided into N1 seasonal subsequences, and the trend series is divided into N2 trend subsequences. The length of the seasonal subsequences obtained after the division is smaller than the seasonal sequence, and the length of the trend subsequences obtained after the division is smaller than the trend sequence, so that the amount of calculation in the subsequent process of extracting query vectors, key vectors, and value vectors is greatly reduced. A query vector set is extracted from the N1 seasonal subsequences, and a key vector set and a value vector set are extracted from the N2 trend subsequences. The query vector set, the key vector set, and the value vector set are sets from two different sequences. The target time is predicted according to the query vector set, the key vector set, and the value vector set. The sequence establishes a more flexible connection between different sequences, improves the sequence cross-capability, and helps to reduce the risk of overfitting. The present invention abandons the encoder-decoder architecture, divides the historical time series into seasonal sequences and trend sequences, and divides the seasonal sequences and trend sequences into segmented processing to extract query vector sets, key vector sets and value vectors, and predicts the target time series according to the three sets, which greatly reduces the number of parameters and complexity in the prediction process. The present invention abandons the encoder-decoder architecture, divides the historical time series into seasonal sequences and trend sequences, and divides the seasonal sequences and trend sequences into segmented processing to extract query vector sets, key vector sets and value vectors, and predicts the target time series according to the three sets, which greatly reduces the number of parameters and complexity in the prediction process, thereby reducing the occupation of hardware device memory space and the requirements for the computing power of the hardware device for pest and disease prediction, can be applied to hardware devices with lower performance, and reduces hardware costs.

[0064] Predicting the target time series based on the query vector set, the key vector set and the value vector set establishes a more flexible connection between different sequences, improves the sequence crossover capability, helps reduce the risk of overfitting, and improves the accuracy of crop disease and pest data prediction.

[0065] Optionally, predicting the target time series based on the query vector set, the key vector set and the value vector set includes: determining an attention output sequence based on the query vector set, the key vector set and the value vector set; and determining the sum of the attention output sequence and the trend sequence as the target time series.

[0066] Specifically, the query vector set corresponding to the seasonal sequence and the key vector set and value vector set corresponding to the trend sequence are combined through a cross-attention mechanism to obtain a new sequence, namely, the attention output sequence. The attention output sequence is added to the trend sequence to obtain the target time series, that is, the sum of the attention output sequence and the trend sequence is determined as the target time series.

[0067] In this embodiment, by superimposing the attention output sequence and trend sequence obtained by the cross-attention mechanism, adding or increasing the information in the attention output sequence on the basis of maintaining the original trend information, it helps to improve the accuracy of the target time series.

[0068] Optionally, determining the attention output sequence according to the query vector set, the key vector set, and the value vector set includes: for each query vector in the query vector set, performing a first operation to obtain N1 attention output vectors; concatenating the N1 attention output vectors to obtain the attention output sequence;

[0069] The query vector when performing the first operation is the current query vector, and the first operation includes: starting from j=1, loopingly performing the second operation until j is greater than N2, and stopping the second operation to obtain N2 first vectors; superimposing the N2 first vectors to obtain the attention output vector corresponding to the current query vector;

[0070] The second operation includes: obtaining the jth vector combination, wherein the jth vector combination includes the jth key vector in the key vector set and the jth value vector in the value vector set; determining the jth first vector among N2 first vectors according to the jth vector combination and the current query vector; and executing j+1.

[0071] Specifically, when determining the attention output sequence according to three query vector sets (the query vector set, the key vector set, and the value vector set), firstly, for each query vector in the query vector set, the attention output vector corresponding to the query vector is determined. There are N1 query vectors in the query vector set, so N1 attention output vectors are obtained. The sequence obtained by splicing the N1 attention output vectors is the attention output sequence, which can be expressed by the following formula:

[0072]

[0073] Among them, A is the attention output sequence, A i is the attention output vector corresponding to the i-th query vector in the query vector set, i=1, 2, ...N1.

[0074] Further, when determining the attention output vector (denoted as the i-th attention output vector) corresponding to each query vector (i.e., the current query vector, denoted as the i-th query vector), the attention output vector is determined by combining the i-th query vector, the value vector set, and the key vector through a first operation, specifically including: determining a first vector according to each key vector in the key vector set, the value vector corresponding to the key vector, and the current query vector, wherein the value vectors in the value vector set correspond one-to-one to the key vectors in the key vector set, a key vector in the key vector set and a value vector corresponding to the key vector in the value vector set are a vector combination, then there are a total of N2 vector combinations, and N2 first vectors can be obtained, and the vector obtained by superimposing the obtained N2 first vectors is determined as the attention output vector corresponding to the current query vector, which can be specifically expressed as:

[0075]

[0076] Among them, A i is the attention output vector corresponding to the current query vector, C j is the j-th first vector among N2 first vectors, j=1, 2, ...N2, i=1, 2, ...N1.

[0077] For example, if Figure 2 As shown, the query vector set corresponding to the seasonal sequence and the key vector set and value vector set corresponding to the trend sequence are used to obtain the attention output sequence through the cross attention mechanism. When N1=2 and N2=3, the query vector set includes two query vectors Q1 and Q2, the key vector set includes three key vectors K1, K2, and K3, and the value set includes three key vectors V1, V2, and V3.

[0078] According to the combination of Q1 and the first vector (including K1 and V1), the first first vector C1(Q1) corresponding to Q1 is obtained. According to the combination of Q1 and the second vector (including K2 and V2), the second first vector C2(Q1) corresponding to Q1 is obtained. According to the combination of Q1 and the third vector (including K3 and V3), the third first vector C3(Q1) corresponding to Q1 is obtained.

[0079] According to the combination of Q2 and the first vector (including K1 and V1), the first first vector C1(Q2) corresponding to Q2 is obtained. According to the combination of Q2 and the second vector (including K2 and V2), the second first vector C2(Q2) corresponding to Q2 is obtained. According to the combination of Q2 and the third vector (including K3 and V3), the third first vector C3(Q2) corresponding to Q2 is obtained.

[0080] Superimpose C1(Q1), C2(Q1) and C3(Q1) to obtain the attention output vector A1 corresponding to Q1, and superimpose C1(Q2), C2(Q2) and C3(Q2) to obtain the attention output vector A2 corresponding to Q2. The sequence obtained by concatenating A1 and A2 is the attention output sequence.

[0081] Optionally, determining the jth first vector among N2 first vectors based on the jth vector combination and the current query vector includes: determining the similarity between the jth key vector and the current query vector to obtain the jth attention score; normalizing the jth attention score to obtain the jth attention weight matrix; weighting the jth value vector according to the jth attention weight matrix to obtain the jth first vector.

[0082] Specifically, when a first vector (the i-th first vector) is determined according to each key vector (the j-th key vector) in the key vector set, the value vector (the j-th value vector) corresponding to the key vector, and the current query vector, the similarity between the j-th key vector and the current query vector is first calculated, and the similarity can be obtained by dot multiplication. Specifically, the similarity calculation can be expressed by the following formula:

[0083]

[0084] Among them, Q i is the current query vector, K j The transpose of sim j represents the jth attention score, K j is the jth key vector, d k is the dimension of the j-th key vector.

[0085] The j-th attention weight matrix is ​​expressed by the following formula:

[0086] B j =softmax(sim j )

[0087] Among them, B j is the jth attention weight matrix, softmax represents normalization, sim j represents the j-th attention score.

[0088] The j-th value vector is weighted according to the j-th attention weight matrix to obtain the j-th first vector. Specifically, the j-th first vector is expressed by the following formula:

[0089] C j =B j *V j

[0090] Among them, B j is the jth attention weight matrix, V j is the jth value vector, C j is the j-th first vector among the N2 first vectors.

[0091] In summary, the attention output vector corresponding to the current query vector can be expressed as:

[0092]

[0093] Among them, A i is the attention output vector corresponding to the current query vector, C j is the jth first vector among the N2 first vectors, Q i is the current query vector, K j The transpose of K j is the jth key vector, d k is the dimension of the jth key vector, softmax represents normalization, V j is the j-th value vector, j=1, 2,...N2, i=1, 2,...N1.

[0094] Optionally, decomposing the historical time series to obtain a seasonal sequence and a trend sequence includes: performing a filling operation on the historical time series to obtain a first sequence; performing an average pooling operation on the first sequence to obtain the trend sequence; and determining the seasonal sequence based on the trend sequence and the historical time series.

[0095] Optionally, determining the seasonal sequence according to the trend sequence and the historical time series includes: determining the seasonal sequence by a sequence obtained by subtracting the trend sequence from the historical time series.

[0096] Specifically, when decomposing the historical time series, we first perform padding and average pooling operations to obtain a trend series. Due to the padding operation, the lengths of the trend series and the historical time series remain unchanged. Subtracting the trend series from the historical time series will give us the seasonal series.

[0097] It can be expressed by the following formula:

[0098] X t =avgpool(padding(X))

[0099] X s =XX t

[0100] Among them, X t is the trend sequence, X s is a seasonal series, X is a historical time series, padding represents a padding operation, and avgpool represents an average pooling operation.

[0101] Optionally, dividing the seasonal sequence into N1 seasonal subsequences comprises:

[0102] Inputting the seasonal sequence into a feedforward neural network layer, performing a nonlinear transformation on the seasonal sequence through the feedforward neural network layer to obtain a feedforward output sequence;

[0103] The feedforward output sequence is segmented to obtain N1 seasonal subsequences.

[0104] Specifically, the complexity of the input sequence is reduced by performing nonlinear changes on the feedforward neural network layer, and the feedforward output sequence is segmented so that the search range of features can be controlled within a reasonable sequence length, thus avoiding the overfitting problem caused by an excessively long sequence.

[0105] Figure 3A crop pest and disease data prediction model is provided. The structure of the model includes a decomposition layer, a feedforward layer, a self-attention layer, and a self-attention cross layer. A historical time series is input into the model. First, the historical time series is decomposed into a trend series and a seasonal series by the decomposition layer. The trend series and the seasonal series are input into the feedforward layer. The feedforward layer processes the trend series and the seasonal series respectively. The two output sequences of the feedforward layer are used as inputs of the self-attention layer. The self-attention layer segments the trend series processed by the feedforward layer and extracts a value vector set and a key vector set. The seasonal series processed by the feedforward layer is segmented and a query vector set is extracted. The query vector set, the value vector set, and the key vector set are input into the self-attention cross layer. The self-attention cross layer determines an attention output sequence according to the three vector sets. The attention output sequence is added to the trend sequence to obtain the output of the crop pest and disease data prediction model, that is, the target time series.

[0106] Among them, the self-attention layer can be composed of multiple sub-attention layers. The output of the previous sub-attention layer is used as the input of the next sub-attention layer, and the output of the last sub-attention layer is the output of the entire self-attention layer.

[0107] like Figure 4 As shown, a crop pest data prediction device 400 provided by an embodiment of the present invention includes:

[0108] A decomposition module 410 is used to decompose the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of plant disease and insect pest data of crops in the target area in a historical period arranged in chronological order;

[0109] A first extraction module 420 is used to divide the seasonal sequence into N1 seasonal subsequences, and extract query vectors from the N1 seasonal subsequences respectively to obtain a query vector set;

[0110] A second extraction module 430 is used to divide the trend sequence into N2 trend subsequences, and extract key vectors and value vectors from the N2 trend subsequences to obtain a key vector set and a value vector set;

[0111] The prediction module 440 is used to predict the target time series based on the query vector set, the key vector set and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

[0112] The crop disease and insect pest data prediction device of this embodiment is used to implement the crop disease and insect pest data prediction method as described above. Its advantages over the prior art are the same as the advantages of the above-mentioned crop disease and insect pest data prediction method over the prior art, and will not be repeated here.

[0113] Optionally, the above-mentioned prediction module is used to predict the target time series based on the query vector set, the key vector set and the value vector set in the following manner: determine the attention output sequence based on the query vector set, the key vector set and the value vector set; determine the sum of the attention output sequence and the trend sequence as the target time series.

[0114] Optionally, the prediction module is used to determine the attention output sequence according to the query vector set, the key vector set, and the value vector set in the following manner: for each query vector in the query vector set, perform a first operation to obtain N1 attention output vectors; concatenate the N1 attention output vectors to obtain the attention output sequence;

[0115] The query vector when performing the first operation is the current query vector, and the first operation includes: starting from j=1, loopingly performing the second operation until j is greater than N2, and stopping the second operation to obtain N2 first vectors; superimposing the N2 first vectors to obtain the attention output vector corresponding to the current query vector;

[0116] The second operation includes: obtaining the jth vector combination, wherein the jth vector combination includes the jth key vector in the key vector set and the jth value vector in the value vector set; determining the jth first vector among N2 first vectors according to the jth vector combination and the current query vector; and executing j+1.

[0117] Optionally, the above-mentioned prediction module is used to determine the jth first vector among N2 first vectors based on the jth vector combination and the current query vector in the following manner: determine the similarity between the jth key vector and the current query vector to obtain the jth attention score; normalize the jth attention score to obtain the jth attention weight matrix; weight the jth value vector according to the jth attention weight matrix to obtain the jth first vector.

[0118] Optionally, the above-mentioned prediction module is used to decompose the historical time series to obtain a seasonal sequence and a trend sequence in the following manner: perform a filling operation on the historical time series to obtain a first sequence; perform an average pooling operation on the first sequence to obtain the trend sequence; determine the seasonal sequence based on the trend sequence and the historical time series.

[0119] Optionally, the above-mentioned prediction module is used to determine the seasonal sequence according to the trend sequence and the historical time series in the following manner: determine the seasonal sequence by a sequence obtained by subtracting the trend sequence from the historical time series.

[0120] Optionally, the above-mentioned prediction module is used to divide the seasonal sequence into N1 seasonal sub-sequences in the following manner: input the seasonal sequence into a feedforward neural network layer, perform a nonlinear transformation on the seasonal sequence through the feedforward neural network layer to obtain a feedforward output sequence; and perform segmentation processing on the feedforward output sequence to obtain N1 seasonal sub-sequences.

[0121] like Figure 5 As shown, an electronic device 500 provided by an embodiment of the present invention includes a memory 510 and a processor 520; the memory 510 is used to store a computer program; the processor 520 is used to implement the above-mentioned crop disease and pest data prediction method when executing the computer program.

[0122] In other words, an electronic device 500 includes a memory 510 and a processor 520 coupled to the memory 510; the memory 510 is configured to store a computer program; and the processor 520 is configured to perform the following operations when executing the computer program:

[0123] Decomposing the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of data on plant diseases and insect pests in the target area during the historical period arranged in chronological order;

[0124] Divide the seasonal sequence into N1 seasonal subsequences, extract query vectors from the N1 seasonal subsequences respectively, and obtain a query vector set;

[0125] Divide the trend sequence into N2 trend subsequences, extract key vectors and value vectors from the N2 trend subsequences respectively, and obtain a key vector set and a value vector set;

[0126] A target time series is predicted based on the query vector set, the key vector set, and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

[0127] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned crop disease and insect pest data prediction method is implemented.

[0128] In other words, a non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor performs the following operations:

[0129] Decomposing the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of data on plant diseases and insect pests in the target area during the historical period arranged in chronological order;

[0130] Divide the seasonal sequence into N1 seasonal subsequences, extract query vectors from the N1 seasonal subsequences respectively, and obtain a query vector set;

[0131] Divide the trend sequence into N2 trend subsequences, extract key vectors and value vectors from the N2 trend subsequences respectively, and obtain a key vector set and a value vector set;

[0132] A target time series is predicted based on the query vector set, the key vector set, and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

[0133] An electronic device 500 that can be used as a server or client of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device 500 is intended to represent various forms of digital electronic computer equipment, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 500 can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples, and are not intended to limit the implementation of the present invention described and / or required herein.

[0134] The electronic device 500 includes a computing unit, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for the operation of the device can also be stored. The computing unit, ROM, and RAM are connected to each other via a bus. An input / output (I / O) interface is also connected to the bus.

[0135] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. In the present application, the unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment of the present invention. In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0136] Although the present invention is disclosed as above, the protection scope of the present invention is not limited thereto. Those skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will fall within the protection scope of the present invention.

Claims

1. A method for predicting crop pest and disease data, characterized in that: include: Decomposing the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of data on plant diseases and insect pests in the target area during the historical period arranged in chronological order; Divide the seasonal sequence into N1 seasonal subsequences, extract query vectors from the N1 seasonal subsequences respectively, and obtain a query vector set; Divide the trend sequence into N2 trend subsequences, extract key vectors and value vectors from the N2 trend subsequences respectively, and obtain a key vector set and a value vector set; A target time series is predicted based on the query vector set, the key vector set, and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

2. The crop pest data prediction method according to claim 1, characterized in that: The predicting the target time series according to the query vector set, the key vector set, and the value vector set includes: Determine an attention output sequence according to the query vector set, the key vector set, and the value vector set; The sum of the attention output sequence and the trend sequence is determined as the target time series.

3. The crop pest data prediction method according to claim 2, characterized in that: The determining of the attention output sequence according to the query vector set, the key vector set, and the value vector set includes: For each query vector in the query vector set, perform a first operation to obtain N1 attention output vectors; Concatenate the N1 attention output vectors to obtain the attention output sequence; The query vector when performing the first operation is a current query vector, and the first operation includes: Starting from j=1, the second operation is executed cyclically until j is greater than N2, and the second operation is stopped, thereby obtaining N2 first vectors; Superimposing N2 of the first vectors to obtain the attention output vector corresponding to the current query vector; The second operation includes: Obtaining a j-th vector combination, wherein the j-th vector combination includes a j-th key vector in the key vector set and a j-th value vector in the value vector set; Determine a j-th first vector among N2 first vectors according to the j-th vector combination and the current query vector; Execute j+1.

4. The crop pest data prediction method according to claim 3, characterized in that: The determining the jth first vector among N2 first vectors according to the jth vector combination and the current query vector comprises: Determine the similarity between the j-th key vector and the current query vector to obtain a j-th attention score; Normalizing the j-th attention score to obtain the j-th attention weight matrix; The j-th value vector is weighted according to the j-th attention weight matrix to obtain the j-th first vector.

5. The crop pest data prediction method according to any one of claim 1, characterized in that: The historical time series is decomposed to obtain seasonal series and trend series, including: Performing a filling operation on the historical time series to obtain a first series; Performing an average pooling operation on the first sequence to obtain the trend sequence; The seasonal sequence is determined according to the trend sequence and the historical time series.

6. The crop pest data prediction method according to claim 5, characterized in that: The determining the seasonal sequence according to the trend sequence and the historical time series comprises: The seasonal sequence is determined by subtracting the trend sequence from the historical time series.

7. The crop pest data prediction method according to any one of claim 1, characterized in that: The step of dividing the seasonal sequence into N1 seasonal subsequences comprises: Inputting the seasonal sequence into a feedforward neural network layer, performing a nonlinear transformation on the seasonal sequence through the feedforward neural network layer to obtain a feedforward output sequence; The feedforward output sequence is segmented to obtain N1 seasonal subsequences.

8. A crop pest data prediction device, characterized in that: include: A decomposition module is used to decompose the historical time series to obtain a seasonal series and a trend series, wherein the historical time series is a series of pest and disease data of crops in the target area within a historical period arranged in chronological order; A first extraction module is used to divide the seasonal sequence into N1 seasonal subsequences, and extract query vectors from the N1 seasonal subsequences respectively to obtain a query vector set; A second extraction module is used to divide the trend sequence into N2 trend subsequences, and extract key vectors and value vectors from the N2 trend subsequences respectively to obtain a key vector set and a value vector set; A prediction module is used to predict a target time series based on the query vector set, the key vector set and the value vector set, wherein the target time series is a series of predicted pest and disease data of crops in the target area in a future time period arranged in chronological order, the time interval between the historical time period and the future time period is less than a first preset time length, and the length of the future time period is less than a second preset time length.

9. An electronic device, characterized in that: including memory and processor; The memory is used to store computer programs; The processor is used to implement the crop disease and insect pest data prediction method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the crop disease and insect pest data prediction method according to any one of claims 1 to 7 is implemented.