Weather identification method and device

By using a multi-level classification model in the video surveillance system to combine video frames and target object behaviors, weather categories are identified, which solves the problem that existing technology cannot distinguish weather categories and improves recognition accuracy.

CN111753610BInactive Publication Date: 2024-09-24SHANGHAI GOLDWAY INTELLIGENT TRANSPORTATION SYST CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910745480.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-13
Publication Date
2024-09-24
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing video surveillance technology cannot effectively identify weather categories and can only identify the pixel locations of rain and snow, which cannot meet the weather detection needs of scenes such as highways.

Method used

By obtaining the target video frame and inputting it into the trained classification model, the first classification model is used to identify the road condition. If the recognition result is a specified category, the second classification model is further used to determine the weather category based on the action behavior of the target object, such as through a vehicle. Or the behavior of pedestrians determines whether it is raining or sunny.

Benefits of technology

It improves the accuracy of weather category recognition, can effectively distinguish sunny days, rainy days and snowy days, and meets the weather detection needs of scenes such as highways.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111753610B
    Figure CN111753610B
Patent Text Reader

Abstract

The present application provides a weather recognition method and device, which obtains a target video frame for weather recognition; inputs the target video frame into a trained first classification model, so that the first classification model identifies the weather category and outputs it based on the road conditions in the input target video frame, and when the weather category is a specified category, inputs the target video frame into a trained second classification model, so that the second classification model is used to further accurately determine the weather category based on the input target video frame and output it, so the present application can improve the accuracy of weather category recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video surveillance technology, and in particular to a weather identification method and device. Background Art

[0002] With the widespread use of video surveillance devices, the number of video surveillance devices installed on highways has also increased rapidly. Usually, one video surveillance device is installed per kilometer on highways. In addition to being used for traffic violations and other inspections, the video images taken by these video surveillance devices can also be used to detect weather conditions in video images through AI (Artificial Intelligence). They can also be combined with satellites, automatic observation stations, and weather radars to improve the accuracy, refinement, and timeliness of weather forecasts through multi-dimensional data fusion and big data. This can not only meet the monitoring deployment needs on highways, but also use monitoring video images to assist weather forecasting. Therefore, the method of identifying weather categories based on video images is very practical.

[0003] However, the current technology for identifying weather categories based on video images is still imperfect. The existing technology can only identify the locations of rain and snow pixels at most, but cannot specifically distinguish the weather categories and cannot meet the needs of weather detection. Summary of the invention

[0004] In view of this, the present application provides a weather identification method and device to distinguish weather categories.

[0005] Specifically, the present application is implemented through the following technical solutions:

[0006] According to a first aspect of an embodiment of the present application, a weather identification method is provided, the method comprising:

[0007] Obtain target video frames for weather recognition;

[0008] Inputting the target video frame into a trained first classification model, so that the first classification model recognizes and outputs the weather category according to the road conditions in the input target video frame;

[0009] When the weather category is a designated category, the target video frame is input into a trained second classification model, so as to utilize the second classification model to further accurately determine the weather category based on the input target video frame and output it.

[0010] As an embodiment, the target video frame is input into a trained second classification model, so as to use the second classification model to further accurately determine the weather category according to the input target video frame and output it, including:

[0011] A partial picture containing the target object is captured from the target video frame, and the partial picture is input into the second classification model, so as to use the second classification model to further accurately determine the weather category based on the input partial picture and output it.

[0012] As an embodiment, capturing a partial picture from the target video frame includes:

[0013] Inputting the target video frame into a trained target detection model so that the target detection model can identify the category and location information of the target object from the target video frame;

[0014] A local image is captured from the target video frame according to the category and location information of the target object.

[0015] As an embodiment, the step of using the second classification model to further accurately determine the weather category based on the input local image includes:

[0016] Using the second classification model to identify the action behavior of the target object;

[0017] The weather category is determined according to the action behavior of the target object.

[0018] As an embodiment, determining the weather category according to the action behavior of the target object includes:

[0019] When the target object is a person, if the target object is holding an umbrella, the weather category is determined to be rainy; if the target object is not holding an umbrella, the weather category is determined to be sunny;

[0020] When the target object is a vehicle, if the target object creates splashes on the road surface, the weather category is determined to be rainy; if the target object does not create splashes on the road surface, the weather category is determined to be sunny.

[0021] As an embodiment, the target video frame is input into a trained first classification model, so that the first classification model recognizes and outputs the weather category according to the road condition in the input target video frame, including:

