Thunder and lightning prediction method, device, equipment and computer readable storage medium
1. A lightning prediction method, comprising:
acquiring an atmospheric electric field sequence of the current time period;
inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing an obtained historical atmospheric electric field sequence, and comprises an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer;
and if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold value, sending a prompt that the thunder will occur in the prediction time period.
2. The lightning prediction method of claim 1, wherein obtaining a historical sequence of atmospheric electric fields comprises:
and acquiring the historical atmospheric electric field sequence through a sliding window.
3. The lightning prediction method of claim 1, further comprising, after obtaining the sequence of atmospheric electric fields for the current time period:
and preprocessing the atmospheric electric field sequence.
4. The lightning prediction method of claim 1, wherein issuing an indication that lightning will occur for the predicted period of time comprises:
a buzzer is sounded.
5. A lightning prediction apparatus, comprising:
the acquisition module is used for acquiring an atmospheric electric field sequence of the current time period;
the input module is used for inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing an obtained historical atmospheric electric field sequence, and comprises an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer;
and the prompt sending module is used for sending a prompt that the thunder and lightning will occur in the prediction time period if the prediction result shows that the atmospheric electric field value in the prediction time period exceeds the threshold value.
6. The lightning prediction apparatus of claim 5, wherein the means for pre-constructing the timing prediction model comprises:
and the acquisition unit is used for acquiring the historical atmospheric electric field sequence through a sliding window.
7. The lightning prediction apparatus of claim 5, further comprising:
and the preprocessing module is used for preprocessing the atmospheric electric field sequence after acquiring the atmospheric electric field sequence in the current time period.
8. The lightning prediction apparatus of claim 5, wherein the prompt issuing module comprises:
and the sending prompting unit is used for sending out a buzzer.
9. A lightning prediction device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the lightning prediction method as claimed in any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the lightning prediction method according to any one of claims 1 to 4.
Background
In recent years, a disaster caused by lightning frequently occurs and rapidly rises, and therefore, it is very necessary to predict the disaster in advance before the occurrence of lightning.
At present, the existing lightning prediction method is as follows: gather current atmosphere electric field value to compare current atmosphere electric field value and the atmosphere electric field threshold value that sets up in advance, if the atmosphere electric field value is greater than the atmosphere electric field threshold value, then confirm that the thunder and lightning will take place and indicate, however, this kind of mode through gathering current atmosphere electric field value and determining whether will take place the thunder and lightning can't realize the prediction in advance to the thunder and lightning earlier, consequently, then can't carry out lightning protection earlier and better.
In summary, how to realize early prediction of lightning is a technical problem to be solved urgently by those skilled in the art.
Disclosure of Invention
In view of the above, an object of the present application is to provide a lightning prediction method, apparatus, device and computer readable storage medium for realizing earlier lightning prediction.
In order to achieve the above purpose, the present application provides the following technical solutions:
a lightning prediction method comprising:
acquiring an atmospheric electric field sequence of the current time period;
inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing an obtained historical atmospheric electric field sequence, and comprises an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer;
and if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold value, sending a prompt that the thunder will occur in the prediction time period.
Preferably, the historical atmospheric electric field sequence is acquired, and comprises:
and acquiring the historical atmospheric electric field sequence through a sliding window.
Preferably, after acquiring the atmospheric electric field sequence of the current time period, the method further includes:
and preprocessing the atmospheric electric field sequence.
Preferably, the sending of the indication that the lightning will occur in the predicted time period comprises:
a buzzer is sounded.
A lightning prediction apparatus comprising:
the acquisition module is used for acquiring an atmospheric electric field sequence of the current time period;
the input module is used for inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing an obtained historical atmospheric electric field sequence, and comprises an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer;
and the prompt sending module is used for sending a prompt that the thunder and lightning will occur in the prediction time period if the prediction result shows that the atmospheric electric field value in the prediction time period exceeds the threshold value.
Preferably, the module for constructing the time-series prediction model in advance comprises:
and the acquisition unit is used for acquiring the historical atmospheric electric field sequence through a sliding window.
Preferably, the method further comprises the following steps:
and the preprocessing module is used for preprocessing the atmospheric electric field sequence after acquiring the atmospheric electric field sequence in the current time period.
Preferably, the prompt sending module includes:
and the sending prompting unit is used for sending out a buzzer.
A lightning prediction device comprising:
a memory for storing a computer program;
a processor for implementing the steps of the lightning prediction method as claimed in any one of the above when executing the computer program.
A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the lightning prediction method according to any one of the preceding claims.
The application provides a thunder and lightning prediction method, a thunder and lightning prediction device, thunder and lightning prediction equipment and a computer-readable storage medium, wherein the method comprises the following steps: acquiring an atmospheric electric field sequence of the current time period; inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing the obtained historical atmospheric electric field sequence, and can comprise an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer; and if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold value, sending a prompt that the thunder will occur in the prediction time period.
According to the technical scheme, the obtained historical atmospheric electric field sequence is used for training the preset time sequence model to obtain the time sequence prediction model, the time sequence prediction model specifically comprises an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer, namely the time sequence prediction model based on the recurrent neural network is obtained, the atmospheric electric field value of the prediction time period is predicted by combining the time sequence prediction model with the atmospheric electric field sequence of the current time period, the prediction result of whether the atmospheric electric field value in the prediction time period exceeds a threshold value is obtained, if the atmospheric electric field value in the prediction time period exceeds the threshold value, the prediction time period is indicated to be possible to generate thunder, and at the moment, a prompt that the thunder is generated in the prediction time period is sent. Compared with the existing mode of predicting lightning by utilizing the relation between the current atmospheric electric field value and the threshold value, the method and the device can utilize the time sequence prediction model based on the recurrent neural network to realize the prediction of whether lightning occurs in the future prediction time period or not, so that the lightning can be predicted earlier, and the lightning protection can be performed earlier and better.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a flow chart of a lightning prediction method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a model for multi-temporal prediction of single values according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a lightning prediction apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a lightning prediction device according to an embodiment of the present application.
Detailed Description
The application aims to provide a lightning prediction method, a lightning prediction device, equipment and a computer readable storage medium, which are used for realizing early lightning prediction.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, which shows a flowchart of a lightning prediction method provided in an embodiment of the present application, a lightning prediction method provided in an embodiment of the present application may include:
s11: and acquiring the atmospheric electric field sequence of the current time period.
When lightning prediction is performed, an atmospheric electric field instrument can be used for detecting and acquiring an atmospheric electric field sequence of a current time period, wherein the current time period mentioned here may specifically be a time period from a current time to a previous target (for example, 10 minutes, 20 minutes, and the like), and in the current time period, the atmospheric electric field instrument can acquire an atmospheric electric field value once per second, and form the atmospheric electric field sequence by using all atmospheric electric field values acquired in the current time period according to a time sequence. It should be noted that, when 10 minutes or other preset time is used as the current time period, under the condition that some atmospheric electric field instruments do not have 1 detection value per second, the conversion can be performed equally according to the preset time period data, and the parameters are adjusted, taking 10 minutes and collecting once per second as an example, if some atmospheric electric field instruments collect once every two seconds, the preset time period corresponding to the current time period of the atmospheric electric field instrument can be adjusted to 20 minutes, so as to ensure that a sufficient number of atmospheric electric field values participate in lightning prediction.
S12: inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by using the obtained historical atmospheric electric field sequence, and can comprise an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer.
In the application, when lightning prediction is performed, a historical atmospheric electric field sequence, a comparison result of the historical atmospheric electric field sequence and a preset threshold value can be obtained first, and a preset time sequence model is trained by using the comparison result of the historical atmospheric electric field sequence, the historical atmospheric electric field sequence and the preset threshold value, wherein when the preset time sequence model is trained, an optimization target of a loss function can be a mean square error, and an adopted optimization method can be specifically an Adam function. In addition, when the historical atmospheric electric field sequence is obtained, the atmospheric electric field sequence before the atmospheric electric field value reaches the threshold value can be obtained specifically, so that model training can be performed by using the atmospheric electric field sequence.
It should be noted that, in the present application, the preset timing model and the trained timing prediction model may specifically include an input layer, a recurrent neural network layer, a fully-connected layer, and an output layer, that is, the timing prediction model provided in the present application may specifically be a recurrent neural network model. The recurrent neural network layer may be an LSTM layer (Long Short-Term Memory network), and of course, other recurrent neural networks may also be selected as the recurrent neural network layer.
When the LSTM is used as the recurrent neural network layer, the LSTM layer includes a plurality of (e.g., 100) LSTM nodes, and the LSTM layer is generally configured by four main steps, for input xtAnd the last output ht-1:
1) Calculating forgetting door ftThe decision as to which information to drop from the old cell state is made by "forget gate".
ft=σ(Wf·[ht-1,xt]+bf)
Wherein, WfTo forget the weight of the door, bfTo forget the offset value of the gate, ht-1Hidden state at time t-1, xtFor the input at the time t, sigma is an activation function, and a sigmoid function is selected as the activation function;
sigmoid function according to xtAnd ht-1The cell state is controlled, 0 for completely ignoring and 1 for holding.
2) Input layer itAnd cell state CtDetermining at cell state CtWhere new information is stored. Cell state updates require an input layer and a candidate
it=σ(Wi·[ht-1,xt]+bi)
Wherein, WiIs the weight of the input layer, biIs an offset value of an input layer, WCAre candidates forWeight, bCA bias value that is a candidate;
combining the old cell state, the input layer input part, and the updated candidate part to generate a new cell state Ct:
3) Output gate otDetermine what to output
According to the new cell state, a post-treatment is carried out:
ot=σ(Wo[ht-1,xt]+bo)
ht=ot*tanh(Ct)
wherein, WoAs a weight of the output gate, boIs the offset value of the output gate;
then prepare for the next cell calculation htWherein h istIs a hidden state at time t.
In addition, an activation function may be set for the LSTM node in the LSTM layer, and specifically, a ReLU function may be selected as the activation function, which has a significant influence on the convergence of random data compared with a sigmoid function and a tanh function. Of course, other activation functions may be used as the activation function, and the present application is not limited thereto.
The fully-connected layer density is used for reducing data dimensionality, 1 or 0(1 represents that a threshold is exceeded, and 0 represents that the threshold is not exceeded) can be output specifically, an activation function can be set in the fully-connected layer, a sigmoid function can be set specifically, and the fully-connected layer density is more suitable for classification selection.
After the time sequence prediction model corresponding to the above is obtained through training, the atmospheric electric field sequence of the current time period obtained in step S11 may be input into a pre-constructed time sequence prediction model, so as to obtain an atmospheric electric field value within the prediction time period through prediction by using the time sequence prediction model, and output a prediction result of whether the predicted atmospheric electric field value within the prediction time period exceeds a threshold value by using the time sequence prediction model constructed through prediction, where the prediction time period may be specifically 10 minutes in the future or other time periods in the future, and thus, it is achieved that whether the atmospheric electric field value can reach the threshold value is predicted in advance for a period of time, and an effect of increasing the lightning prediction advance time is further achieved.
Specifically, when the prediction result is obtained, the time sequence prediction model can be used to predict and obtain the atmospheric electric field sequence in the prediction time period, the atmospheric electric field value with the largest absolute value is selected from the atmospheric electric field sequence in the prediction time period, taking an absolute value of the atmospheric electric field value with the maximum absolute value, comparing the atmospheric electric field value after taking the absolute value with a threshold value, if the atmospheric electric field value after taking the absolute value is larger than the threshold value, the time sequence prediction model outputs a prediction result that the atmospheric electric field value in the prediction time period exceeds the threshold (specifically, the prediction result can be represented by outputting 1), if the atmospheric electric field value after taking the absolute value is not greater than the threshold, the time series prediction model outputs a prediction result that the atmospheric electric field value within the prediction period does not exceed the threshold (which can be specifically characterized by outputting 0), the method for obtaining the prediction result improves the efficiency of obtaining the prediction result and the accuracy of obtaining the prediction result. The above process may be specifically expressed as follows:
wherein E istThe atmospheric electric field value in the prediction time period is obtained through prediction of a time sequence prediction model, specifically, the atmospheric electric field value in the future 10 minutes of the last moment of an x sample can be represented in the application, abs () is an absolute value function, max () is a maximum value taking function, and threshold is a threshold value.
As can be seen from the foregoing process, the time sequence prediction model of the present application is specifically a model for predicting a single value in multiple time sequences, and specifically refer to fig. 2, which shows a schematic diagram of a model for predicting a single value in multiple time sequences provided in an embodiment of the present application, where X represents an atmospheric electric field value, u is an intermediate neuron function, where a time sequence of atmospheric electric field values, such as three times X (1), and X (1), is input, y is whether the atmospheric electric field value can exceed a threshold value in a prediction time period, and it should be noted that fig. 2 only illustrates three times, and does not represent limitation to three times.
According to the method, the high-latitude fitting prediction can be realized by using a pre-constructed time sequence prediction model and combining the atmospheric electric field sequence of the current time period to predict the atmospheric electric field in the future time period, the accuracy of atmospheric electric field prediction and thunder prediction is improved, and the thunder approach prediction time is advanced as far as possible.
S13: and if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold value, sending a prompt that the thunder will occur in the prediction time period.
After the prediction result is obtained, if the atmospheric electric field value in the prediction time interval of the prediction result exceeds the threshold value, that is, the thunder is possibly generated in the prediction time interval, at the moment, a prompt that the thunder is possibly generated in the prediction time interval can be sent, so that related personnel can know that the thunder is possibly generated in the future through the prompt, and the related personnel can carry out lightning protection according to the prompt, and the loss caused by the thunder is reduced.
According to the technical scheme, the obtained historical atmospheric electric field sequence is used for training the preset time sequence model to obtain the time sequence prediction model, the time sequence prediction model specifically comprises an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer, namely the time sequence prediction model based on the recurrent neural network is obtained, the atmospheric electric field value of the prediction time period is predicted by combining the time sequence prediction model with the atmospheric electric field sequence of the current time period, the prediction result of whether the atmospheric electric field value in the prediction time period exceeds a threshold value is obtained, if the atmospheric electric field value in the prediction time period exceeds the threshold value, the prediction time period is indicated to be possible to generate thunder, and at the moment, a prompt that the thunder is generated in the prediction time period is sent. Compared with the existing mode of predicting lightning by utilizing the relation between the current atmospheric electric field value and the threshold value, the method and the device can utilize the time sequence prediction model based on the recurrent neural network to realize the prediction of whether lightning occurs in the future prediction time period or not, so that the lightning can be predicted earlier, and the lightning protection can be performed earlier and better.
The lightning prediction method provided by the embodiment of the application acquires a historical atmospheric electric field sequence, and can include the following steps:
and acquiring a historical atmospheric electric field sequence through a sliding window.
In the application, when the historical atmospheric electric field sequence is obtained, the atmospheric electric field sequence can be obtained in a sliding window mode, the time length of the sliding window can be kept fixed, and specifically, the time length can be preset, for example, 10 minutes, so that the accuracy of a trained time sequence prediction model is improved, and the prediction accuracy is improved. Of course, other ways may be adopted to obtain the historical atmospheric electric field sequence, which is not limited in this application.
The lightning prediction method provided by the embodiment of the application can further include, after acquiring the atmospheric electric field sequence of the current time period:
and preprocessing the atmospheric electric field sequence.
After the atmospheric electric field sequence of the current time period is obtained, the atmospheric electric field sequence can be preprocessed, specifically, preprocessing operations such as deleting repetition values acquired by repetition time and supplementing the missing atmospheric electric field values of the sampling time points can be performed, so that the reliability and the quality of the obtained atmospheric electric field sequence are improved, the accuracy of prediction of the atmospheric electric field values of the prediction time period is improved, and the accuracy of lightning prediction is improved.
The lightning prediction method provided by the embodiment of the application sends out the prompt that the lightning will occur in the prediction time period, and can comprise the following steps:
a buzzer is sounded.
In the application, the prompt of thunder and lightning in the prediction time interval can be realized by specifically sending out the buzzer sound, so that related personnel can timely know the condition that the thunder and lightning are about to occur in the prediction time interval through the buzzer sound. Of course, the prompt may also be performed by means of voice prompt or the like, which is not limited in this application.
The embodiment of the present application further provides a lightning prediction apparatus, refer to fig. 3, which shows a schematic structural diagram of the lightning prediction apparatus provided in the embodiment of the present application, and the lightning prediction apparatus may include:
an obtaining module 31, configured to obtain an atmospheric electric field sequence in a current time period;
the input module 32 is configured to input the atmospheric electric field sequence into a pre-constructed time sequence prediction model, so as to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing the obtained historical atmospheric electric field sequence, and can comprise an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer;
and the prompt sending module 33 is configured to send a prompt that lightning will occur in the prediction time period if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold.
The lightning prediction device provided by the embodiment of the application is used for pre-constructing a time sequence prediction model, and the module for pre-constructing the time sequence prediction model comprises:
and the acquisition unit is used for acquiring the historical atmospheric electric field sequence through the sliding window.
The thunder and lightning prediction device that this application embodiment provided can also include:
and the preprocessing module is used for preprocessing the atmospheric electric field sequence after acquiring the atmospheric electric field sequence of the current time period.
The embodiment of the application provides a thunder and lightning prediction device, send out suggestion module 33 can include:
and the sending prompting unit is used for sending out a buzzer.
The embodiment of the present application further provides a lightning prediction device, refer to fig. 4, which shows a schematic structural diagram of the lightning prediction device provided in the embodiment of the present application, and the lightning prediction device may include:
a memory 41 for storing a computer program;
the processor 42, when executing the computer program stored in the memory 41, may implement the following steps:
acquiring an atmospheric electric field sequence of the current time period; inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing the obtained historical atmospheric electric field sequence, and can comprise an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer; and if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold value, sending a prompt that the thunder will occur in the prediction time period.
An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the following steps may be implemented:
acquiring an atmospheric electric field sequence of the current time period; inputting the atmospheric electric field sequence into a pre-constructed time sequence prediction model to obtain a prediction result of whether the atmospheric electric field value in a prediction time period exceeds a threshold value; the time sequence prediction model is obtained by training a preset time sequence model by utilizing the obtained historical atmospheric electric field sequence, and can comprise an input layer, a recurrent neural network layer, a full connection layer and an output layer, wherein activation functions are arranged in the recurrent neural network layer and the full connection layer; and if the prediction result is that the atmospheric electric field value in the prediction time period exceeds the threshold value, sending a prompt that the thunder will occur in the prediction time period.
The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
For a description of a relevant part in the lightning prediction apparatus, the device, and the computer-readable storage medium provided in the embodiments of the present application, reference may be made to a detailed description of a corresponding part in the lightning prediction method provided in the embodiments of the present application, and details are not repeated here.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include elements inherent in the list. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element. In addition, parts of the above technical solutions provided in the embodiments of the present application, which are consistent with the implementation principles of corresponding technical solutions in the prior art, are not described in detail so as to avoid redundant description.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.