Meteorological image prediction method, device, computer equipment and storage medium
By introducing custom loss function and classification loss function into the meteorological prediction model, combining the difference in meteorological images and pixel point category characteristics, the problem of low accuracy of meteorological forecasting in traditional technology is solved, and higher meteorological image prediction accuracy is achieved and applicability.
Patent Information
- Application Number
- CN202011093726.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-14
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2040-10-14
AI Technical Summary
The traditional general video prediction framework has failed to effectively adapt to meteorological characteristics in the application of the meteorological field, resulting in a low accuracy of meteorological forecasting.
A meteorological prediction model trained by custom loss function is adopted, combining the predicted loss function and the classification loss function, taking into account the differences in the meteorological image and the category characteristics of pixel points, and adjusting the model parameters to improve the prediction accuracy of the meteorological image.
It improves the accuracy and accuracy of meteorological image prediction, enhances the adaptability to predicted scenarios in the meteorological field, and improves the reliability of meteorological forecasts.
Smart Images

Figure CN112418480B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a meteorological image prediction method, device, computer equipment and storage medium. Background Art
[0002] With the development of computer technology, it is becoming more and more important to use computer technology to forecast weather in the meteorological field. In traditional technology, the general video prediction framework in the field of artificial intelligence technology is used to forecast weather to improve the efficiency of weather forecast.
[0003] However, traditional technologies do not adaptively adjust the general video prediction framework according to the characteristics of the meteorological field, resulting in deviations between the weather forecast obtained using the general video prediction framework and the actual weather conditions, resulting in low accuracy of weather forecasts. Summary of the invention
[0004] Based on this, it is necessary to provide a meteorological image prediction method, device, computer equipment and storage medium that can improve the accuracy of meteorological image prediction in response to the above technical problems.
[0005] A meteorological image prediction method, the method comprising:
[0006] Obtain the meteorological image to be predicted;
[0007] The meteorological image to be predicted is input into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image.
[0008] In one embodiment, the training method of the weather forecast model includes:
[0009] Acquire a training meteorological image sequence, where the training meteorological image sequence includes an input image subsequence and a real output image subsequence;
[0010] Inputting the input image subsequence into the initial meteorological forecast model to obtain the predicted output image subsequence and the predicted classification value of each pixel in each predicted output image subsequence;
[0011] Get the true classification value of each pixel in the true output image subsequence;
[0012] Input the predicted output image subsequence and the actual output image subsequence into the prediction loss function to obtain the prediction loss value;
[0013] Input the predicted classification value and the true classification value into the classification loss function to obtain the classification loss value;
[0014] The initial meteorological forecast model is adjusted according to the predicted loss value and the classified loss value to obtain the meteorological forecast model.
[0015] In one embodiment, the initial meteorological forecast model is adjusted according to the predicted loss value and the classified loss value to obtain the meteorological forecast model, including:
[0016] Obtain the loss value based on the predicted loss value and the classified loss value;
[0017] When the loss value is greater than a preset threshold, the prediction parameters of the initial meteorological prediction model are adjusted to obtain a modified meteorological prediction model. When the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, the modified meteorological prediction model is extracted as the meteorological prediction model.
[0018] In one embodiment, obtaining the loss value according to the prediction loss value and the classification loss value includes:
[0019] Get the prediction weight corresponding to the prediction loss value, and the classification weight corresponding to the classification loss value;
[0020] The loss value is obtained based on the prediction loss value, prediction weight, classification loss value and classification weight.
[0021] In one embodiment, the predicted classification value and the true classification value are input into the classification loss function to obtain the classification loss value, including:
[0022] Determine the classification score corresponding to each predicted output image according to the predicted classification value and the true classification value of each pixel in the predicted output image;
[0023] Determine the time sequence weight corresponding to each predicted output image in the predicted output image subsequence according to the meteorological forecast timeliness;
[0024] According to the classification score value and the temporal weight, the single image classification error value corresponding to each predicted output image is obtained;
[0025] The classification error value corresponding to the predicted output image sequence is obtained according to the classification error value of each single image.
[0026] In one embodiment, determining the classification score value corresponding to each predicted output image according to the predicted classification value and the true classification value of each pixel in each predicted output image includes:
[0027] Compare the predicted classification value of each pixel in the predicted output image with the true classification value;
[0028] When the consistency comparison is passed, the pixels that pass the comparison are extracted as the correctly predicted pixels;
[0029] The correctly predicted pixels are classified according to the predicted classification values corresponding to the correctly predicted pixels, the correctly predicted pixels of each category are obtained, and the number of correct predictions corresponding to the correctly predicted pixels of each category is counted;
[0030] Classify each pixel in the predicted output image according to the predicted classification value to obtain predicted pixel points of each category, and count the number of predicted classification values corresponding to the predicted pixel points of each category;
[0031] The classification score corresponding to each predicted output image is determined based on the number of predicted classification values and the number of correct predictions.
[0032] In one embodiment, determining the classification score corresponding to each predicted output image according to the number of predicted classification values and the number of correct predictions includes:
[0033] Get the category weight factor corresponding to each predicted category value;
[0034] The classification score corresponding to each predicted output image is determined based on the number of predicted classification values, the number of correct predictions, and the category weight factor.
[0035] A meteorological image prediction device, comprising:
[0036] An image acquisition module is used to acquire the meteorological image to be predicted;
[0037] The prediction module is used to input the meteorological image to be predicted into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function. The prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image.
[0038] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0039] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0040] The above-mentioned meteorological image prediction method, device, computer equipment and storage medium include: obtaining the meteorological image to be predicted; inputting the meteorological image to be predicted into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image. In the process of training the meteorological prediction model, a custom loss function is defined, and the custom loss function includes the prediction loss function and the classification loss function, so that the trained meteorological prediction model not only considers the difference between the predicted image and the input meteorological image in the process of predicting the meteorological image, but also considers the difference in the category to which each pixel in the image belongs. Since different categories represent different areas in the meteorological radar image, the regional features of the predicted meteorological image are more accurate, thereby improving the prediction accuracy of the meteorological prediction model for the meteorological image. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A diagram showing an application environment of a meteorological image prediction method in an embodiment;
[0042] Figure 2 A schematic diagram of a flow chart of a meteorological image prediction method in one embodiment;
[0043] Figure 3 A schematic diagram of a flow chart of a weather forecast model training method provided in an embodiment;
[0044] Figure 4 is a structural block diagram of a meteorological image prediction device in one embodiment;
[0045] Figure 5 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0047] The meteorological image prediction method provided in this application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The server 104 obtains the meteorological image to be predicted; the meteorological image to be predicted is input into the pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain the predicted image; the meteorological prediction model is trained according to the custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image. Further, the server 104 pushes the predicted predicted image to the terminal 102. Among them, the terminal 102 can be but is not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0048] In one embodiment, Figure 2 As shown, a schematic diagram of a meteorological image prediction method is provided, and the method is applied to Figure 1 The server in the example is used to illustrate the following steps:
[0049] Step 210: Acquire the meteorological image to be predicted.
[0050] The meteorological image to be predicted can be a meteorological radar echo image. The meteorological radar echo image shows the echo intensity of the radar, and the greater the echo intensity, the greater the probability of rainfall. Specifically, the radar echo intensity is represented by the reflectivity factor (dBZ). In actual application scenarios, the greater the reflectivity factor (>45dBZ), the greater the probability of precipitation, and the greater the impact on the economy, which is the focus of attention in business scenarios.
[0051] In a specific embodiment, the server may obtain multiple meteorological images to be predicted, so as to predict meteorological images in a future time period based on multiple meteorological images to be predicted in a current time period, and to make weather forecasts based on the predicted meteorological images.
[0052] Step 220, input the meteorological image to be predicted into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image.
[0053] The meteorological prediction model can receive the meteorological image to be predicted, and predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain the predicted image, wherein the meteorological image to be predicted and the predicted meteorological image can be meteorological radar echo images corresponding to different time periods, such as the meteorological image to be predicted is the image corresponding to the historical time period, and the predicted meteorological image is the image corresponding to the future time period. The meteorological prediction model is pre-trained according to the training data, and the meteorological prediction model is trained according to the custom loss function, and the custom loss function includes at least two parts, the first part is the prediction loss function and the second part is the classification loss function. Specifically, the prediction loss function is constructed according to the meteorological image to be predicted and the predicted image, and the classification loss function is constructed according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image. Further, a comprehensive loss function is obtained according to the prediction loss function and the classification loss function, so as to train the meteorological prediction model according to the comprehensive loss function.
[0054] In this embodiment, a custom loss function is defined in the process of training a meteorological prediction model, and the custom loss function includes a prediction loss function and a classification loss function, so that the trained meteorological prediction model not only considers the difference between the predicted image and the input meteorological image in the process of predicting the meteorological image, but also considers the difference in the category to which each pixel in the image belongs. Since different categories represent different areas in the meteorological radar image, the regional features of the predicted meteorological image are more accurate. Specifically, in this embodiment, in the process of predicting radar echo images using deep learning, a method of adding prior knowledge of the importance of regions corresponding to different categories of radar echo images at the level of loss function design improves the prediction accuracy of the meteorological prediction model for different categories of regions.
[0055] In one embodiment, if Figure 3 As shown, a flow chart of a weather forecast model training method is provided, including:
[0056] Step 310: Acquire a training meteorological image sequence, where the training meteorological image sequence includes an input image subsequence and a real output image subsequence.
[0057] Specifically, the server obtains training data, such as training data can be a training meteorological image sequence, and the training meteorological image sequence can include multiple meteorological images, such as training data is a radar echo map sequence, and the duration of the radar echo map sequence is 40 frames, and each frame represents a duration of 6 minutes, and 10 frames are 4 hours in total. Then the first 20 frames (input_t) are used as the input image subsequence and the last 20 frames (gt_t) are used as the real output image subsequence. Among them, the input image subsequence input_t includes 20 frames, each frame represents a duration of 6 minutes, which is the image of the radar echo map sequence at time t, and the image can be a grayscale image and the image size can be 128×128.
[0058] Step 320: input the input image subsequence into the initial meteorological forecast model to obtain the predicted output image subsequence and the predicted classification value of each pixel in each predicted output image subsequence.
[0059] The output of the initial meteorological forecast model includes two branches, one of which can be used to output the predicted output image subsequence obtained by prediction. The specific predicted output image subsequence can be predicted for 20 frames, each frame represents a duration of 6 minutes, that is, the predicted output image subsequence is a short-term forecast duration of 2 hours. The other branch can be the classification (seg_output_t+1) of each pixel in each predicted output image (output_t+1) in the predicted output image subsequence, where the classification (seg_output_t+1) can be the classification data obtained by segmenting the output image. Specifically, the classification of each pixel can be divided into 6 categories, such as the pixel is located in the interval [0, 20] is 0 category, the pixel is located in the interval (20, 30] is 1 category, the pixel is located in the interval (30, 40] is 2 categories, the pixel is located in the interval (40, 50] is 3 categories, the pixel is located in the interval (50, 80] is 4 categories, and the pixel is located in the interval (80, 255] is 5 categories.
[0060] Step 330: Obtain the true classification value of each pixel in the true output image subsequence.
[0061] Step 340: input the predicted output image subsequence and the actual output image subsequence into a prediction loss function to obtain a prediction loss value.
[0062] Step 350: input the predicted classification value and the true classification value into the classification loss function to obtain the classification loss value.
[0063] Step 360: Adjust the initial meteorological forecast model according to the predicted loss value and the classified loss value to obtain a meteorological forecast model.
[0064] Then, the predicted output image subsequence and the true output image subsequence are input into the prediction loss function to obtain the prediction loss value; the predicted classification value and the true classification value are input into the classification loss function to obtain the classification loss value; the initial meteorological prediction model is adjusted according to the prediction loss value and the classification loss value to obtain the meteorological prediction model. The pseudo code idea of the specific training process includes: input_t is input into the initial prediction model to obtain the predicted output image output_t+1 and seg_output_t+1 of each pixel in the predicted output image, and then the MSEloss_t+1 of output_t+1 and gt_t+1 are calculated respectively, and the our_loss_t+1 of seg_output_t+1 and seg_gt_t+1 (the true classification value of each pixel in the true output image) is calculated using the formula, and the sum of the loss values is calculated according to Total_loss+=(MSE loss_t+1+our_loss_t+1), and Total_loss=0 is set, For t in range(20); After the above cycle, Total_loss is obtained, and the back propagation algorithm is used to calculate the parameter update of the deep learning model until a certain accuracy is reached and the training is stopped.
[0065] In this embodiment, in the process of correcting the initial meteorological prediction model, not only the overall difference between the input image and the predicted image is taken into account, but also the pixel difference between each pixel in the input image and the predicted image is combined, and the initial prediction model is adjusted together according to the overall difference and the pixel difference at the pixel level, so that the final meteorological prediction model is more in line with the prediction scenarios in the meteorological field, thereby improving the prediction accuracy of meteorological images.
[0066] In the process of training the meteorological prediction model in this embodiment, the importance of different reflectivities in the radar echo map is taken into consideration, and combined with the prior knowledge of regional importance in the meteorological radar echo map, a loss function based on the radar echo reflectivity is designed, so that the trained meteorological prediction model is more in line with the actual prediction scenarios in the meteorological field, and the resulting predicted image is more accurate.
[0067] In one of the embodiments, the initial meteorological prediction model is adjusted according to the predicted loss value and the classified loss value to obtain the meteorological prediction model, including: obtaining the loss value according to the predicted loss value and the classified loss value; when the loss value is greater than a preset threshold, adjusting the prediction parameters of the initial meteorological prediction model to obtain a modified meteorological prediction model, until the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, and then extracting the modified meteorological prediction model as the meteorological prediction model.
[0068] In this embodiment, the server obtains a meteorological image sequence, which is a plurality of meteorological images in a continuous time, and the meteorological image sequence includes an input image subsequence and a real output image subsequence; the input image subsequence is input into the initial meteorological prediction model to obtain the predicted output image subsequence and the predicted classification value of each pixel in each predicted output image subsequence. By using the pre-built initial meteorological prediction model, not only the predicted output image subsequence can be obtained, but also the predicted classification value of each pixel in the image subsequence can be obtained, so that the category characteristics of each pixel can be combined in the meteorological prediction process to obtain a predicted image that is more in line with the meteorological field. Further, in order to improve the prediction accuracy of the initial meteorological prediction model, it also includes: obtaining the real classification value of each pixel in the real output image subsequence; obtaining the loss value according to the predicted output image subsequence, the real output image subsequence, the predicted classification value and the real classification value; when the loss value is greater than the preset threshold, the prediction parameters of the initial meteorological prediction model are adjusted to obtain a modified meteorological prediction model, until the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, the modified meteorological prediction model is extracted as the meteorological prediction model. In the process of correcting the initial meteorological forecast model, not only the overall difference between the input image and the predicted image is taken into account, but also the pixel difference between each pixel in the input image and the predicted image is combined. The initial forecast model is adjusted together according to the overall difference and the pixel difference at the pixel level, so that the final meteorological forecast model is more in line with the forecast scenarios in the meteorological field, thereby improving the prediction accuracy of meteorological images.
[0069] In this embodiment, the prediction parameters of the prediction model are continuously adjusted according to the size of the loss value during the training process of the prediction model, so that the prediction image obtained according to the final prediction parameters is more accurate, thereby improving the accuracy of image prediction. In different embodiments, the classification method can also be customized to adapt to image prediction in more scenarios and improve the applicability of the prediction model.
[0070] In one embodiment, the loss value is obtained according to the predicted loss value and the classified loss value, including: obtaining the predicted weight corresponding to the predicted loss value, and the classified weight corresponding to the classified loss value; and obtaining the loss value according to the predicted loss value, the predicted weight, the classified loss value and the classified weight.
[0071] Furthermore, in order to increase the prior knowledge of the importance of the radar echo map area, it also includes: setting corresponding weight factors for the predicted loss value and the classified loss value according to the specific meteorological forecast scenario, such as assigning a prediction weight to the predicted loss value and assigning a classification weight to the classified loss value, and then using the assigned weight factors to adjust each loss value and add them up to obtain the final loss value. The specific calculation method of the loss value is shown in formula (1):
[0072] Loss function = alpha×MSE_Loss+(1-alpha)(1-HSS_total) (1)
[0073] Among them, Loss function is the comprehensive loss value, alpha is the weight factor designed according to the specific application, and HSS_total is the loss part that characterizes the regional importance of the radar echo image designed according to the regional importance of the meteorological image.
[0074] In this embodiment, different weight factors can be adaptively set for different types of loss values according to specific weather forecast scenarios, so that the weather forecast model can adapt to more scenarios and improve the applicability of the model.
[0075] In one of the embodiments, the predicted classification value and the true classification value are input into the classification loss function to obtain the classification loss value, including: determining the classification score value corresponding to each predicted output image according to the predicted classification value and the true classification value of each pixel point in the predicted output image; determining the time series weight corresponding to each predicted output image in the predicted output image subsequence according to the meteorological forecast timeliness; obtaining the single image classification error value corresponding to each predicted output image according to the classification score value and the time series weight; and obtaining the classification error value corresponding to the predicted output image sequence according to each single image classification error value.
[0076] Specifically, the scoring value is a score obtained by scoring a single predicted output image. Specifically, the scoring value may be an HSS value (Heidke skill score). Specifically, the calculation formula of HSS is shown in formula (2).
[0077]
[0078] In formula (2), K is the number of categories, which can be 5 in this embodiment, n(F i , O j ) represents the total number of pixels predicted to be of category i in the predicted output image whose true category is j. N(F i ) represents the total number of pixels predicted to be of category i in the predicted output image, N(O j ) represents the total number of pixels of the true category j in the predicted output image, where N is the total number of pixels and w j The category weight factor corresponding to each category.
[0079] In one of the embodiments, the classification score value corresponding to each predicted output image is determined based on the number of predicted classification values and the number of correct predictions, including: obtaining the category weight factor corresponding to each predicted classification value; determining the classification score value corresponding to each predicted output image based on the number of predicted classification values, the number of correct predictions and the category weight factor.
[0080] In a specific embodiment, the effective predicted values in the predicted radar echo image and the actual radar echo image are divided into five categories with {20, 30, 40, 50} as the threshold, wherein the value interval corresponding to category 1 is [0, 20]; the value interval corresponding to category 2 is (20, 30]; the value interval corresponding to category 3 is (30, 40]; the value interval corresponding to category 4 is (40, 50]; and the value interval corresponding to category 5 is (50, 80]. It should be noted that for pixels in the category (80-255] range, they can be identified as invalid data in some embodiments, so there is no need to count the data in this range at this time.
[0081] Continuing to refer to formula (2), the category weight factor w is also introduced in this formula j , so that when calculating the HSS of a single predicted output image, the importance of pixels belonging to different categories in each predicted output image can be adaptively adjusted to make the prediction more accurate. Specifically, pixels with pixel categories in the range of (50, 80] can better reflect the intensity of precipitation. At this time, the category weight factor of the pixel category can be set to the maximum weight, specifically 0.8. In other embodiments, the value of the category weight can be set according to the specific application scenario.
[0082] Furthermore, this method can take into account the difficulty of forecasting different forecast timeliness and rainfall intensity, and can adjust the weight of the forecasting ability of AI nowcasting according to the actual scenario needs. If you want the prediction model to have a stronger rainfall ability, you can adjust the weight w5 of the high dBZ value area n(Fj, Oj) (j=5) in the loss function, thereby obtaining a more accurate rainfall prediction accuracy. This method is easy to operate and plug-and-play. It can be added to the framework of various general deep learning AI nowcasting by simply modifying the loss function. This method is a fine-grained design for meteorological radar echo prediction, which effectively utilizes the characteristics of meteorological radar echo maps and the core concerns of the meteorological field. It is an innovative solution that effectively combines meteorological prior knowledge with AI technology.
[0083] Furthermore, as specifically shown in formula (3), a formula for calculating the classification error value corresponding to the predicted output image sequence is provided.
[0084]
[0085] In formula (3), M represents the total number of pictures; wi ' represents the time series weight corresponding to the i-th predicted image, that is, the forecast time interval weight. In specific applications, the time series weight can be set according to the specific application scenario. For example, in the short-term forecast scenario (such as forecasting the weather in the next 1-2 hours), the weights of the first few frames can be set larger. On the contrary, when long-term forecasting is required (such as the next few days), the weights of the last few frames can be set larger.
[0086] Specifically, the temporal weight corresponding to each predicted output image in the predicted output image subsequence is determined according to the weather forecast timeliness; the single image classification error value corresponding to each predicted output image is obtained according to the classification score value and the temporal weight; and the classification error value corresponding to the predicted output image sequence is obtained according to each single image classification error value.
[0087] In one of the embodiments, the classification score value corresponding to each predicted output image is determined based on the predicted classification value and the true classification value of each pixel in each predicted output image, including: comparing the predicted classification value of each pixel in the predicted output image with the true classification value for consistency; when the consistency comparison is passed, extracting the pixel points that pass the comparison as the correctly predicted pixel points; classifying the correctly predicted pixel points according to the predicted classification values corresponding to the correctly predicted pixel points to obtain the correctly predicted pixel points of each category, and counting the number of correct predictions corresponding to the correctly predicted pixel points of each category; classifying each pixel in the predicted output image according to the predicted classification value to obtain the predicted pixel points of each category, and counting the number of predicted classification values corresponding to the predicted pixel points of each category; determining the classification score value corresponding to each predicted output image according to the number of predicted classification values and the number of correct predictions.
[0088] Specifically, in the real radar echo map, the real position information and number of pixel points of each category are counted, and then the corresponding pixel points are located in the corresponding predicted radar echo map according to the real position information, and the category of each located pixel point is counted in the predicted radar echo map, and the number of each category is counted at the same time, and then a multi-category cascade table as shown in Table 1 is generated according to the actual number of each category and the predicted number of each category in the predicted image.
[0089] In a specific embodiment, the number of pixels of the category [0, 20] counted in the real radar echo map is 100, and the position information of the 100 pixels is obtained in the real radar echo map; then, the 100 predicted pixels are located in the predicted radar echo map according to the position information, and the predicted category information of the 100 pixels is counted in the predicted radar echo map, and the counted predicted category information is written into the category cascade table. Similarly, the statistical data of other categories in the table are filled into the category cascade table according to the same method.
[0090] As shown in Table 1, a pair of images (including a real radar echo image and a corresponding predicted radar echo image) is mapped into the following multi-category cascade table:
[0091] Table 1 Multi-category cascade table
[0092]
[0093] Among them, n(F i ,O j ) represents the total number of pixels whose true category is j among the pixels whose predicted category is i, N(F i ) represents the total number of pixels predicted as category i, N(O j ) represents the total number of pixels of the true category j, and N is the total number of pixels. Then, the data in the multi-category cascade table is substituted into formula (2) to obtain the loss value corresponding to each predicted output image.
[0094] In this embodiment, by obtaining the category information of each pixel in the predicted output image, the score value of each predicted output image can be calculated, and further, the score value corresponding to the predicted output image subsequence can be obtained according to the score value of each predicted output image, and then the classification loss value can be obtained according to the score value. And the initial prediction model can be trained according to the classification loss value, so that the prediction model obtained by training can have better category prediction ability, and further, the weight factors of each category can be adaptively adjusted according to the specific application scenario, further improving the applicability of the prediction model.
[0095] It should be understood that although Figure 2-3 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-3 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0096] In one embodiment, Figure 4 As shown, a meteorological image prediction device is provided, comprising:
[0097] The image acquisition module 410 is used to acquire the meteorological image to be predicted.
[0098] The prediction module 420 is used to input the meteorological image to be predicted into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function. The prediction loss function is obtained based on the meteorological image to be predicted and the predicted image, and the classification loss function is obtained based on the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image.
[0099] In one embodiment, the weather image prediction device further includes:
[0100] The image sequence acquisition module is used to acquire a training meteorological image sequence, wherein the training meteorological image sequence includes an input image subsequence and a real output image subsequence.
[0101] The prediction data acquisition module is used to input the input image subsequence into the initial meteorological prediction model to obtain the predicted output image subsequence and the predicted classification value of each pixel point in each predicted output image subsequence.
[0102] The classification value acquisition module is used to obtain the true classification value of each pixel in the true output image subsequence.
[0103] The prediction loss value calculation module is used to input the predicted output image subsequence and the real output image subsequence into the prediction loss function to obtain the prediction loss value.
[0104] The classification loss value calculation module is used to input the predicted classification value and the true classification value into the classification loss function to obtain the classification loss value.
[0105] The model acquisition module is used to adjust the initial meteorological prediction model according to the predicted loss value and the classified loss value to obtain the meteorological prediction model.
[0106] In one embodiment, the model acquisition module includes:
[0107] The loss value calculation unit is used to obtain the loss value according to the prediction loss value and the classification loss value.
[0108] The adjustment unit is used to adjust the prediction parameters of the initial meteorological prediction model to obtain a modified meteorological prediction model when the loss value is greater than a preset threshold, until the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, and then extract the modified meteorological prediction model as the meteorological prediction model.
[0109] In one embodiment, the loss value calculation unit includes:
[0110] The weight acquisition subunit is used to obtain the prediction weight corresponding to the prediction loss value and the classification weight corresponding to the classification loss value.
[0111] The loss value calculation subunit is used to obtain the loss value according to the prediction loss value, the prediction weight, the classification loss value and the classification weight.
[0112] In one embodiment, the classification loss value calculation module includes:
[0113] The classification score value calculation unit is used to determine the classification score value corresponding to each predicted output image based on the predicted classification value and the true classification value of each pixel point in the predicted output image.
[0114] The time series weight determination unit is used to determine the time series weight corresponding to each predicted output image in the predicted output image subsequence according to the weather forecast timeliness.
[0115] The classification error value calculation unit is used to obtain the single image classification error value corresponding to each predicted output image according to the classification score value and the temporal weight.
[0116] The classification loss value calculation unit is used to obtain the classification error value corresponding to the predicted output image sequence according to the classification error value of each single image.
[0117] In one embodiment, the classification score value calculation unit includes:
[0118] The comparison subunit is used to compare the predicted classification value of each pixel in the predicted output image with the true classification value for consistency.
[0119] The correct pixel point determination subunit is used to extract the pixels that have passed the alignment as the correct predicted pixels when the consistency alignment passes.
[0120] The correct number determination subunit is used to classify the correctly predicted pixels according to the predicted classification values corresponding to the correctly predicted pixels, obtain the correctly predicted pixels of each category, and count the correct prediction numbers corresponding to the correctly predicted pixels of each category.
[0121] The prediction quantity determination subunit is used to classify each pixel point in the prediction output image according to the prediction classification value, obtain the prediction pixel points of each category, and count the number of prediction classification values corresponding to the prediction pixel points of each category.
[0122] The classification score value calculation subunit is used to determine the classification score value corresponding to each predicted output image according to the number of predicted classification values and the number of correct predictions.
[0123] In one embodiment, the classification score value calculation unit includes:
[0124] The category weight factor acquisition subunit is used to obtain the category weight factor corresponding to each predicted category value.
[0125] The classification score value calculation subunit is used to determine the classification score value corresponding to each predicted output image according to the number of predicted classification values, the number of correct predictions and the category weight factor.
[0126] For the specific definition of the meteorological image prediction device, please refer to the definition of the meteorological image prediction method above, which will not be repeated here. Each module in the above-mentioned meteorological image prediction device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0127] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 5 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store meteorological image prediction data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a meteorological image prediction method is implemented.
[0128] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: obtaining a meteorological image to be predicted; inputting the meteorological image to be predicted into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image.
[0130] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining a training meteorological image sequence, which includes an input image subsequence and a real output image subsequence; inputting the input image subsequence into the initial meteorological prediction model to obtain a predicted output image subsequence and a predicted classification value of each pixel in each predicted output image subsequence; obtaining the real classification value of each pixel in the real output image subsequence; inputting the predicted output image subsequence and the real output image subsequence into a prediction loss function to obtain a predicted loss value; inputting the predicted classification value and the real classification value into a classification loss function to obtain a classification loss value; and adjusting the initial meteorological prediction model according to the predicted loss value and the classification loss value to obtain a meteorological prediction model.
[0131] In one embodiment, when the processor executes the computer program, the following steps are also implemented: a loss value is obtained based on the predicted loss value and the classified loss value; when the loss value is greater than a preset threshold, the prediction parameters of the initial meteorological prediction model are adjusted to obtain a modified meteorological prediction model, until the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, and the modified meteorological prediction model is extracted as the meteorological prediction model.
[0132] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the prediction weight corresponding to the prediction loss value, and the classification weight corresponding to the classification loss value; and obtaining the loss value according to the prediction loss value, the prediction weight, the classification loss value and the classification weight.
[0133] In one embodiment, when the processor executes the computer program, the following steps are also implemented: determining the classification score value corresponding to each predicted output image based on the predicted classification value and the true classification value of each pixel point in the predicted output image; determining the timing weight corresponding to each predicted output image in the predicted output image subsequence based on the meteorological forecast timeliness; obtaining the single image classification error value corresponding to each predicted output image based on the classification score value and the timing weight; and obtaining the classification error value corresponding to the predicted output image sequence based on each single image classification error value.
[0134] In one embodiment, when the processor executes the computer program, the following steps are also implemented: the predicted classification value of each pixel point in the predicted output image is compared with the actual classification value for consistency; when the consistency comparison is passed, the pixel points that pass the comparison are extracted as correctly predicted pixel points; the correctly predicted pixel points are classified according to the predicted classification values corresponding to the correctly predicted pixel points to obtain the correctly predicted pixel points of each category, and the number of correct predictions corresponding to the correctly predicted pixel points of each category is counted; each pixel point in the predicted output image is classified according to the predicted classification value to obtain the predicted pixel points of each category, and the number of predicted classification values corresponding to the predicted pixel points of each category is counted; the classification score value corresponding to each predicted output image is determined according to the number of predicted classification values and the number of correct predictions.
[0135] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the category weight factor corresponding to each predicted classification value; determining the classification score value corresponding to each predicted output image based on the number of predicted classification values, the number of correct predictions and the category weight factor.
[0136] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: obtaining a meteorological image to be predicted; inputting the meteorological image to be predicted into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image.
[0137] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: obtaining a training meteorological image sequence, the training meteorological image sequence including an input image subsequence and a true output image subsequence; inputting the input image subsequence into an initial meteorological prediction model to obtain a predicted output image subsequence and a predicted classification value of each pixel in each predicted output image subsequence; obtaining the true classification value of each pixel in the true output image subsequence; inputting the predicted output image subsequence and the true output image subsequence into a prediction loss function to obtain a predicted loss value; inputting the predicted classification value and the true classification value into a classification loss function to obtain a classification loss value; and adjusting the initial meteorological prediction model according to the predicted loss value and the classification loss value to obtain a meteorological prediction model.
[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: a loss value is obtained based on the predicted loss value and the classified loss value; when the loss value is greater than a preset threshold, the prediction parameters of the initial meteorological prediction model are adjusted to obtain a modified meteorological prediction model, until the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, and the modified meteorological prediction model is extracted as the meteorological prediction model.
[0139] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: obtaining the prediction weight corresponding to the prediction loss value, and the classification weight corresponding to the classification loss value; and obtaining the loss value according to the prediction loss value, the prediction weight, the classification loss value and the classification weight.
[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: determining the classification score value corresponding to each predicted output image based on the predicted classification value and the true classification value of each pixel point in the predicted output image; determining the time series weight corresponding to each predicted output image in the predicted output image subsequence based on the meteorological forecast timeliness; obtaining the single image classification error value corresponding to each predicted output image based on the classification score value and the time series weight; and obtaining the classification error value corresponding to the predicted output image sequence based on each single image classification error value.
[0141] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the predicted classification value of each pixel point in the predicted output image is compared with the actual classification value for consistency; when the consistency comparison is passed, the pixel points that pass the comparison are extracted as the correctly predicted pixel points; the correctly predicted pixel points are classified according to the predicted classification values corresponding to the correctly predicted pixel points to obtain the correctly predicted pixel points of each category, and the number of correct predictions corresponding to the correctly predicted pixel points of each category is counted; each pixel point in the predicted output image is classified according to the predicted classification value to obtain the predicted pixel points of each category, and the number of predicted classification values corresponding to the predicted pixel points of each category is counted; the classification score value corresponding to each predicted output image is determined according to the number of predicted classification values and the number of correct predictions.
[0142] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: obtaining a category weight factor corresponding to each predicted classification value; determining a classification score value corresponding to each predicted output image based on the number of predicted classification values, the number of correct predictions, and the category weight factor.
[0143] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory may include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0144] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0145] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A meteorological image prediction method, characterized in that: The method comprises: Acquire a meteorological image to be predicted, wherein the meteorological image to be predicted includes a meteorological radar echo image, and the meteorological radar echo image displays the echo intensity of the radar; The meteorological image to be predicted is input into a pre-trained meteorological prediction model to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image; wherein the training method of the meteorological prediction model includes: Acquire a training meteorological image sequence, wherein the training meteorological image sequence includes an input image subsequence and a real output image subsequence; Inputting the input image subsequence into an initial meteorological forecast model to obtain a predicted output image subsequence and a predicted classification value of each pixel in each predicted output image subsequence; Obtaining a true classification value of each pixel in the true output image subsequence; Inputting the predicted output image subsequence and the real output image subsequence into the prediction loss function to obtain a prediction loss value; Inputting the predicted classification value and the true classification value into the classification loss function to obtain a classification loss value; The initial meteorological forecast model is adjusted according to the predicted loss value and the classified loss value to obtain a meteorological forecast model.
2. The method according to claim 1, characterized in that The to-be-forecasted meteorological image and the forecasted meteorological image include corresponding meteorological radar echo images in different time periods.
3. The method according to claim 1, characterized in that The step of adjusting the initial meteorological forecast model according to the predicted loss value and the classified loss value to obtain a meteorological forecast model includes: Obtaining a loss value according to the predicted loss value and the classified loss value; When the loss value is greater than a preset threshold, the prediction parameters of the initial meteorological prediction model are adjusted to obtain a modified meteorological prediction model, until the loss value corresponding to the modified prediction model is less than or equal to the preset threshold, the modified meteorological prediction model is extracted as the meteorological prediction model.
4. The method according to claim 3, characterized in that The obtaining of the loss value according to the predicted loss value and the classified loss value comprises: Obtaining a prediction weight corresponding to the prediction loss value and a classification weight corresponding to the classification loss value; A loss value is obtained according to the prediction loss value, the prediction weight, the classification loss value and the classification weight.
5. The method according to claim 3 or 4, characterized in that: The step of inputting the predicted classification value and the true classification value into the classification loss function to obtain the classification loss value includes: Determine the classification score corresponding to each predicted output image according to the predicted classification value and the true classification value of each pixel point in the predicted output image; Determine the time sequence weight corresponding to each predicted output image in the predicted output image subsequence according to the meteorological forecast timeliness; Obtaining a single image classification error value corresponding to each of the predicted output images according to the classification score value and the temporal weight; A classification error value corresponding to the predicted output image sequence is obtained according to each of the single image classification error values.
6. The method according to claim 5, characterized in that Determining the classification score value corresponding to each predicted output image according to the predicted classification value and the true classification value of each pixel point in each predicted output image includes: Comparing the predicted classification value of each pixel in the predicted output image with the true classification value for consistency; When the consistency comparison is passed, the pixel points that have passed the comparison are extracted as the correctly predicted pixel points; Classifying the correctly predicted pixel points according to the predicted classification values corresponding to the correctly predicted pixel points to obtain the correctly predicted pixel points of each category, and counting the number of correctly predicted pixels corresponding to the correctly predicted pixel points of each category; Classifying each pixel point in the predicted output image according to the predicted classification value to obtain predicted pixel points of each category, and counting the number of predicted classification values corresponding to the predicted pixel points of each category; The classification score value corresponding to each predicted output image is determined according to the number of predicted classification values and the number of correct predictions.
7. The method according to claim 6, characterized in that Determining the classification score value corresponding to each of the predicted output images according to the number of predicted classification values and the number of correct predictions includes: Obtaining a category weight factor corresponding to each of the predicted category values; The classification score value corresponding to each predicted output image is determined according to the predicted classification value quantity, the correct prediction quantity and the category weight factor.
8. A meteorological image prediction device, characterized in that: The device comprises: An image acquisition module is used to acquire a meteorological image to be predicted, wherein the meteorological image to be predicted includes a meteorological radar echo image, and the meteorological radar echo image displays the echo intensity of the radar; A prediction module is used to input the meteorological image to be predicted into a pre-trained meteorological prediction model, so as to predict the meteorological image to be predicted according to the prediction parameters in the meteorological prediction model to obtain a predicted image; the meteorological prediction model is trained according to a custom loss function, and the custom loss function includes a prediction loss function and a classification loss function, the prediction loss function is obtained according to the meteorological image to be predicted and the predicted image, and the classification loss function is obtained according to the true classification value of each pixel in the meteorological image to be predicted and the predicted classification value of each pixel in the predicted image; wherein the training method of the meteorological prediction model comprises: obtaining a training meteorological image sequence, the training meteorological image sequence The image sequence includes an input image subsequence and a real output image subsequence; the input image subsequence is input into the initial meteorological prediction model to obtain the predicted output image subsequence and the predicted classification value of each pixel in each predicted output image subsequence; the real classification value of each pixel in the real output image subsequence is obtained; the predicted output image subsequence and the real output image subsequence are input into the prediction loss function to obtain the predicted loss value; the predicted classification value and the real classification value are input into the classification loss function to obtain the classification loss value; the initial meteorological prediction model is adjusted according to the predicted loss value and the classification loss value to obtain the meteorological prediction model.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
