A method, device and electronic device for identifying snow accumulation state on a road
By segmenting and correcting the road image, and using the snow detection model and camera image calibration technology, the problem of inaccurate road snow recognition in the existing technology is solved, and the accurate judgment of the snow position, area and distance is achieved. Improved traffic safety support.
Patent Information
- Application Number
- CN202210816059.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-12
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-07-12
AI Technical Summary
Existing road snow recognition methods are not accurate enough and cannot accurately determine the location and area of snow.
By acquiring road images, perform regional segmentation and image correction, use the trained snow detection model to predict snow, compare the predicted average gray value with the preset threshold, and calculate the snow area and distance combined with camera image calibration to provide accurate of snow information.
It improves the accuracy of road snow recognition, can accurately determine the location, area and distance of snow on the road, and provides information that is beneficial to traffic safety.
Smart Images

Figure CN115019260B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and in particular to a method, device and electronic equipment for recognizing the snow accumulation state of a road. Background Art
[0002] Roads are important transportation infrastructure that is indispensable for people's lives, work and production. In most parts of my country, heavy snow is prone to occur in winter. Due to the cold weather, the snow on the road is difficult to melt. As the wheels roll over the snow, it is easy to compact it on the road surface. Snow on the road will also cause urban traffic paralysis, making urban streets lose their former cleanliness, prosperity and convenience. This is also one of the main natural disasters in people's production and life. Therefore, for road traffic management departments, how to accurately identify the snow on the road through technical means is a very important issue.
[0003] Currently, snow is usually identified by combining various sensors (such as cameras, thermometers, etc.) or using traditional machine learning methods to identify the presence or absence of snow. However, these identification methods are inaccurate and cannot determine the location and area of snow. Summary of the invention
[0004] The purpose of the present invention is to provide a method, device and electronic device for identifying the state of snow accumulation on a road, so as to solve the problem that the existing method for identifying snow accumulation on a road is not accurate enough and improve the accuracy of identifying snow accumulation on a road.
[0005] According to one aspect of an embodiment of the present invention, a method for identifying a snowy road state is provided, comprising the following steps:
[0006] Acquire a road image whose snow status needs to be identified;
[0007] The road image is segmented into road surface areas, side slope areas on both sides of the road surface and other areas, and the road surface area and the side slope areas on both sides of the road surface are cut out as the areas to be identified;
[0008] Input the image of the area to be identified into the trained snow detection model to predict the possibility of snow accumulation;
[0009] The predicted average gray value of snow accumulation is compared with the preset snow accumulation gray threshold to determine whether the road image area contains snow accumulation.
[0010] As an optional example, in the method, after detecting that the road image area contains snow, the method further includes the step of calculating the size of the snow:
[0011] Camera image calibration;
[0012] The image of the road surface area is extracted and corrected to obtain a bird's-eye view of the road;
[0013] Calculate the snow area using the following formula: , where W is the width of the road in reality, r is the ratio of the snow area to the road area in the image, the occupied road area is the area of the road where the snow is located, and ri is the width-to-length ratio of the road area occupied by the snow in the image.
[0014] As an optional example, in the method, the camera image calibration is completed by fixing the road width in combination with camera shape parameters.
[0015] As an optional example, in the method, after detecting that the road image area contains snow, the method further includes the step of calculating the distance between the snow and the landmark:
[0016] ,
[0017] Among them, d4 is the straight-line distance from the snow to the road marker, d2 is the straight-line distance from the road marker to the camera, and d3 is the straight-line distance from the camera to the snow road. , where D is the distance between the snow and the camera, and its calculation formula is: , where d is the focal length of the camera, rate is the ratio of the actual distance to the image pixel, H is the distance between the camera and the road, and θ is the angle between the snow and the landmark with the camera. , β is the angle between the snow and the camera in the direction perpendicular to the road, α is the angle between the landmark and the camera in the direction perpendicular to the road, , where d1 is the straight-line distance from the camera to the road, and w1 is the distance from the snow in the image to the side of the road close to the camera.
[0018] According to another aspect of an embodiment of the present invention, there is provided a device for identifying a snowy road condition, comprising:
[0019] An acquisition unit, used for acquiring a road image whose snow state needs to be identified;
[0020] An image segmentation and interception unit is used to segment the road image into regions, forming a road surface region, a slope region on both sides of the road surface, and other regions, and intercepting the road surface region and the slope region on both sides of the road surface as regions to be identified;
[0021] The prediction unit inputs the image of the area to be identified into the trained snow detection model and predicts the possibility of snow accumulation;
[0022] The recognition unit is used to compare the predicted average gray value of snow accumulation with a preset snow accumulation gray threshold value to determine whether the road image area contains snow accumulation.
[0023] As an optional example, in the device, the recognition unit is further used to calculate the size of snow after detecting that the road image area contains snow, and the specific steps include:
[0024] Camera image calibration;
[0025] The image of the road surface area is extracted and corrected to obtain a bird's-eye view of the road;
[0026] Calculate the snow area using the following formula: , where W is the width of the road in reality, r is the ratio of the snow area to the road area in the image, the occupied road area is the area of the road where the snow is located, and ri is the width-to-length ratio of the road area occupied by the snow in the image.
[0027] As an optional example, in the device, the recognition unit is further used to calculate the distance between the snow and the marker after detecting that the road image area contains snow, and the calculation formula is: ,
[0028] Among them, d4 is the straight-line distance from the snow to the road marker, d2 is the straight-line distance from the road marker to the camera, and d3 is the straight-line distance from the camera to the snow road. , where D is the distance between the snow and the camera, and its calculation formula is: , where d is the focal length of the camera, rate is the ratio of the actual distance to the image pixel, H is the distance between the camera and the road, and θ is the angle between the snow and the landmark with the camera. , β is the angle between the snow and the camera in the direction perpendicular to the road, α is the angle between the landmark and the camera in the direction perpendicular to the road, , where d1 is the straight-line distance from the camera to the road, and w1 is the distance from the snow in the image to the side of the road close to the camera.
[0029] According to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0030] Beneficial effects of the present invention: The present invention provides a method, device and electronic device for identifying the snow accumulation state of a road. By segmenting the road image, the image of the area to be identified is input into a trained snow detection model to predict the possibility of snow accumulation, and then compare the average gray value of the predicted snow accumulation with the preset snow accumulation gray threshold to determine whether the road image area contains snow. The image segmentation, deep learning, pixel matching and other technologies are combined to identify whether there is snow accumulation with high accuracy. The camera principle is also used to calculate the position of the snow accumulation distance camera, and the position of the snow accumulation distance marker can be calculated through spatial coordinate system conversion, and the area calculation can be used to calculate the area of snow accumulation, so that accurate and comprehensive snow accumulation information can be obtained, providing favorable information support for road traffic safety and ensuring road traffic safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to further understand the features and technical contents of the present invention, please refer to the following detailed description and drawings of the present invention. However, the drawings are only provided for reference and illustration and are not intended to limit the present invention.
[0032] In the accompanying drawings,
[0033] Figure 1 This is a flow chart of a method for identifying snow accumulation status on a road according to an embodiment of the present invention;
[0034] Figure 2 for Figure 1 A flowchart showing the step of calculating snow size in the method for identifying road snow status;
[0035] Figure 3 for Figure 1 A scene diagram showing the application of the road snow state recognition method;
[0036] Figure 4 for Figure 1 A schematic diagram of a road image segmented in step S2 in the method for identifying a snowy road state is shown;
[0037] Figure 5 for Figure 1 A schematic diagram of a road image corrected in step S52 in the method for identifying a snowy road state is shown;
[0038] Figure 6 for Figure 1 A schematic diagram of a road image and an actual road imaged through a camera pinhole in a road snow state recognition method shown;
[0039] Figure 7 for Figure 1 A schematic diagram of the positional relationship between the actual road, the camera, and the landmarks in the road snow state recognition method shown;
[0040] Figure 8 for Figure 7 A schematic diagram showing the positional relationship between the camera and snow in the actual road, the camera, and the landmark;
[0041] Fig. 9 for Figure 7 A schematic diagram showing the positional relationship between the projection of the camera on the road and the snow and the side of the road close to the camera in the position between the actual road, the camera and the landmark;
[0042] Fig.10 for Figure 7 A schematic diagram showing the positional relationship between the projection of the camera on the road and the snow and the markers in the position between the actual road, the camera and the markers;
[0043] Fig.11 Schematic diagram of a device for identifying snow accumulation status on a road according to an embodiment of the present invention;
[0044] Fig.12 FIG. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0045] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete and will fully convey the concept of the example embodiments to those skilled in the art.
[0046] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0047] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0048] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0049] See also Figures 1 to 10 An embodiment of the present invention provides a method for identifying the snow accumulation state of a road. In the figure, 1 represents a road in reality, 2 represents snow accumulation in reality, 11 represents a road in reality, 22 represents snow accumulation in reality, 3 represents a camera, and 4 represents a marker.
[0050] The road snow state recognition method includes the following steps.
[0051] Step S1, obtaining a road image whose snow condition needs to be identified.
[0052] Specifically, a road monitoring camera installed on the road obtains a road image (such as Figure 3 As shown), it is transmitted to the electronic device in real time through the network or other means and processed by the electronic device.
[0053] Step S2, segmenting the road image into regions to form road surface regions, side slope regions on both sides of the road surface, and other regions, and cutting out the road surface region and the side slope regions on both sides of the road surface as regions to be identified.
[0054] Specifically, the road image can be segmented based on an image segmentation algorithm (such as BiSeNet V2) to form four areas, including a road surface area A, slope areas B and C on both sides of the road surface, and other areas D; then the area to be identified is intercepted, which in this embodiment is the road surface area A, the slope areas B and C on both sides of the road surface, such as Figure 4 shown.
[0055] Step S3: input the image of the area to be identified into the trained snow detection model to predict the possibility of snow accumulation.
[0056] Specifically, the trained snow detection model is pre-trained through a deep learning target detection algorithm to obtain snow features (such as color, shape, etc.). The image of the area to be identified is input into the trained snow detection model. If snow features are found in the image, it is judged that there may be snow.
[0057] Step S4: compare the predicted average gray value of snow with a preset snow gray threshold to determine whether the road image area contains snow.
[0058] Specifically, because the color of snow is much lighter than that of the road, it can be judged based on the grayscale of the snow. For example, the grayscale threshold of snow can be set to 20. If the average grayscale value of the predicted snow is less than or equal to 20, it can be judged that it is actually snow, otherwise it is not snow.
[0059] Step S5, calculating the snow accumulation size, specifically includes the following steps.
[0060] Step S51, camera image calibration. Since the width of the road is a fixed value, the camera calibration can be completed by obtaining the camera shape parameters. In this embodiment, the camera image calibration is completed by combining the fixed road width with the camera shape parameters. Of course, in other embodiments, calibration can also be performed in other ways.
[0061] Step S52: Correct the image of the road surface area to obtain a top view of the road (such as Figure 5 as shown).
[0062] Step S53: Calculate the snow area, the calculation formula is: , where W is the width of the road in reality, r is the ratio of the snow area to the road area in the image, the occupied road area is the area of the road where the snow is located, and ri is the width-to-length ratio of the road area occupied by the snow in the image.
[0063] The derivation process of the calculation formula is described as follows:
[0064] like Figure 5 As shown in the figure, in the rectified road image, a perpendicular line is drawn from the edge of the snow to both sides of the road, and the area of the road occupied by the snow in the image can be calculated (i.e. Figure 1 The black area shown in the right image) and the width-to-length ratio of the road area occupied by snow in the image:
[0065]
[0066]
[0067] Where: Sd is the road area occupied by snow in the image, ri is the width-to-length ratio of the road area occupied by snow in the image, w is the width of the road in the image, h is the length of the road in the image, and the values of w and h can be obtained from the image.
[0068] Then calculate the ratio of snow pixels to road pixels in the image:
[0069]
[0070] Where Sx is the area occupied by snow in the image, and its value can be obtained from the pixels in the image.
[0071] Since the actual width of the road is determined, the size of the snow area in the actual environment can be calculated:
[0072]
[0073] Where SX is the actual snow area.
[0074] Step S6: Calculate the distance between the snow and the marker. The marker is usually a special object on the ground. Figures 7 to 10 The distance is calculated as: ,
[0075] Among them, d4 is the straight-line distance from the snow to the landmark road,
[0076] d2 is the straight-line distance between the landmark and the camera road, and its value is determined after the landmark and the camera are set;
[0077] d3 is the straight-line distance between the camera and the snowy road, and its calculation formula is: (like Figure 8 As shown in the figure), where D is the distance between the snow and the camera, through Calculate, where d is the focal length of the camera, rate is the ratio of the actual distance to the image pixel, which can be obtained by W is the actual width of the road, w is the width of the road in the image; H is the distance between the camera and the road;
[0078] θ is the angle between the snow and the landmark with the camera, and its calculation formula is: , β is the angle between the snow and the camera perpendicular to the road, and its calculation formula is: (like Fig. 9 As shown in the figure, d1 is the straight-line distance between the camera and the road, and its value is determined when the camera is set up; w1 is the distance between the snow in the image and the road side close to the camera, and its value can be obtained from the image; rate is the ratio of the actual distance to the image pixels; α is the angle between the marker and the camera perpendicular to the road, and its value is determined after the marker and the camera are set up.
[0079] like Figure 3 As shown in FIG. 1 , the derivation process of the calculation formula is described as follows. In the figure, 1 represents a road, 2 represents snow, 3 represents a camera, and 4 represents a landmark.
[0080] First, find out the distance W1 between the snow and the road side close to the camera in reality.
[0081] , W1 is the distance of the snow from the road side close to the camera in reality (e.g. Figure 2), w1 is the distance of the snow in the image from the road side close to the camera, rate is the ratio of the actual distance to the image pixels, which can be obtained by We obtain: W is the actual width of the road, and w is the width of the road in the image;
[0082] Then calculate the straight-line distance d3 between the camera and the snow-covered ground. (like Figure 8 As shown), d3: the straight-line distance between the camera and the snowy ground, D is the distance between the snow and the camera, , where d is the focal length of the camera, and its value belongs to the camera parameter and has been determined; H is the distance between the camera and the road, and its value has been determined when the camera is set;
[0083] Then find the angle β between the snow and the camera in the direction perpendicular to the road. (like Fig. 9 As shown in the figure), β is the angle between the snow and the camera in the direction perpendicular to the road, and d1 is the straight-line distance between the camera and the road;
[0084] Then calculate the angle θ between the camera and the snow. (like Fig.10 As shown in the figure, θ is the angle between the snow and the marker with the camera, and α is the angle between the marker and the camera in the direction perpendicular to the road, and its value is determined after the marker and the camera are set.
[0085] Finally, according to the calculation formula of the three sides of the triangle, using the above parameter values, the straight-line distance of the snow distance from the landmark road can be obtained: (like Fig.10 as shown).
[0086] In other embodiments, one or all of steps S5 and S6 may be omitted, that is, only determining whether the road image area contains snow, or after determining whether the road image area contains snow, only calculating the size of the snow or only calculating the distance between the snow and the landmark.
[0087] like Fig.11 As shown, the present invention also provides a road snow state recognition device, comprising:
[0088] An acquisition unit 10 is used to acquire a road image whose snow state needs to be identified;
[0089] The image segmentation and interception unit 20 is used to segment the road image into regions, forming a road surface region, a slope region on both sides of the road surface and other regions, and intercepting the road surface region and the slope region on both sides of the road surface as regions to be identified;
[0090] The prediction unit 30 inputs the image of the area to be identified into the trained snow detection model to predict that there may be snow accumulation;
[0091] The identification unit 40 is used to compare the predicted average gray value of snow accumulation with a preset snow accumulation gray threshold value to determine whether the road image area contains snow accumulation.
[0092] As an optional example, in the device, the recognition unit 40 is further used to calculate the size of snow after detecting that the road image area contains snow, and the specific steps include:
[0093] Camera image calibration;
[0094] The image of the road surface area is extracted and corrected to obtain a bird's-eye view of the road;
[0095] Calculate the snow area using the following formula: , where W is the width of the road in reality, r is the ratio of the snow area to the road area in the image, the occupied road area is the area of the road where the snow is located, and ri is the width-to-length ratio of the road area occupied by the snow in the image.
[0096] As an optional example, in the device, the recognition unit 40 is further used to calculate the distance between the snow and the marker after detecting that the road image area contains snow, and the calculation formula is: ,
[0097] Among them, d4 is the straight-line distance of the snow from the landmark road;
[0098] d2 is the straight-line distance between the landmark and the camera road;
[0099] d3 is the straight-line distance between the camera and the snowy road. , where D is the distance between the snow and the camera, and its calculation formula is: , where d is the focal length of the camera, rate is the ratio of the actual distance to the image pixels, and H is the distance between the camera and the road;
[0100] θ is the angle between the snow and the landmark with respect to the camera, , β is the angle between the snow and the camera in the direction perpendicular to the road, α is the angle between the landmark and the camera in the direction perpendicular to the road, , where d1 is the straight-line distance from the camera to the road, and w1 is the distance from the snow in the image to the side of the road close to the camera.
[0101] like Fig.12 As shown, the present invention also provides an electronic device, including: a memory 100 and a processor 200, the memory 100 stores a computer program, and when the computer program is executed by the processor 200, the processor 200 executes the steps of the above method.
[0102] As described above, for ordinary technicians in this field, various other corresponding changes and modifications can be made based on the technical solutions and technical concepts of the present invention, and all these changes and modifications should fall within the protection scope of the claims of the present invention.
Claims
1. A method for identifying snow conditions on a road, characterized in that: The steps include: Acquire a road image whose snow status needs to be identified; The road image is segmented into road surface areas, side slope areas on both sides of the road surface and other areas, and the road surface area and the side slope areas on both sides of the road surface are cut out as the areas to be identified; Input the image of the area to be identified into the trained snow detection model to predict the possibility of snow accumulation; Compare the predicted average gray value of snow with the preset snow gray threshold to determine whether the road image area contains snow; After detecting that the road image area contains snow, the step of calculating the size of the snow is also included: Camera image calibration; The image of the road surface area is extracted and corrected to obtain a bird's-eye view of the road; Calculate the snow area using the following formula: Where W is the width of the road in reality, r is the ratio of the snow area to the road area in the image, the occupied road area is the area of the road where the snow is located, and ri is the width-to-length ratio of the road area occupied by the snow in the image; The camera image calibration is completed by fixing the road width and combining the camera shape parameters; After detecting that the road image area contains snow, the step of calculating the distance between the snow and the marker is also included: according to Get rate, where rate is the ratio of real distance to image pixels, W is the real width of the road, and w2 is the width of the road in the image; D is calculated according to D = rate * d, where D is the distance between the snow and the camera, d is the focal length of the camera, and the value of d is a known formal parameter of the camera; according to Calculate d3, where d3 is the straight-line distance between the camera's projection point on the ground and the snow, and H is the distance perpendicular to the road. The value of H is determined when the camera is set up; according to Calculating Beta , β is the angle between the line connecting the snow accumulation and the camera projection point on the ground and the direction of the camera projection point perpendicular to the ground road; d1 is the straight-line distance between the camera projection point and the ground road direction. The value of d1 is determined when the camera is set up; w1 is the distance of the snow accumulation from the road side close to the camera in the image. The value of w1 is obtained in the image; Calculate θ according to θ=β-α, where θ is the angle between the line connecting the snow and the camera's projection point on the ground and the line connecting the camera's projection point on the ground and the landmark, and α is the angle between the line connecting the camera's projection point on the ground and the landmark and the camera's projection point perpendicular to the ground road. The value of α is determined after setting the landmark and the camera. according to Calculate d4, where d4 is the straight-line distance from the snow to the road marker; d2 is the straight-line distance from the marker to the camera projection point. The value of d2 is determined after the marker and camera are set.
2. A road snow state recognition device, characterized in that: include: An acquisition unit, used for acquiring a road image whose snow state needs to be identified; An image segmentation and interception unit is used to segment the road image into regions, forming a road surface region, a slope region on both sides of the road surface, and other regions, and intercepting the road surface region and the slope region on both sides of the road surface as regions to be identified; The prediction unit inputs the image of the area to be identified into the trained snow detection model and predicts the possibility of snow accumulation; The recognition unit is used to compare the predicted average gray value of snow with a preset snow gray threshold value to determine whether the road image area contains snow; The recognition unit is also used to calculate the size of snow after detecting that the road image area contains snow. The specific steps include: Camera image calibration; The image of the road surface area is extracted and corrected to obtain a bird's-eye view of the road; Calculate the snow area using the following formula: Where W is the width of the road in reality, r is the ratio of the snow area to the road area in the image, the occupied road area is the area of the road where the snow is located, and ri is the width-to-length ratio of the road area occupied by the snow in the image; The recognition unit is also used to calculate the distance between the snow and the marker after detecting that the road image area contains snow, and the calculation method is: according to Get rate, where rate is the ratio of real distance to image pixels, W is the real width of the road, and w2 is the width of the road in the image; D is calculated according to D = rate * d, where D is the distance between the snow and the camera, d is the focal length of the camera, and the value of d is a known formal parameter of the camera; according to Calculate d3, where d3 is the straight-line distance between the camera's projection point on the ground and the snow, and H is the distance perpendicular to the road. The value of H is determined when the camera is set up; according to Calculating Beta , β is the angle between the line connecting the snow accumulation and the camera projection point on the ground and the direction of the camera projection point perpendicular to the ground road; d1 is the straight-line distance between the camera projection point and the ground road direction. The value of d1 is determined when the camera is set up; w1 is the distance of the snow accumulation from the road side close to the camera in the image. The value of w1 is obtained in the image; Calculate θ according to θ=β-α, where θ is the angle between the line connecting the snow and the camera's projection point on the ground and the line connecting the camera's projection point on the ground and the landmark, and α is the angle between the line connecting the camera's projection point on the ground and the landmark and the camera's projection point perpendicular to the ground road. The value of α is determined after setting the landmark and the camera. according to Calculate d4, where d4 is the straight-line distance from the snow to the road marker; d2 is the straight-line distance from the marker to the camera projection point. The value of d2 is determined after the marker and camera are set.
3. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the method according to claim 1.
