Weather forecasting method, device, computer equipment and storage medium
Through the combination of deep learning theory and image acquisition equipment, cloud detection results and meteorological data are used to solve the problem of inaccurate rainfall prediction in local areas by traditional weather prediction methods, achieving high accuracy and automated weather prediction.
Patent Information
- Application Number
- CN202010805800.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-12
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2040-08-12
AI Technical Summary
Traditional weather forecasting methods are difficult to accurately observe meteorological changes in local areas, resulting in inaccurate rainfall forecasts and affect traffic and life.
Deep learning theory is used to combine image acquisition equipment and meteorological data, and feature extraction and matrix generation are performed when cloud detection results are cumulonimbus clouds to predict whether to rainfall, and use historical data and visibility relationship to improve prediction accuracy.
High accuracy of rainfall prediction in local areas is achieved, labor and time costs are reduced, and the degree of automation of weather forecasts is improved.
Smart Images

Figure CN111932519B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of weather forecasting, and in particular to a weather forecasting method, apparatus, computer equipment and storage medium. Background Art
[0002] Rain can reduce visibility, which not only affects people's lives, but also interferes with transportation (urban transportation, highways, airport flight takeoffs and landings, land and water transportation, etc.) and health. Therefore, accurate prediction of rainfall and rainfall intensity has become an indispensable thing in life.
[0003] In traditional technology, the meteorological department can conduct a comprehensive analysis based on the meteorological data observed by meteorological observation equipment such as meteorological satellites and meteorological radars to predict the weather phenomena in the future within a certain period of time. Users can learn about future weather phenomena by checking the weather forecast. However, in related technologies, since meteorological observation equipment is usually far away from the ground and has limited resolution, it is difficult to observe the meteorological changes in local areas. Therefore, the weather prediction methods in traditional technologies are not accurate enough. Summary of the invention
[0004] Based on this, it is necessary to provide a weather forecasting method, device, computer equipment and storage medium that can accurately predict whether it will rain in a local area in response to the above technical problems.
[0005] In a first aspect, an embodiment of the present application provides a weather forecasting method, the method comprising:
[0006] Acquire a first image to be detected and meteorological data corresponding to the first image to be detected;
[0007] Identify the first image to be detected and obtain a cloud detection result;
[0008] When the cloud layer detection result is cumulonimbus cloud, feature extraction is performed on the first image to be detected to obtain an initial feature matrix;
[0009] Generate a target feature matrix according to the initial feature matrix and meteorological data;
[0010] According to the target feature matrix, the prediction result of whether it will rain or not is obtained.
[0011] In one embodiment, the prediction result of whether it will rain or not is obtained according to the target feature matrix, including:
[0012] Obtain a historical feature matrix, where the historical feature matrix is specifically generated based on historical images where the cloud layer detection result is cumulonimbus cloud and corresponding historical meteorological data, where the historical images are images acquired within a preset time period before the cloud layer detection result is identified as cumulonimbus cloud;
[0013] Identify the historical feature matrix and the target feature matrix to obtain the prediction result of whether it will rain.
[0014] In one embodiment, generating a target feature matrix according to an initial feature matrix and meteorological data includes:
[0015] Normalize the data of each meteorological element in the meteorological data;
[0016] The initial feature matrix and the normalized meteorological data are concatenated to obtain the target feature matrix.
[0017] In one embodiment, the meteorological element data includes at least one of wind speed, wind direction, temperature and humidity; normalizing each meteorological element data in the meteorological data includes:
[0018] Normalization processing is performed on at least one of the acquired wind speed, wind direction, temperature and humidity data.
[0019] In one embodiment, the cloud detection result further includes that it is raining; and the method further includes:
[0020] When the cloud detection result is that it is raining, visibility is obtained according to the first image to be detected;
[0021] According to the visibility, the corresponding rainfall intensity is queried from the pre-configured correspondence between visibility and rainfall intensity.
[0022] In one embodiment, the cloud detection result further includes that it is raining; and the method further includes:
[0023] When the cloud detection result is that it is raining, a second image to be detected is obtained, where the second image to be detected is an image obtained by photographing a marker at an observation point, and the second image to be detected and the first image to be detected are photographed in the same scene;
[0024] Identify the second image to be detected and obtain the clarity level of the marker;
[0025] Determine visibility based on the clarity level of the landmarks;
[0026] According to the visibility, the corresponding rainfall intensity is queried from the pre-configured correspondence between visibility and rainfall intensity.
[0027] In one embodiment, the visibility is determined based on the clarity level of the landmark, including:
[0028] Get the distance between the observation point and the landmark;
[0029] Obtaining the visibility level coefficient corresponding to the clarity level;
[0030] Get the product of the visibility level coefficient and the distance as the visibility.
[0031] In one embodiment, the first image to be detected is an image acquired by an image acquisition device; the method further comprises:
[0032] When collecting the first image to be detected, obtaining a lumen value obtained by detecting the light intensity;
[0033] According to the lumen value, querying the parameter value of the image acquisition device corresponding to the lumen value from the pre-configured correspondence between the lumen value and the parameter value of the image acquisition device;
[0034] The image acquisition device is set according to the queried parameter values of the image acquisition device.
[0035] In a second aspect, an embodiment of the present application provides a weather forecasting device, the device comprising:
[0036] An image acquisition module, used to acquire a first image to be detected and meteorological data corresponding to the first image to be detected;
[0037] An image recognition module is used to recognize a first image to be detected and obtain a cloud detection result;
[0038] A feature extraction module, used for extracting features from the first image to be detected to obtain an initial feature matrix when the cloud layer detection result is cumulonimbus cloud;
[0039] A matrix generation module, used for generating a target feature matrix according to an initial feature matrix and meteorological data;
[0040] The matrix recognition module is used to obtain the prediction result of whether it will rain or not according to the target feature matrix.
[0041] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the weather forecasting method described in any one of the embodiments of the first aspect are implemented.
[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the weather forecasting method described in any one of the embodiments of the first aspect above are implemented.
[0043] The above-mentioned weather forecasting method, apparatus, computer equipment and storage medium obtain a first image to be detected and meteorological data corresponding to the first image to be detected; identify the first image to be detected to obtain a cloud detection result; when the cloud detection result is cumulonimbus cloud, extract features from the first image to be detected to obtain an initial feature matrix; generate a target feature matrix based on the initial feature matrix and meteorological data; and obtain a prediction result of whether it will rain based on the target feature matrix. On the one hand, detecting whether it will rain based on deep learning theory and triggering the device to automatically perform weather forecasting can reduce labor costs and time costs; on the other hand, by combining the image of the cloud detection result being cumulonimbus cloud and the corresponding meteorological data, the prediction result of whether it will rain has a higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A diagram of an application environment of a weather forecasting method in an embodiment;
[0045] Figure 2 A schematic diagram of a weather forecasting method according to an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of a process for obtaining a historical feature matrix in one embodiment;
[0047] Figure 4 is a schematic diagram of the corresponding relationship between visibility and rainfall intensity in one embodiment;
[0048] Figure 5 A schematic diagram of a flow chart of a step of predicting rainfall intensity in an embodiment;
[0049] Figure 6 A schematic diagram of a flow chart of steps for setting parameter values for image acquisition settings in one embodiment;
[0050] Figure 7 A schematic diagram of a weather forecasting method according to an embodiment of the present invention;
[0051] Figure 8 is a schematic diagram of a weather forecasting system in one embodiment;
[0052] Fig. 9 is a structural block diagram of a weather forecasting device in one embodiment;
[0053] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0054] 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.
[0055] The weather forecasting method provided in this application can be applied to Figure 1 In the application environment shown. The application environment includes a terminal 110 and an image acquisition device 120. At least one pre-trained deep learning model is deployed in the terminal 110, which is used to identify the cloud category of the image acquired by the image acquisition device 120, extract features from the image, and predict whether it will rain. The deep learning model is not limited to a classification model and a feature extraction network. The deep learning model can be pre-trained using the terminal 110 or other terminals outside the terminal 110. The image acquisition device 120 can be an embedded device in the terminal 110 or a separate device. Specifically, the terminal 110 obtains the first image to be detected acquired by the image acquisition device 120, and obtains meteorological data corresponding to the first image to be detected; the terminal 110 identifies the first image to be detected and obtains a cloud detection result; when the cloud detection result is cumulonimbus cloud, the terminal 110 extracts features from the first image to be detected to obtain an initial feature matrix; generates a target feature matrix based on the initial feature matrix and the meteorological data; and obtains a prediction result of whether it will rain based on the target feature matrix. The terminal 110 may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, and portable mobile devices, and the image acquisition device 120 is not limited to various cameras and video cameras.
[0056] In one embodiment, Figure 2 As shown, a weather prediction method is provided, which is applied to Figure 1 The terminal 110 in the example is used as an example to illustrate, and the following steps are included:
[0057] Step S210, obtaining a first image to be detected and meteorological data corresponding to the first image to be detected.
[0058] Among them, the first image to be detected can be obtained by real-time or periodic acquisition of the image acquisition device toward the sky. The number of the first images to be detected can be one or more. The meteorological data corresponding to the first image to be detected refers to the meteorological data aligned in time with the first image to be detected. The meteorological data can be obtained by detection by a meteorological detection instrument. Specifically, the request to predict whether it will rain can be triggered in real time or periodically. After the terminal obtains the request to predict whether it will rain, the first image to be detected acquired by the image acquisition device and the meteorological data corresponding to the first image to be detected are obtained.
[0059] Step S220, identifying the first image to be detected and obtaining a cloud detection result.
[0060] Among them, the cloud layer detection result may refer to the cloud layer category to which the first image to be detected belongs. The cloud layer category is not limited to cumulonimbus clouds, non-cumulonimbus clouds, nimbostratus clouds, etc., depending on the specific situation. Specifically, after acquiring the first image to be detected, the terminal inputs the first image to be detected into a pre-trained first classification model. The cloud layer detection result is obtained by identifying the first image to be detected by the first classification model. The first classification model can adopt any deep learning model that can be used for classification, for example, LeNet (a convolutional neural network), AlexNet (a convolutional neural network), ResNet (Residual Network, deep residual network), etc.
[0061] Step S230: When the cloud layer detection result is cumulonimbus cloud, feature extraction is performed on the first image to be detected to obtain an initial feature matrix.
[0062] Specifically, when the cloud layer detection result output by the classification model obtained by the terminal is cumulonimbus cloud, a pre-trained feature extraction network is used to extract features from the first image to be detected, and the extracted feature matrix is used as the initial feature matrix. The feature extraction network can use any deep learning network that can be used for feature extraction, for example, AlexNet (a convolutional neural network), VGGNet (a deep convolutional neural network), GoogleNet (a convolutional neural network), etc.
[0063] Step S240: generating a target feature matrix according to the initial feature matrix and the meteorological data.
[0064] Step S250, obtaining a prediction result of whether it will rain or not according to the target feature matrix.
[0065] Specifically, the meteorological data may include multiple meteorological element data. Meteorological elements refer to various elements that indicate the physical state and physical phenomena of the atmosphere, such as air temperature, air pressure, wind speed, temperature, humidity, etc. After extracting the features of the first image to be detected to obtain the initial feature matrix, the initial feature matrix and the meteorological element data contained in the meteorological data can be spliced to obtain the target feature matrix. The target feature matrix is input into the pre-trained second classification model. The target feature matrix is identified by the second classification model to obtain a prediction result of whether it rains. The second classification model can use any deep learning model that can be used for classification, for example, LeNet (a convolutional neural network), AlexNet (a convolutional neural network), ResNet (Residual Network, deep residual network), LSTM network (Long Short-Term Memory, long short-term memory artificial neural network), etc.
[0066] In the above weather forecasting method, on the one hand, by detecting whether it is raining based on deep learning theory and triggering the device to automatically perform weather forecasting, it can reduce labor costs and time costs; on the other hand, by combining the cloud detection result as an image of cumulonimbus clouds and the corresponding meteorological data, the prediction result of whether it is raining has a higher accuracy.
[0067] In one embodiment, Figure 3 As shown, step S250, obtaining a prediction result of whether it is raining or not according to the target feature matrix, includes the following steps:
[0068] Step S251, obtaining a historical feature matrix, the historical feature matrix is generated based on historical images of cloud layer detection results being cumulonimbus clouds and corresponding historical meteorological data, the historical images are images obtained within a preset time period before the cloud layer detection results are identified as cumulonimbus clouds.
[0069] Step S252, identifying the historical feature matrix and the target feature matrix, and obtaining a prediction result of whether it will rain.
[0070] Specifically, in this embodiment, if the cloud layer category of the first image to be detected is identified as cumulonimbus cloud by the first classification model, then the historical image obtained within a preset time period before the first image to be detected is obtained, and the historical image is an image of cumulonimbus cloud as a cloud layer detection result, and the saved historical feature matrix corresponding to the historical image is obtained. The generation method of the historical feature matrix can refer to Figure 2 The method for generating the target feature matrix in the corresponding embodiment will not be described in detail here. The historical feature matrix and the target feature matrix are input into the time series classification model, and the prediction result of whether it is raining is obtained through the time series classification model.
[0071] Exemplarily, the first image to be detected is pre-configured to be collected periodically, and the period may be once every 30 minutes. The preset time period is 6 hours. When the cloud layer detection result of the first image to be detected is cumulonimbus cloud, the historical feature matrix corresponding to the historical image within 6 hours before the first image to be detected is obtained. The historical feature matrix and / or the target feature matrix in each period are identified by the time series classification model to obtain a prediction result of whether it will rain.
[0072] In this embodiment, by adopting a time series classification model, whether it will rain is predicted based on the currently acquired target feature matrix and the historical feature matrix acquired in a preset time period before the current moment, and utilizing the time correlation characteristics of meteorological data, the accuracy of weather forecasting can be improved.
[0073] In one embodiment, in step S240, a target feature matrix is generated based on the initial feature matrix and the meteorological data, including: normalizing each meteorological element data in the meteorological data; and concatenating the initial feature matrix and the normalized meteorological data to obtain the target feature matrix.
[0074] Specifically, the height (row of the matrix) of the initial feature matrix obtained by extracting features from the first image to be detected through the feature extraction network can be pre-configured to be 1. When the cloud layer detection result of the first image to be detected is cumulonimbus cloud, each meteorological element data in the meteorological data is normalized to obtain the normalized value corresponding to each meteorological element data. Then, the initial feature matrix and each meteorological element data after normalization are concatenated to obtain the target feature matrix.
[0075] In this embodiment, by combining the cloud detection result of cumulonimbus cloud image and the corresponding meteorological data, the prediction result of whether it will rain or not has a higher accuracy; by normalizing the data of each meteorological element in the meteorological data and then splicing them, the recognition accuracy of the model can be improved, and the calculation process of the model can also be simplified.
[0076] In one embodiment, the meteorological element data includes at least one of wind speed, wind direction, temperature and humidity; each meteorological element data in the meteorological data is normalized, including: normalizing at least one of the acquired wind speed, wind direction, temperature and humidity data.
[0077] Among them, wind speed, wind direction, temperature and humidity are meteorological elements closely related to rainfall. Wind speed and wind direction can be detected by an anemometer. Temperature and humidity can be detected by a thermometer and hygrometer. The anemometer and wind direction instrument and the thermometer and hygrometer are connected to the terminal, and can transmit the collected wind speed, wind direction, temperature and humidity data to the terminal. Specifically, when the terminal obtains that the cloud layer detection result of the first image to be detected is cumulonimbus cloud, at least one of the acquired wind speed, wind direction, temperature and humidity data is normalized to obtain at least one normalized value corresponding to each of the at least one wind speed, wind direction, temperature and humidity data. Then, the initial feature matrix and at least one of the normalized wind speed, wind direction, temperature and humidity data are spliced to obtain the target feature matrix.
[0078] In this embodiment, by selecting wind speed, wind direction, temperature and humidity which are closely related to rainfall as meteorological element data involved in weather forecasting, the weather forecast is made more targeted, thereby improving the accuracy of the weather forecast.
[0079] In one embodiment, the cloud detection result also includes rain; the method further includes: when the cloud detection result is that it is raining, obtaining visibility based on the first image to be detected; based on the visibility, querying and obtaining the corresponding rainfall intensity from a pre-configured correspondence between visibility and rainfall intensity.
[0080] Among them, the corresponding relationship between visibility and rainfall intensity can be summarized from the historical data of visibility and rainfall intensity. Figure 4 The correspondence between visibility and rainfall intensity in one embodiment is exemplified. Specifically, in this embodiment, the cloud detection result also includes rain. When the terminal identifies that the cloud detection result of the first image to be detected is that it is raining, the first image to be detected can be detected based on deep learning theory to obtain visibility, or the first detection image can be analyzed based on image edges or based on FFT (Fast Fourier Fransform) and other methods to obtain visibility. Then, according to the visibility, the corresponding rainfall intensity is queried from the pre-configured correspondence between visibility and rainfall intensity.
[0081] In this embodiment, when the cloud detection result of the first image to be detected is that it is raining, the rainfall intensity is further detected automatically according to the visibility. On the one hand, the automation level of weather forecasting can be improved, and the time and manpower costs can be reduced; on the other hand, by predicting the rainfall intensity, users can be informed of the rainfall conditions in a timely manner, thereby avoiding the adverse effects of rainfall on people's lives and travel.
[0082] In one embodiment, Figure 5 As shown, the cloud detection result also includes that it is raining; the method also includes:
[0083] Step S510, when the cloud detection result is that it is raining, a second image to be detected is obtained, the second image to be detected is an image obtained by photographing a marker at an observation point, and the second image to be detected and the first image to be detected are photographed in the same scene.
[0084] Step S520, identifying the second image to be detected, and obtaining the clarity level of the marker.
[0085] Step S530, determining visibility according to the clarity level of the landmark;
[0086] Step S540: According to the visibility, the corresponding rainfall intensity is queried from the pre-configured correspondence between visibility and rainfall intensity.
[0087] The observation point refers to the location of the image acquisition device that acquires the first image to be detected and the second image to be detected. The same scene refers to the same time and the same place. The corresponding relationship between visibility and rainfall intensity can be summarized from the historical data of visibility and rainfall intensity. Figure 4 The correspondence between visibility and rainfall intensity in one embodiment is exemplified. Specifically, in this embodiment, the cloud detection result also includes that it is raining. When the terminal identifies that the cloud detection result of the first image to be detected is that it is raining, a second image to be detected is obtained by capturing a marker in the same scene by an image acquisition device. The terminal can input the second image to be detected into a pre-trained third classification model, and identify the second image to be detected by the third classification model to obtain a clarity level of the marker. Then, the visibility is determined according to the clarity level of the marker, for example, the corresponding visibility is found from the pre-configured correspondence between the clarity level of the marker and the visibility. Then, according to the visibility, the corresponding rainfall intensity is queried from the pre-configured correspondence between visibility and rainfall intensity.
[0088] In this embodiment, when the cloud detection result of the first image to be detected is that it is raining, the corresponding visibility is determined according to the clarity level of the marker, and then the rainfall intensity is automatically detected according to the visibility. On the one hand, the automation level of weather forecasting can be improved and the time and labor costs can be reduced; on the other hand, by predicting the visibility according to the clarity level of the marker, the prediction accuracy of the visibility can be improved, thereby improving the detection accuracy of the rainfall intensity.
[0089] In one embodiment, step S530, determining visibility according to the clarity level of the marker, includes: obtaining the distance between the observation point and the marker; obtaining a visibility level coefficient corresponding to the clarity level; obtaining the product of the visibility level coefficient and the distance as visibility.
[0090] Specifically, the distance between the observation point and the marker can be manually measured and input into the terminal in advance. After obtaining the clarity level of the marker, the terminal queries and obtains the visibility level coefficient corresponding to the clarity level according to the obtained clarity level of the marker. The product of the visibility level coefficient and the distance is calculated as visibility. The visibility level coefficient can be obtained through multiple tests.
[0091] Exemplarily, the clarity level of the marker includes the marker being clearly visible, the marker being visible at the edge, and the marker being fuzzy and visible. The visibility level coefficients corresponding to the marker being clearly visible, the marker being visible at the edge, and the marker being fuzzy and visible are 2.5, 1.5, and 1.0, respectively. If the clarity level is that the marker is clearly visible, then visibility = distance * 2.5; if the clarity level is that the marker is visible at the edge, then visibility = distance * 1.5; if the clarity level is that the marker is fuzzy and visible, then visibility = distance * 1.0.
[0092] In this embodiment, by determining the visibility coefficient according to the clarity level of the marker and then calculating the visibility in the current shooting scene, the visibility in a local range of the current shooting scene can be accurately estimated.
[0093] In one embodiment, the first image to be detected is an image acquired by an image acquisition device; Figure 6 As shown, the method also includes:
[0094] Step S610, when collecting the first image to be detected, obtaining the lumen value obtained by detecting the light intensity.
[0095] Step S620: According to the lumen value, query the parameter value of the image acquisition device corresponding to the lumen value from the pre-configured correspondence between the lumen value and the parameter value of the image acquisition device.
[0096] Step S630: setting the image acquisition device according to the queried parameter values of the image acquisition device.
[0097] Among them, the lumen value refers to the luminous flux. Luminous flux describes the ability of a light source to produce a strong visual response per unit time. The lumen value can be detected by a photometer. The photometer is connected to the terminal so that the collected lumen value can be transmitted to the terminal in real time. Specifically, in the process of the image acquisition device acquiring the first image to be detected, the terminal obtains the lumen value obtained by the photometer detecting the light intensity. Then, according to the obtained lumen value, the parameter value of the image acquisition device corresponding to the obtained lumen value is queried from the correspondence between the pre-configured lumen value and the parameter value of the image acquisition device. Then, the parameter value of the image acquisition device obtained by the query is automatically assigned to the image acquisition device, so as to realize the adaptive adjustment of the parameters of the image acquisition device.
[0098] Table 1 exemplarily shows the correspondence between the lumen value and the parameter value of the image acquisition device in one embodiment. The correspondence can be obtained by synchronously recording the lumen value of the light meter and the parameter value of the image acquisition device when the image acquisition device is used to acquire images, and summarizing the results of continuous observation for multiple days. The parameters of the image acquisition device include, but are not limited to, automatic gain control (AGC), manual shutter (MShutter), and noise reduction (Denoise).
[0099] Table 1: Correspondence between lumen values and parameter values of image acquisition equipment
[0100]
[0101]
[0102] In this embodiment, by pre-configuring the correspondence between the lumen value and the parameter value of the image acquisition device, the control terminal adaptively sets the parameter value of the image acquisition device according to the lumen value in the current scene, so that the image acquisition device can capture higher quality images and reduce labor costs.
[0103] In one embodiment, a weather forecasting method is provided. Figure 7 Take the weather forecast system 700 as an example. Figure 7 As shown, the weather forecast system 700 includes an image acquisition device 710, a high-precision light meter brightness meter 720, an anemometer 730, a thermometer 740 and a terminal 750. The image acquisition device 710, the high-precision light meter brightness meter 720, the anemometer 730, and the thermometer 740 are connected to the terminal 750 respectively. The image acquisition device 710 is installed on a pan-tilt platform so that the image can be collected by rotating 360°. The above-mentioned weather forecast system 700 is deployed at an observation point to detect the rainfall conditions at the observation point. In addition, at least one marker can be deployed near the observation point for visibility detection.
[0104] In this embodiment, the image acquisition device 710 preferably uses a high-sensitivity imager. Due to its high sensitivity and sensitivity to light, a high-sensitivity imager can capture clear color images at night. Compared with ordinary imagers, a high-sensitivity imager can capture images around the clock, so that it can better combine meteorological data to make weather forecasts throughout the day, making weather forecasts more applicable. Figure 8 As shown, the weather prediction method includes the following steps:
[0105] Step S801: The terminal obtains a lumen value obtained by detecting light intensity using a high-precision optical luminance meter.
[0106] Step S802: According to the obtained lumen value, query the parameter value of the high-sensitivity imager corresponding to the obtained lumen value from the pre-configured correspondence between the lumen value and the parameter value of the high-sensitivity imager.
[0107] Step S803, setting the exposure, gain, noise reduction and other parameters of the high-sensitivity imager according to the queried parameter values of the high-sensitivity imager.
[0108] Step S804: the terminal obtains a first image to be detected, and wind speed, wind direction, temperature and humidity data corresponding to the first image to be detected.
[0109] Step S805: Identify the first image to be detected by using a first classification model to obtain a cloud detection result. The first classification model may be a pre-trained AlexNet model.
[0110] The following is an explanation of the training generation process of the first classification model:
[0111] First, check the weather forecast system. When it is determined that the temperature drops to the dew point or below the dew point and the relative humidity is high, use a high-sensitivity imager to collect cloud sample images facing the sky. Then, annotate the collected cloud sample images and classify the cloud sample images into three categories: cumulonimbus clouds, non-cumulonimbus clouds, and raining clouds. Finally, use the annotated cloud sample images to train the first classification model until the first classification model training is stable, and a trained first classification model is obtained.
[0112] Step S806: When the cloud layer detection result is cumulonimbus cloud, feature extraction is performed on the first image to be detected through a feature extraction network to obtain an initial feature matrix. The feature extraction network may use a pre-trained AlexNet model.
[0113] Step S807, generating a target feature matrix according to the initial feature matrix and the corresponding wind speed, wind direction, temperature and humidity data.
[0114] Specifically, the wind speed, wind direction, temperature and humidity data are normalized; the initial feature matrix and the normalized wind speed, wind direction, temperature and humidity data are concatenated to obtain a target feature matrix.
[0115] Step S808, obtaining a historical feature matrix. The historical feature matrix is generated based on the historical image of the cloud layer detection result being cumulonimbus cloud and the corresponding historical meteorological data. The historical image is an image obtained within a preset time period before the cloud layer detection result is identified as cumulonimbus cloud. The method for obtaining the historical feature matrix can refer to Figure 3 The corresponding embodiments are not described in detail here.
[0116] Step S809, the historical feature matrix and the target feature matrix are identified by the time series classification model to obtain a prediction result of whether it will rain. The time series classification model may adopt an LSTM network (Long Short-Term Memory, long short-term memory artificial neural network).
[0117] The following is an explanation of the training and generation process of the time series classification model:
[0118] First, obtain multiple cloud sample images with cumulonimbus cloud detection results and the corresponding wind speed, wind direction, temperature and humidity historical data. Use the feature extraction network to extract features from multiple cloud sample images with cumulonimbus cloud detection results, and obtain an initial sample feature matrix (feature map) of size N*C*H*W. Among them, N represents the number of cloud sample images input to the feature extraction network, C represents the number of feature channels, H represents the height of the feature map (H is 1 after feature extraction), and W represents the width of the feature map. Then, the initial sample feature matrix is spliced with the normalized wind speed, wind direction, temperature and humidity data in width to obtain the target sample feature matrix. The target sample feature matrix is labeled with the actual rainfall results. The target sample feature matrix is input into the LSTM network for training. After the model training is stable, a binary classification model for whether it will rain or not is obtained.
[0119] Step S810: When the first classification model outputs a cloud detection result indicating that it is raining, detection is performed based on the first image to be detected or the second image to be detected to obtain visibility.
[0120] Specifically, the specific implementation method of obtaining visibility by detecting the first image to be detected or the second image to be detected can be described with reference to the above-mentioned embodiment and will not be elaborated herein.
[0121] Step S811, according to the visibility, query and obtain the corresponding rainfall intensity from the pre-configured correspondence between visibility and rainfall intensity.
[0122] It should be understood that, although the various steps in the above flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above flowchart may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0123] In one embodiment, Fig. 9 As shown, a weather prediction device 900 is provided, comprising: an image acquisition module 901, an image recognition module 902, a feature extraction module 903, a matrix generation module 904 and a matrix recognition module 905, wherein:
[0124] The image acquisition module 901 is used to acquire a first image to be detected and meteorological data corresponding to the first image to be detected;
[0125] An image recognition module 902 is used to recognize a first image to be detected and obtain a cloud detection result;
[0126] The feature extraction module 903 is used to extract features from the first image to be detected to obtain an initial feature matrix when the cloud layer detection result is cumulonimbus cloud;
[0127] A matrix generation module 904 is used to generate a target feature matrix according to the initial feature matrix and meteorological data;
[0128] The matrix identification module 905 is used to obtain a prediction result of whether it will rain or not according to the target feature matrix.
[0129] In one embodiment, the matrix identification module 905 further includes:
[0130] The matrix acquisition unit is used to obtain a historical feature matrix, which is generated based on historical images of cloud layer detection results being cumulonimbus clouds and corresponding historical meteorological data, and the historical images are images acquired within a preset time period before the cloud layer detection result is identified as cumulonimbus clouds; the matrix identification unit is used to identify the historical feature matrix and the target feature matrix to obtain a prediction result of whether it will rain.
[0131] In one embodiment, the matrix generation module 904 includes: a normalization processing unit for normalizing each meteorological element data in the meteorological data; and a splicing unit for splicing the initial feature matrix and the normalized meteorological data to obtain a target feature matrix.
[0132] In one embodiment, the meteorological element data includes at least one of wind speed, wind direction, temperature and humidity; and the normalization processing unit is used to normalize at least one of the acquired wind speed, wind direction, temperature and humidity data.
[0133] In one embodiment, the cloud detection result also includes rain; the device also includes: a visibility detection module, which is used to obtain visibility based on the first image to be detected when the cloud detection result is that it is raining; and a first query module, which is used to query and obtain the corresponding rainfall intensity from a pre-configured correspondence between visibility and rainfall intensity based on the visibility.
[0134] In one embodiment, the cloud detection result also includes rain; the image acquisition module 901 is also used to acquire a second image to be detected when the cloud detection result is rain, the second image to be detected is an image obtained by photographing a marker at an observation point, and the second image to be detected and the first image to be detected are photographed in the same scene; the weather prediction device 900 also includes: a clarity level recognition module, used to identify the second image to be detected and obtain the clarity level of the marker; a visibility determination module, used to determine visibility according to the clarity level of the marker; a second query module, used to query and obtain the corresponding rainfall intensity according to the visibility from a pre-configured correspondence between visibility and rainfall intensity.
[0135] In one embodiment, the visibility determination module includes: an acquisition unit for acquiring the distance between the observation point and the landmark, and acquiring the visibility level coefficient corresponding to the clarity level; and a calculation unit for acquiring the product of the visibility level coefficient and the distance as visibility.
[0136] In one embodiment, the first image to be detected is an image acquired by an image acquisition device; the weather prediction device 900 also includes: a lumen value acquisition module, used to acquire the lumen value obtained by detecting the light intensity when acquiring the first image to be detected; a query module, used to query the parameter value of the image acquisition device corresponding to the lumen value from the correspondence between the pre-configured lumen value and the parameter value of the image acquisition device according to the lumen value; a setting module, used to set the image acquisition device according to the queried parameter value of the image acquisition device.
[0137] For the specific definition of the weather prediction device, please refer to the definition of the weather prediction method above, which will not be repeated here. Each module in the above-mentioned weather 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 in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0138] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.10As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a weather forecasting method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0139] Those skilled in the art will understand that Fig.10 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.
[0140] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0141] Acquire a first image to be detected and meteorological data corresponding to the first image to be detected; identify the first image to be detected and obtain a cloud detection result; when the cloud detection result is cumulonimbus cloud, perform feature extraction on the first image to be detected and obtain an initial feature matrix; generate a target feature matrix based on the initial feature matrix and the meteorological data; and obtain a prediction result of whether it will rain based on the target feature matrix.
[0142] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0143] Obtain a historical feature matrix, which is generated based on historical images of cloud layer detection results being cumulonimbus clouds and corresponding historical meteorological data, where the historical images are images acquired within a preset time period before the cloud layer detection result is identified as cumulonimbus clouds; identify the historical feature matrix and the target feature matrix to obtain a prediction result of whether it will rain.
[0144] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0145] Each meteorological element data in the meteorological data is normalized; the initial feature matrix and the normalized meteorological data are concatenated to obtain the target feature matrix.
[0146] In one embodiment, the meteorological element data includes at least one of wind speed, wind direction, temperature and humidity; when the processor executes the computer program, the processor further implements the following steps:
[0147] Normalization processing is performed on at least one of the acquired wind speed, wind direction, temperature and humidity data.
[0148] In one embodiment, the cloud layer detection result also includes that it is raining; when the processor executes the computer program, the following steps are also implemented:
[0149] When the cloud detection result is that it is raining, visibility is obtained according to the first image to be detected; and according to the visibility, the corresponding rainfall intensity is queried from a pre-configured correspondence between visibility and rainfall intensity.
[0150] In one embodiment, the cloud layer detection result also includes that it is raining; when the processor executes the computer program, the following steps are also implemented:
[0151] When the cloud detection result is that it is raining, a second image to be detected is obtained, which is an image obtained by photographing a marker at an observation point, and the second image to be detected and the first image to be detected are photographed in the same scene; the second image to be detected is identified to obtain a clarity level of the marker; visibility is determined based on the clarity level of the marker; based on the visibility, a corresponding rainfall intensity is queried from a pre-configured correspondence between visibility and rainfall intensity.
[0152] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0153] Obtain the distance between the observation point and the landmark; obtain the visibility level coefficient corresponding to the clarity level; obtain the product of the visibility level coefficient and the distance as the visibility.
[0154] In one embodiment, the first image to be detected is an image acquired by an image acquisition device; when the processor executes the computer program, the following steps are also implemented:
[0155] When acquiring the first image to be detected, the lumen value obtained by detecting the light intensity is obtained; according to the lumen value, the parameter value of the image acquisition device corresponding to the lumen value is queried from the correspondence between the pre-configured lumen value and the parameter value of the image acquisition device; and the image acquisition device is set according to the queried parameter value of the image acquisition device.
[0156] 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:
[0157] Acquire a first image to be detected and meteorological data corresponding to the first image to be detected; identify the first image to be detected and obtain a cloud detection result; when the cloud detection result is cumulonimbus cloud, perform feature extraction on the first image to be detected and obtain an initial feature matrix; generate a target feature matrix based on the initial feature matrix and the meteorological data; and obtain a prediction result of whether it will rain based on the target feature matrix.
[0158] In one embodiment, the computer program, when executed by a processor, implements the following steps:
[0159] Obtain a historical feature matrix, which is generated based on historical images of cloud layer detection results being cumulonimbus clouds and corresponding historical meteorological data, where the historical images are images acquired within a preset time period before the cloud layer detection result is identified as cumulonimbus clouds; identify the historical feature matrix and the target feature matrix to obtain a prediction result of whether it will rain.
[0160] In one embodiment, the computer program, when executed by a processor, implements the following steps:
[0161] Each meteorological element data in the meteorological data is normalized; the initial feature matrix and the normalized meteorological data are concatenated to obtain the target feature matrix.
[0162] In one embodiment, the meteorological element data includes at least one of wind speed, wind direction, temperature and humidity; when the computer program is executed by the processor, the following steps are implemented:
[0163] Normalization processing is performed on at least one of the acquired wind speed, wind direction, temperature and humidity data.
[0164] In one embodiment, the cloud layer detection result further includes that it is raining; when the computer program is executed by the processor, the following steps are implemented:
[0165] When the cloud detection result is that it is raining, visibility is obtained according to the first image to be detected; and according to the visibility, the corresponding rainfall intensity is queried from a pre-configured correspondence between visibility and rainfall intensity.
[0166] In one embodiment, the cloud layer detection result further includes that it is raining; when the computer program is executed by the processor, the following steps are implemented:
[0167] When the cloud detection result is that it is raining, a second image to be detected is obtained, which is an image obtained by photographing a marker at an observation point, and the second image to be detected and the first image to be detected are photographed in the same scene; the second image to be detected is identified to obtain a clarity level of the marker; visibility is determined based on the clarity level of the marker; based on the visibility, a corresponding rainfall intensity is queried from a pre-configured correspondence between visibility and rainfall intensity.
[0168] In one embodiment, the computer program, when executed by a processor, implements the following steps:
[0169] Obtain the distance between the observation point and the landmark; obtain the visibility level coefficient corresponding to the clarity level; obtain the product of the visibility level coefficient and the distance as the visibility.
[0170] In one embodiment, the first image to be detected is an image acquired by an image acquisition device; when the computer program is executed by a processor, the following steps are implemented:
[0171] When acquiring the first image to be detected, the lumen value obtained by detecting the light intensity is obtained; according to the lumen value, the parameter value of the image acquisition device corresponding to the lumen value is queried from the correspondence between the pre-configured lumen value and the parameter value of the image acquisition device; and the image acquisition device is set according to the queried parameter value of the image acquisition device.
[0172] 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 can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can 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).
[0173] 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.
[0174] The above-mentioned 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 weather forecasting method, characterized in that: The method comprises: Acquire a first image to be detected and meteorological data corresponding to the first image to be detected; Identify the first to-be-detected image by using a first classification model to obtain a cloud detection result; When the cloud layer detection result is cumulonimbus cloud, performing feature extraction on the first image to be detected to obtain an initial feature matrix; Generate a target feature matrix according to the initial feature matrix and the meteorological data; Obtaining a prediction result of whether it will rain or not according to the target feature matrix through a second classification model; The cloud detection result also includes that it is raining; and the method further includes: When the cloud layer detection result is that it is raining, a second image to be detected is obtained, where the second image to be detected is an image obtained by photographing a marker at an observation point, and the second image to be detected and the first image to be detected are photographed in the same scene; Identifying the second image to be detected to obtain a clarity level of the marker; Obtaining the distance between the observation point and the landmark; Obtaining a visibility level coefficient corresponding to the clarity level; Obtaining the product of the visibility level coefficient and the distance as the visibility; According to the visibility, the corresponding rainfall intensity is queried from a pre-configured correspondence between visibility and rainfall intensity.
2. The method according to claim 1, characterized in that: The step of obtaining a prediction result of whether it will rain or not according to the target feature matrix by using the second classification model includes: Obtaining a historical feature matrix, wherein the historical feature matrix is specifically generated according to a historical image in which the cloud layer detection result is cumulonimbus cloud and corresponding historical meteorological data, wherein the historical image is an image acquired within a preset time period before the cloud layer detection result is identified as cumulonimbus cloud; The historical feature matrix and the target feature matrix are identified by a second classification model to obtain a prediction result of whether it will rain.
3. The method according to claim 1, characterized in that The step of generating a target feature matrix according to the initial feature matrix and the meteorological data comprises: Normalizing each meteorological element data in the meteorological data; The initial feature matrix and the normalized meteorological data are concatenated to obtain the target feature matrix.
4. The method according to claim 3, characterized in that The meteorological element data includes at least one of wind speed, wind direction, temperature and humidity; the normalization of each meteorological element data in the meteorological data includes: Normalization processing is performed on at least one of the acquired wind speed, wind direction, temperature and humidity data.
5. The method according to any one of claims 1 to 4, characterized in that: The first image to be detected is an image acquired by an image acquisition device; the method further includes: When acquiring the first image to be detected, obtaining a lumen value obtained by detecting the light intensity; According to the lumen value, querying the parameter value of the image acquisition device corresponding to the lumen value from the pre-configured correspondence between the lumen value and the parameter value of the image acquisition device; The image acquisition device is set according to the queried parameter values of the image acquisition device.
6. The method according to any one of claims 1 to 4, characterized in that: The first classification model is a pre-trained convolutional neural network AlexNet model.
7. The method according to any one of claims 1 to 4, characterized in that: The second classification model is a long short-term memory artificial neural network LSTM.
8. The method according to any one of claims 1 to 4, characterized in that: The step of identifying the second image to be detected and obtaining the clarity level of the marker includes: The second image to be detected is input into a pre-trained third classification model, and the second image to be detected is identified by the third classification model to obtain the clarity level of the marker.
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 8 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 8 are implemented.