[0022] The first classification model is used to identify the road condition of the target video frame. When there is snow on the road, the weather category is determined to be snowy; when there is only water on the road, the weather category is determined to be rainy; when there is no snow or water on the road, the weather category is determined to be sunny.

[0023] According to a second aspect of an embodiment of the present application, a weather identification device is provided, the device comprising:

[0024] An acquisition unit, used for acquiring a target video frame for weather recognition;

[0025] A first recognition unit, used for inputting the target video frame into a trained first classification model, so that the first classification model recognizes and outputs a weather category according to a road condition in the input target video frame;

[0026] The second recognition unit is used to input the target video frame into a trained second classification model when the weather category is a specified category, so as to use the second classification model to further accurately determine the weather category based on the input target video frame and output it.

[0027] As an embodiment, the second identification unit includes:

[0028] A first subunit is used to capture a local picture containing a target object from the target video frame;

[0029] The second subunit is used to input the partial image into the second classification model, so as to use the second classification model to further accurately determine the weather category based on the input partial image and output it.

[0030] As an embodiment, the first subunit is specifically used to input the target video frame into a trained target detection model so that the target detection model can identify the category and location information of the target object from the target video frame; and capture a local picture from the target video frame based on the category and location information of the target object.

[0031] As an embodiment, the second subunit is specifically used to identify the action behavior of the target object by using the second classification model; and determine the weather category according to the action behavior of the target object.

[0032] As an embodiment, the second subunit is specifically used for, when the target object is a person, if the target object is holding an umbrella, determining the weather category is rainy, and if the target object is not holding an umbrella, determining the weather category is sunny; when the target object is a vehicle, if the target object splashes water on the road surface, determining the weather category is rainy, and if the target object does not splash water on the road surface, determining the weather category is sunny.

[0033] As an embodiment, the first recognition unit is specifically used to use the first classification model to identify the road condition of the target video frame. When there is snow on the road, the weather category is determined to be snowy; when there is only water on the road, the weather category is determined to be rainy; when there is no snow and no water on the road, the weather category is determined to be sunny.

[0034] According to a third aspect of an embodiment of the present application, there is provided a computer device, including a processor, a communication interface, a memory, and a communication bus;

[0035] Wherein, the processor, the communication interface, and the memory communicate with each other via the communication bus;

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

[0037] The processor is used to execute the computer program stored in the memory, and the processor implements the steps of any weather identification method when executing the computer program.

[0038] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the steps of any weather identification method are implemented.

[0039] As can be seen from the above embodiments, the present application can obtain a target video frame for weather identification; input the target video frame into a trained first classification model, so that the first classification model identifies the weather category based on the road conditions in the input target video frame and outputs it, and when the weather category is a specified category, input the target video frame into a trained second classification model, so that the second classification model can further accurately determine the weather category based on the input target video frame and output it. Since the prior art can only identify the location of rain and snow pixels in an image, but cannot specifically distinguish the weather category, the present application can input the target video frame for weather identification into the first classification model, and then further use the second classification model to accurately identify the weather category, thereby improving the accuracy of weather category identification and meeting the needs of weather detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 This is a flow chart of an exemplary weather identification method of the present application;

[0041] Figure 2-1 , 2-2 2-3 are schematic diagrams of video images of sunny, rainy and snowy days respectively according to the present application;

[0042] Figure 3 This is a flowchart of an exemplary embodiment of capturing a partial picture of the present application;

[0043] Figure 4-1 , 4-2 Schematic diagrams of an exemplary water splashing vehicle and a non-water splashing vehicle of the present application;

[0044] Figure 5-1This is a schematic diagram of an exemplary target video frame of the present application;

[0045] Figure 5-2 This is a schematic diagram of a partial picture of an exemplary embodiment of the present application;

[0046] Figure 6 This is a schematic diagram of an exemplary classification network model for this application;

[0047] Figure 7 A block diagram of an embodiment of a weather identification device of the present application;

[0048] Figure 8 The present invention is a block diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0049] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0050] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0051] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0052] The weather identification method provided by the present application is specifically described below with an embodiment.

[0053] See also Figure 1 , is a flow chart of an exemplary weather identification method of the present application, the method comprising the following steps:

[0054] Step 101: Acquire a target video frame for weather recognition.

[0055] In this embodiment, a target video frame for weather identification can be obtained from a video surveillance device deployed on a highway. The target video frame at least includes road conditions, such as road coverings, and may also include objects such as vehicles and pedestrians on the road.

[0056] Step 102: input the target video frame into a trained first classification model, so that the first classification model recognizes and outputs the weather category based on the road conditions in the input target video frame.

[0057] In this embodiment, the target video frame for weather recognition obtained in step 101 can be input into a trained first classification model, so as to use the first classification model to determine the weather category corresponding to the target video frame according to the road conditions in the target video frame, and the weather category can include rainy days, snowy days, sunny days, etc. After the first classification model outputs the weather category of the target video frame, the weather category can be output as the recognition result of the target video frame.

[0058] It should be noted that the weather category result output by the first classification model of the present application can be specifically expressed in the form of confidence, and the type with the highest confidence is used as the output result. For example, when the first classification model can identify three weather categories A, B, and C, if the recognition result of the output target video frame is: A's confidence is 0.88, B's confidence is 0.11, and C's confidence is 0.01, it means that category A is closer to the actual weather category, so category A with the highest confidence can be selected as the final output result.

[0059] The weather categories that can be detected by this application are based on the training results of the first classification model. If there are more trained categories, more weather categories can be detected. If there are fewer training results, fewer weather categories can be detected. Generally, this application can detect three weather categories: sunny, rainy and snowy.

[0060] The following example specifically describes the method for training the first classification model.

[0061] When training the first classification model, firstly, a first training sample set may be obtained, wherein the first training sample set includes sample video frames of road conditions under different weather categories and weather categories corresponding to the sample video frames; and then, the first classification model for identifying weather categories is trained based on the first training sample set. For example, Figure 2-1 , 2-2 As shown in 2-3, Figure 2-1 This is a video frame on a sunny day. You can see that there is no water or snow on the road on a sunny day. Figure 2-2 This is a video frame from a rainy day. You can see that there is water on the road during rainy days. Figure 2-3 It is a video frame of a snowy day, and it can be seen that there is snow on the road surface on a snowy day; in order to make the road condition material more diverse and capable of showing a variety of road conditions, this application can refer to Figure 2-1 , 2-2 and 2-3, and record the correspondence between the sample video frames and the weather categories of the sample video frames, use the sample video frames and the weather categories corresponding to the sample video frames as the first training sample set, and finally input the first training sample set into the first classification model to be trained for training, thereby obtaining a first classification model for identifying the weather categories corresponding to different road conditions. The structure of the first classification model can adopt a general classification model structure, such as the VGG16 model in the deep learning network, or the alexnet model, etc., and the specific model is not limited.

[0062] Take the VGG16 model as an example, see Figure 6 The first classification model structure shown in the figure includes convolutional layers, pooling layers, and fully connected layers. After the first training sample is input, the convolutional layer is first used to extract features from the input data. The pooling layer is after the convolutional layer, which can select features and filter information from the output features. The output features are then stacked and trimmed in sequence, and the results are input into the fully connected layer to combine the previously extracted features, and finally the results are output, i.e., the recognition results of the weather categories.

[0063] As an embodiment, after acquiring the target video frame, the target video frame can be input into the pre-trained first classification model. Since the first classification model can identify different road surface features, the road surface features of the target video frame can be determined using the first classification model. The so-called road surface conditions refer to the external environmental features on the road surface, such as water accumulation, snow accumulation, and other features on the road surface, as well as the features of vehicles on the road surface. The road surface conditions of the target video frame can be identified using the first classification model. Specifically, when it is identified that there is snow on the road surface, the weather category is determined to be snowy; when it is identified that there is only water accumulation on the road surface, the weather category is determined to be rainy; when it is identified that there is no snow or water accumulation on the road surface, the weather category is determined to be sunny.

[0064] Since the existing technology can only identify the locations of rain and snow pixels in an image but cannot specifically distinguish the weather categories, the present application can distinguish weather categories by inputting the target video frame for weather identification into a first classification model, thereby meeting the preliminary classification requirements of weather detection.

[0065] Step 103: When the weather category is a designated category, the target video frame is input into a trained second classification model, so as to utilize the second classification model to further accurately determine the weather category based on the input target video frame and output it.

[0066] Taking into account that the road conditions on rainy days and sunny days are sometimes not very different, in order to more accurately determine the situation where the recognition result is a rainy day, the present application may not directly output the weather category when determining that the weather category of the target video frame is a specified category (for example, a rainy day), but may further realize accurate identification of the weather category. Specifically, the target video frame may be input into a trained second classification model, so as to use the second classification model to further accurately determine the weather category based on the input target video frame and output it.

[0067] As an embodiment, after the target video frame is input into a trained second classification model, the second classification model can be used to identify the action behavior of the target object, and the weather category can be determined based on the action behavior of the target object.

[0068] Specifically, when the target object is a person, if the target object is holding an umbrella, the weather category is determined to be rainy, and if the target object is not holding an umbrella, the weather category is determined to be sunny; when the target object is a vehicle, if the target object presses water on the road surface, the weather category is determined to be rainy, and if the target object does not press water on the road surface, the weather category is determined to be sunny. For example, when the input partial picture is Figure 4-1 As shown in the picture, Figure 4-1 is a screenshot of a vehicle splashing water, so it can be determined that the target object (vehicle) is splashing water on the road, and the weather category can be determined to be rainy. When the input partial image is Figure 4-2 As shown in the picture, Figure 4-2 It is a screenshot of a vehicle without splashing water, so it can be determined that the action of the target object (vehicle) is not splashing water on the road surface, and the weather category can be determined to be sunny. The recognition method when the category of the target object is a person is similar to the above method and will not be repeated here.

[0069] As an embodiment, the present application can further analyze the target object in the target video frame to perform secondary recognition of the weather category. The target object may include vehicles or pedestrians on the road. Since the target video frame usually also contains most of the content other than the target object, in order to improve the efficiency and accuracy of secondary recognition, a partial image containing the target object can be further captured from the target video frame, and the partial image can be input into the second classification model, so as to use the second classification model to further accurately determine the weather category based on the input partial image and output it. The specific process is as follows: Figure 3 shown.

[0070] See also Figure 3 , is an exemplary flow chart of an embodiment of capturing a partial picture of the present application, the method comprising the following steps:

[0071] Step 301: input a target video frame into a trained target detection model, so that the target detection model can identify the category and location information of the target object from the target video frame;

[0072] Step 302: Capture a local image from the target video frame based on the category and location information of the target object.

[0073] In this embodiment, the target video frame can be input into a trained target detection model, such as a target detection model that detects the target object as a vehicle or a pedestrian, so that the target detection model can identify the category and position information of the target object from the target video frame, where the category of the target object refers to whether the target object is a vehicle or a pedestrian; the position information of the target object can be the position coordinates of the target object in the target video frame, such as the vertex coordinates of the upper left corner and the vertex coordinates of the lower right corner, and the position and area of ​​the target object in the target video frame can be determined based on these two coordinates.

[0074] After determining the category and position information of the target object, when the category of the target object is the first category, the first target area can be expanded outwardly from the position information of the target object in the target video frame by a first specified size, and the first target area can be captured from the target video frame as the local image; when the category of the target object is the second category, the second target area can be expanded outwardly from the position information of the target object in the target video frame by a second specified size to obtain a second target area, the second target area is larger than the first target area, and the second target area can be captured from the target video frame as the local image. For example, when the first category of the target object is a person, a first target area is obtained by expanding outward from the position information of the target object in the target video frame to a first specified size. For example, the target object is expanded outward with the center of the target object as the origin to obtain a first target area with an expanded area of ​​100 to 110% of the original area, and the first target area is captured from the target video frame as the local image; when the second category of the target object is a vehicle, a second target area is obtained by expanding outward from the position information of the target object in the target video frame to a second specified size. The second target area is larger than the first target area. For example, the target object is expanded outward with the center of the target object as the origin to obtain a second target area with an expanded area of ​​111 to 120% of the original area, and the second target area is captured from the target video frame as the local image.

[0075] In one example, when the weather category of the target video frame is rainy, in order to further verify the accuracy of the weather category, a partial picture in the target video frame can be captured. Since vehicles will splash water when driving on rainy days, vehicles on the road can be used as target objects, such as Figure 4-1 The video screenshot of the vehicle splashing water is shown. Figure 4-2 This is a video screenshot of a vehicle without splashing water. Therefore, it is possible to tell whether it is raining by looking at the partial picture with the vehicle. In addition to vehicles, pedestrians on the road can also be used as target objects for rainy day identification. For example, it is possible to determine whether it is raining by identifying whether the person in the partial image is holding an umbrella. When the target object is determined to be a vehicle, the center of the target object area is used as the origin to expand the target object area outward by 120% of the original area to obtain a second target area. The second target area is captured from the target video frame as the partial picture. Figure 5-1As shown, the largest box represents the target video frame, the vehicle in the middle is the target object, and the thin solid line box outside the vehicle is the vehicle's annotation box (that is, coordinate information). In order to display the characteristics of the vehicle's water splash, this application expands the vehicle's annotation box by a preset multiple, for example, to 120% of the size of the annotation box, thereby obtaining an enlarged second target area (shown in the thick solid line box). Then the target video frame is cropped, and the second target area of ​​the thick solid line box is intercepted as a local picture. Finally, the local picture intercepted based on the target video frame is shown as follows. Figure 5-2 By cropping the area where the target object is located in the target video frame to obtain a partial picture and input it into the second classification model, the second classification model can reduce the calculation of the original video frame that is irrelevant to the target object, thereby reducing the amount of calculation and improving the recognition efficiency. In addition, by only inputting a partial picture of the target object, the interference of other non-target objects in the image can be avoided, thereby improving the recognition accuracy.

[0076] The following example specifically describes the method for training the second classification model.

[0077] First, a second training sample set may be obtained, wherein the second training sample set includes sample images of target object actions under different weather categories and weather categories corresponding to the sample images; and a second classification model for accurately identifying weather categories may be trained based on the second training sample set. Figure 4-1 , 4-2 As shown, Figure 4-1 This is a partial picture of the target object on a rainy day, where you can see the splashes of water caused by the vehicle; Figure 4-2 It is a partial picture of the target object on a sunny day, and you can see that the vehicle has not splashed water; in order to make the material of the target object more diverse, different weather picture samples of different scenes, time periods, and installation angles can be collected and sorted. This application can obtain a large number of the above sample pictures, and record the correspondence between each sample picture and the weather category of the sample picture, and use the sample picture and the correspondence as the second training sample set, and input the second training sample set into the second classification model to be trained for training, so as to obtain a second classification model for accurately identifying weather categories. The structure of the second classification model can be similar to that of the first classification model, and will not be repeated here.

[0078] In an example, the second classification model can be used to detect weather categories corresponding to multiple local images, and the weather category with the largest number of repetitions can be counted from the detection results as the final weather category, so that the weather at a certain time can be judged more accurately.

[0079] Compared with the existing technology, the present application can perform secondary recognition on local images containing target objects in video frames based on deep learning image classification technology, thereby solving the problem of weather detection when rainy days are not obvious, further improving the detection success rate and improving the detection accuracy.

[0080] Corresponding to the above-mentioned embodiment of the weather identification method, the present application also provides an embodiment of a weather identification device.

[0081] See also Figure 7 , is a block diagram of an embodiment of a weather identification device of the present application, the device 70 may include:

[0082] An acquisition unit 701 is used to acquire a target video frame for weather recognition;

[0083] A first recognition unit 702 is used to input the target video frame into a trained first classification model, so that the first classification model recognizes and outputs a weather category according to the road conditions in the input target video frame;

[0084] The second recognition unit 703 is used to input the target video frame into a trained second classification model when the weather category is a specified category, so as to use the second classification model to further accurately determine the weather category based on the input target video frame and output it.

[0085] In this embodiment, the acquisition unit 701 can acquire a target video frame for weather recognition from a video surveillance device deployed on a highway, and the target video frame at least includes road conditions, such as road coverings, and may also include objects such as vehicles and pedestrians on the road. The first recognition unit 702 can input the target video frame for weather recognition acquired by the acquisition unit 701 into a trained first classification model, so as to use the first classification model to determine the weather category corresponding to the target video frame based on the road conditions in the target video frame, and the weather category may include rainy days, snowy days, sunny days, etc. After the first classification model outputs the weather category of the target video frame, the weather category can be output as the recognition result of the target video frame.

[0086] It should be noted that the weather category result output by the first classification model of the present application can be specifically expressed in the form of confidence, and the type with the highest confidence is used as the output result. For example, when the first classification model can identify three weather categories A, B, and C, if the recognition result of the output target video frame is: A's confidence is 0.88, B's confidence is 0.11, and C's confidence is 0.01, it means that category A is closer to the actual weather category, so category A with the highest confidence can be selected as the final output result.

[0087] The weather categories that can be detected by this application are based on the training results of the first classification model. If there are more trained categories, more weather categories can be detected. If there are fewer training results, fewer weather categories can be detected. Generally, this application can detect three weather categories: sunny, rainy and snowy.

[0088] The device also includes a first training unit ( Figure 7 (not shown). The first training unit, when training the first classification model, may first obtain a first training sample set, wherein the first training sample set includes sample video frames of road conditions under different weather categories and weather categories corresponding to the sample video frames; and then train a first classification model for identifying weather categories based on the first training sample set. For example, Figure 2-1 , 2-2 As shown in 2-3, Figure 2-1 This is a video frame on a sunny day. You can see that there is no water or snow on the road on a sunny day. Figure 2-2 This is a video frame from a rainy day. You can see that there is water on the road during rainy days. Figure 2-3 It is a video frame of a snowy day, and it can be seen that there is snow on the road surface on a snowy day; in order to make the road condition material more diverse and capable of showing a variety of road conditions, this application can refer to Figure 2-1 , 2-2 and 2-3, and record the correspondence between the sample video frames and the weather categories of the sample video frames, use the sample video frames and the weather categories corresponding to the sample video frames as the first training sample set, and finally input the first training sample set into the first classification model to be trained for training, so as to obtain a first classification model for identifying the weather categories corresponding to different road conditions. The structure of the first classification model can adopt a general classification model structure, such as the VGG16 model in the deep learning network, or the alexnet model, etc., and the specific model is not limited. Taking the VGG16 model as an example, please refer to Figure 6 The first classification model structure shown in the figure includes convolutional layers, pooling layers, and fully connected layers. After the first training sample is input, the convolutional layer is first used to extract features from the input data. The pooling layer is after the convolutional layer, which can select features and filter information from the output features. The output features are then stacked and trimmed in sequence, and the results are input into the fully connected layer to combine the previously extracted features, and finally the results are output, i.e., the recognition results of the weather categories.

[0089] As an embodiment, after acquiring the target video frame, the first recognition unit 702 may input the target video frame into a pre-trained first classification model. Since the first classification model can recognize different road surface features, the road surface features of the target video frame may be determined using the first classification model. The so-called road surface conditions refer to the external environmental features on the road surface, such as water accumulation, snow accumulation, and other features, as well as the features of vehicles on the road surface. The road surface conditions of the target video frame may be identified using the first classification model. Specifically, when it is identified that there is snow accumulation on the road surface, the weather category may be determined to be snowy; when it is identified that there is only water accumulation on the road surface, the weather category may be determined to be rainy; when it is identified that there is no snow accumulation and no water accumulation on the road surface, the weather category may be determined to be sunny.

[0090] Since the existing technology can only identify the locations of rain and snow pixels in an image but cannot specifically distinguish the weather categories, the present application can distinguish weather categories by inputting the target video frame for weather identification into a first classification model, thereby meeting the preliminary classification requirements of weather detection.

[0091] Taking into account that the road conditions on rainy days and sunny days are sometimes not very different, in order to more accurately determine the situation where the recognition result is a rainy day, the present application may not directly output the weather category when determining that the weather category of the target video frame is a specified category (for example, a rainy day), but may further realize accurate identification of the weather category through the second recognition unit 703.

[0092] As an embodiment, the second identification unit 703 includes:

[0093] The first subunit ( Figure 7 ), which is used to capture a local picture containing a target object from the target video frame.

[0094] As an embodiment, the first subunit is specifically used to input the target video frame into a trained target detection model so that the target detection model can identify the category and location information of the target object from the target video frame; and capture a local picture from the target video frame based on the category and location information of the target object.

[0095] In this embodiment, the first subunit can input the target video frame into a trained target detection model, such as a target detection model that detects the target object as a vehicle or a pedestrian, so that the target detection model can identify the category and position information of the target object from the target video frame, where the category of the target object refers to whether the target object is a vehicle or a pedestrian; the position information of the target object can be the position coordinates of the target object in the target video frame, such as the vertex coordinates of the upper left corner and the vertex coordinates of the lower right corner, and the position and area of ​​the target object in the target video frame can be determined based on these two coordinates.

[0096] After determining the category and position information of the target object, the first subunit can, when the category of the target object is the first category, expand outward from the position information of the target object in the target video frame by a first specified size to obtain a first target area, and capture the first target area from the target video frame as the local image; when the category of the target object is the second category, expand outward from the position information of the target object in the target video frame by a second specified size to obtain a second target area, the second target area is larger than the first target area, and capture the second target area from the target video frame as the local image. For example, when the first category of the target object is a person, a first target area is obtained by expanding outward from the position information of the target object in the target video frame to a first specified size. For example, the target object is expanded outward with the center of the target object as the origin to obtain a first target area with an expanded area of ​​100 to 110% of the original area, and the first target area is captured from the target video frame as the local image; when the second category of the target object is a vehicle, a second target area is obtained by expanding outward from the position information of the target object in the target video frame to a second specified size. The second target area is larger than the first target area. For example, the target object is expanded outward with the center of the target object as the origin to obtain a second target area with an expanded area of ​​111 to 120% of the original area, and the second target area is captured from the target video frame as the local image.

[0097] In one example, when the weather category of the target video frame is rainy, in order to further verify the accuracy of the weather category, a partial picture in the target video frame can be captured. Since vehicles will splash water when driving on rainy days, vehicles on the road can be used as target objects, such as Figure 4-1 The video screenshot of the vehicle splashing water is shown. Figure 4-2This is a video screenshot of a vehicle without splashing water. Therefore, it is possible to tell whether it is raining by looking at the partial picture with the vehicle. In addition to vehicles, pedestrians on the road can also be used as target objects for rainy day identification. For example, it is possible to determine whether it is raining by identifying whether the person in the partial image is holding an umbrella. When the target object is determined to be a vehicle, the center of the target object area is used as the origin to expand the target object area outward by 120% of the original area to obtain a second target area. The second target area is captured from the target video frame as the partial picture. Figure 5-1 As shown, the largest box represents the target video frame, the vehicle in the middle is the target object, and the thin solid line box outside the vehicle is the vehicle's annotation box (that is, coordinate information). In order to display the characteristics of the vehicle's water splash, this application expands the vehicle's annotation box by a preset multiple, for example, to 120% of the size of the annotation box, thereby obtaining an enlarged second target area (shown in the thick solid line box). Then the target video frame is cropped, and the second target area of ​​the thick solid line box is intercepted as a local picture. Finally, the local picture intercepted based on the target video frame is shown as follows. Figure 5-2 By cropping the area where the target object is located in the target video frame to obtain a partial picture and input it into the second classification model, the second classification model can reduce the calculation of the original video frame that is irrelevant to the target object, thereby reducing the amount of calculation and improving the recognition efficiency. In addition, by only inputting a partial picture of the target object, the interference of other non-target objects in the image can be avoided, thereby improving the recognition accuracy.

[0098] As an embodiment, the second identification unit further includes a second subunit ( Figure 7 (not shown) is used to input the local image into the second classification model, so as to use the second classification model to further accurately determine the weather category based on the input local image and output it.

[0099] After the second subunit inputs the target video frame into a trained second classification model, the second classification model can be used to identify the action behavior of the target object, and the weather category can be determined according to the action behavior of the target object.

[0100] Specifically, the second subunit is used to, when the target object is a person, if the target object is holding an umbrella, determine the weather category as rainy day, if the target object is not holding an umbrella, determine the weather category as sunny day; when the target object is a vehicle, if the target object presses water on the road surface, determine the weather category as rainy day, if the target object does not press water on the road surface, determine the weather category as sunny day. For example, when the input partial picture is Figure 4-1 As shown in the picture, Figure 4-1is a screenshot of a vehicle splashing water, so it can be determined that the target object (vehicle) is splashing water on the road, and the weather category can be determined to be rainy. When the input partial image is Figure 4-2 As shown in the picture, Figure 4-2 It is a screenshot of a vehicle without splashing water, so it can be determined that the action of the target object (vehicle) is not splashing water on the road surface, and the weather category can be determined to be sunny. The recognition method when the category of the target object is a person is similar to the above method and will not be repeated here.

[0101] The device also includes a second training unit ( Figure 7 (not shown), the second training unit may first obtain a second training sample set, the second training sample set including sample images of target object actions under different weather categories and weather categories corresponding to the sample images; and train a second classification model for accurately identifying weather categories based on the second training sample set. The sample images in the second training sample set are as follows: Figure 4-1 , 4-2 As shown, Figure 4-1 This is a partial picture of the target object on a rainy day, where you can see the splashes of water caused by the vehicle; Figure 4-2 It is a partial picture of the target object on a sunny day, and you can see that the vehicle has not splashed water; in order to make the material of the target object more diverse, different weather picture samples of different scenes, time periods, and installation angles can be collected and sorted. This application can obtain a large number of the above sample pictures, and record the correspondence between each sample picture and the weather category of the sample picture, and use the sample picture and the correspondence as the second training sample set, and input the second training sample set into the second classification model to be trained for training, so as to obtain a second classification model for accurately identifying weather categories. The structure of the second classification model can be similar to that of the first classification model, and will not be repeated here.

[0102] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.

[0103] Corresponding to the embodiments of the aforementioned weather identification method, the present application also provides an embodiment of a computer device for executing the aforementioned weather identification method.

[0104] As an example, please refer to Figure 8 , a computer device, comprising a processor 81, a communication interface 82, a memory 83 and a communication bus 84;

[0105] The processor 81, the communication interface 82, and the memory 83 communicate with each other via the communication bus 84;

[0106] The memory 83 is used to store computer programs;

[0107] The processor 81 is used to execute the computer program stored in the memory, and the processor 81 implements the steps of any weather identification method when executing the computer program.

[0108] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the embodiment of the computer device, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0109] Corresponding to the embodiments of the aforementioned weather identification method, the present application also provides an embodiment of a computer-readable storage medium for executing the aforementioned weather identification method.

[0110] As an embodiment, the present application also includes a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any weather identification method are implemented.

[0111] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer device embodiment and the computer readable storage medium embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0112] In summary, the present application can obtain a target video frame for weather identification; input the target video frame into a trained first classification model, so that the first classification model can identify the weather category based on the road conditions in the input target video frame and output it, and when the weather category is a specified category, input the target video frame into a trained second classification model, so that the second classification model can further accurately determine the weather category based on the input target video frame and output it. Since the prior art can only identify the location of rain and snow pixels in an image, but cannot specifically distinguish the weather category, the present application can input the target video frame for weather identification into the first classification model, and then further use the second classification model to accurately identify the weather category, thereby improving the accuracy of weather category identification and meeting the needs of weather detection.

[0113] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A weather identification method, characterized in that: The method comprises: Obtain target video frames for weather recognition; Inputting the target video frame into a trained first classification model, so that the first classification model recognizes and outputs a weather category based on a road surface condition in the input target video frame; the road surface condition refers to environmental features on a road surface; When the weather category is a specified category, the target video frame is input into a trained target detection model, so that the target detection model can identify the category and location information of the target object from the target video frame; the target object includes a vehicle or a pedestrian on the road; in the target video frame, a target area is obtained by expanding outwards from the location information of the target object to a specified size, and the target area is intercepted from the target video frame as a local image; wherein the specified size of the outward expansion corresponding to target objects of different categories is different; the local image is input into a trained second classification model, so that the second classification model is used to identify the action behavior of the target object; The weather category is determined and outputted according to the action behavior of the target object.

2. The method according to claim 1, characterized in that Determining the weather category according to the action behavior of the target object includes: When the target object is a person, if the target object is holding an umbrella, the weather category is determined to be rainy; if the target object is not holding an umbrella, the weather category is determined to be sunny; When the target object is a vehicle, if the target object creates splashes on the road surface, the weather category is determined to be rainy; if the target object does not create splashes on the road surface, the weather category is determined to be sunny.

3. The method according to claim 1, characterized in that Inputting the target video frame into a trained first classification model, so that the first classification model recognizes and outputs the weather category according to the road conditions in the input target video frame, including: The first classification model is used to identify the road condition of the target video frame. When there is snow on the road, the weather category is determined to be snowy; when there is only water on the road, the weather category is determined to be rainy; when there is no snow or water on the road, the weather category is determined to be sunny.

4. A weather identification device, characterized in that: The device comprises: An acquisition unit, used for acquiring a target video frame for weather recognition; A first recognition unit is used to input the target video frame into a trained first classification model, so that the first classification model recognizes and outputs a weather category according to a road surface condition in the input target video frame; the road surface condition refers to an environmental feature on a road surface; A second recognition unit is used for, when the weather category is a specified category, inputting the target video frame into a trained target detection model, so that the target detection model can recognize the category and position information of the target object from the target video frame; the target object includes a vehicle or a pedestrian on the road; in the target video frame, expanding outward from the position information of the target object to a specified size to obtain a target area, and intercepting the target area from the target video frame as a local image; wherein the specified size of the outward expansion corresponding to target objects of different categories is different; inputting the local image into the trained second classification model, so as to use the second classification model to recognize the action behavior of the target object; The weather category is determined and outputted according to the action behavior of the target object.

5. The device according to claim 4, characterized in that The second recognition unit is specifically used for, when the target object is a person, if the target object is holding an umbrella, determining the weather category is rainy, if the target object is not holding an umbrella, determining the weather category is sunny; when the target object is a vehicle, if the target object splashes water on the road surface, determining the weather category is rainy, if the target object does not splash water on the road surface, determining the weather category is sunny.

6. The device according to claim 4, characterized in that The first recognition unit is specifically used to use the first classification model to identify the road condition of the target video frame. When there is snow on the road, the weather category is determined to be snowy; when there is only water on the road, the weather category is determined to be rainy; when there is no snow and no water on the road, the weather category is determined to be sunny.

7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the methods of claims 1-3 are implemented.

8. A computer device, characterized in that: The computer device includes a memory, a processor, a communication interface and a communication bus; wherein the memory, the processor and the communication interface communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the computer program stored in the memory, and the processor implements the steps of any one of the methods of claims 1-3 when executing the computer program.