A highway automatic patrol system
Through the monitoring angle adjustment module of the highway automatic patrol system, lane recognition and pre-avoidance angle calculations solve the problem of over-exposure of surveillance videos and improve the accuracy of traffic flow monitoring.
Patent Information
- Application Number
- CN202410866183.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-01
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-01
AI Technical Summary
Highway surveillance videos are prone to overexposure at night or when the ambient brightness changes, resulting in inaccurate traffic flow monitoring results.
An automatic highway inspection system is designed. It obtains surveillance video data through the surveillance angle adjustment module, identifies lanes, determines the direction of vehicle movement, calculates the pre-avoidance angle and overexposure possibility, and adjusts the target angle of the surveillance equipment based on these parameters to prevent overexposure. exposure.
It effectively prevents over-exposure of surveillance videos, improves the accuracy and controllability of traffic flow monitoring, and ensures the accuracy of monitoring results.
Smart Images

Figure CN118413744B
Abstract
Description
Technical Field
[0001] The invention relates to the field of traffic control, and in particular to an automatic inspection system for expressways. Background Art
[0002] The highway inspection system includes multiple modules and their specific implementation methods. For example, the inspection system can be used to count the traffic volume of a certain section of the road to play the role of traffic flow monitoring. In addition, regular inspections can also be used to find sections with heavy traffic and prone to congestion, so that corresponding measures can be taken in time to divert traffic and ensure smooth roads.
[0003] In order to perform patrol inspections, surveillance cameras are generally used for video extraction, and then machine learning methods are used to identify vehicles in the video and count and analyze them to achieve the purpose of traffic monitoring. However, when using surveillance videos to count vehicle flow, errors in vehicle flow calculations caused by environmental issues may occur. For example, when monitoring vehicle flow at night through surveillance videos, if the strong light from the headlights is directly or reflected by other vehicles to the surveillance camera, the surveillance video will be temporarily overexposed, which will greatly reduce the recognizability of the vehicle in the surveillance video, making it difficult to monitor and obtain accurate vehicle flow.
[0004] Based on this, it is necessary to study an automatic highway patrol system to prevent overexposure of surveillance videos and thus improve the accuracy of traffic flow monitoring results. Summary of the invention
[0005] In order to solve the above technical problems, the purpose of the present invention is to provide an automatic highway inspection system, and the technical solutions adopted are as follows:
[0006] The present invention provides an automatic highway inspection system, the system comprising a monitoring angle adjustment module for preventing overexposure of monitoring video, the monitoring angle adjustment module being used for:
[0007] Acquire surveillance video data, and identify lanes in the surveillance video;
[0008] Determine a vehicle moving direction in each lane, and calculate a pre-avoidance angle corresponding to each lane based on the vehicle moving direction;
[0009] Calculate the overexposure probability corresponding to each lane;
[0010] Calculating a weight value of a pre-avoidance angle corresponding to each lane based on the overexposure possibility;
[0011] The target monitoring angle is determined based on the pre-avoidance angle and weight value corresponding to each lane.
[0012] In some embodiments, when determining the moving direction of the vehicle in each lane, the monitoring angle adjustment module is specifically used to:
[0013] Using the frame difference method to obtain the area in the target lane where the gray value difference is greater than a preset frame difference threshold, and taking the area where the gray value difference is greater than the preset frame difference threshold as the target moving area;
[0014] Based on the position change information of each pixel point in the target moving area, calculating the moving trajectory adaptability of the target moving area in the target lane;
[0015] The moving direction of the vehicle in the target lane is obtained according to the adaptability of the moving trajectory and the average moving direction of multiple pixel points in the target moving area.
[0016] In some embodiments, the calculating the adaptability of the moving trajectory of the target moving area in the target lane based on the position change information of each pixel point in the target moving area specifically includes:
[0017] Determine the corresponding pixel point of each pixel point in the target moving area in the previous frame of monitoring image;
[0018] Based on the moving distance and moving direction of each pixel point in the target moving area relative to the corresponding pixel point in the previous frame monitoring image, the moving trajectory adaptability of the target moving area in the target lane is obtained.
[0019] In some embodiments, when calculating the pre-avoidance angle corresponding to each lane based on the vehicle moving direction, the monitoring angle adjustment module is specifically used to:
[0020] Based on the moving direction of the vehicle in the target lane and the direction of the line between the position of the monitoring device and the designated position in the target lane, the pre-avoidance angle corresponding to the target lane is obtained.
[0021] In some embodiments, obtaining the pre-avoidance angle corresponding to the target lane based on the moving direction of the vehicle in the target lane and the connecting direction of the position of the monitoring device relative to the designated position in the target lane specifically includes:
[0022] When the angle between the direction of the line connecting the position of the monitoring device with respect to the first designated position in the target lane and the horizontal line of the monitoring image is within a first threshold range, the moving direction of the vehicle in the target lane is deflected by 30° to both sides to obtain a pre-avoidance angle corresponding to the target lane;
[0023] When the angle between the direction of the line connecting the position of the monitoring device relative to the first designated position in the target lane and the horizontal line of the monitoring image is outside the first threshold range, a vertical line perpendicular to the vehicle moving direction in the target lane is drawn through the first designated position, and the intersection of the vertical line and the lane line corresponding to the target lane is taken as the second designated position, and then the pre-avoidance angle corresponding to the target lane is obtained according to the direction of the line connecting the position of the monitoring device relative to the second designated position.
[0024] In some embodiments, when calculating the overexposure probability corresponding to each lane, the monitoring angle adjustment module is specifically used to:
[0025] Acquire multiple monitoring image frames, and determine the connected domain located in the target lane in each monitoring image frame;
[0026] Calculating the average area size of all connected domains located in the target lane in the multiple frames of monitoring images, and determining the number of connected domains whose area sizes meet preset conditions in the multiple frames of monitoring images;
[0027] Calculate the mean grayscale value in the target lane in each frame of monitoring image, and the mean grayscale value difference between the area corresponding to the target lane in each frame of monitoring image and the area corresponding to the target lane in the previous frame of monitoring image;
[0028] Obtaining a first parameter based on an average of the area sizes of all connected domains in the target lane and the number of connected domains whose area sizes meet a preset condition;
[0029] Obtaining a second parameter based on the grayscale value mean in the target lane and the grayscale value mean difference;
[0030] The sum of the second parameters corresponding to the multiple frames of monitoring images is calculated, and the sum is multiplied by the first parameter to obtain the overexposure possibility corresponding to the target lane.
[0031] In some embodiments, obtaining the second parameter based on the grayscale value mean and the grayscale value mean difference in the target lane specifically includes:
[0032] Obtaining a first ratio based on the grayscale value mean difference in the target lane and the difference between the first normalized result corresponding to the grayscale value mean and the maximum normalized value;
[0033] The first ratio is used as the second parameter.
[0034] In some embodiments, when calculating the weight value of the pre-avoidance angle corresponding to each lane based on the overexposure possibility, the monitoring angle adjustment module is specifically used to:
[0035] Normalizing the overexposure probability corresponding to the target lane to obtain a second normalized result;
[0036] The second normalized result is used as a weight value of the pre-avoidance angle corresponding to the target lane.
[0037] In some embodiments, when determining the target monitoring angle according to the pre-avoidance angle and the weight value corresponding to each lane, the monitoring angle adjustment module is specifically used to:
[0038] Determine the maximum angle range to ensure monitoring integrity;
[0039] Determining a candidate angle range other than the pre-avoidance angles corresponding to all lanes within the maximum angle range;
[0040] The target monitoring angle is obtained by performing range reduction within the candidate angle range based on the weight corresponding to the pre-avoidance angle.
[0041] In some embodiments, the range reduction is performed within the candidate angle range based on the weight corresponding to the pre-avoidance angle to obtain the target monitoring angle, specifically including:
[0042] Determining a reduction value based on a weight corresponding to the pre-avoidance angle and a size of the candidate angle range;
[0043] The candidate angle range is reduced based on the reduction value so that the target monitoring angle further deviates from the pre-avoidance angle corresponding to the target lane.
[0044] The present invention has the following beneficial effects:
[0045] In the automatic highway patrol system provided in some embodiments of the present specification, by calculating the pre-avoidance angle and overexposure possibility corresponding to each lane, and then determining the target monitoring angle of the monitoring equipment based on this, the overexposure problem in the monitoring video can be effectively prevented, thereby improving the controllability and accuracy of the traffic flow monitoring results. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present invention or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A schematic diagram of an exemplary composition of an automatic highway inspection system provided by an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of a road scene provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation, structure, features and effects of a highway automatic inspection system proposed according to the present invention in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0050] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0051] The specific scheme of the automatic highway inspection system provided by the present invention is described in detail below with reference to the accompanying drawings.
[0052] Figure 1 FIG. 1 shows an exemplary composition diagram of an automatic highway inspection system provided by an embodiment of the present invention. Figure 1 In an embodiment of the present application, the highway automatic inspection system may include a monitoring device 110 , a storage device 120 , a processing device 130 , a terminal device 140 and a network 150 . Figure 1 The various components in the embodiment can be connected in a variety of ways. For example, the monitoring device 110 can be connected to the storage device 120 and / or the processing device 130 through the network 150, or directly connected to the storage device 120 and / or the processing device 130. For another example, the storage device 120 can be connected to the processing device 130 directly or through the network 150. For another example, the terminal device 140 can be connected to the storage device 120 and / or the processing device 130 through the network 150, or directly connected to the storage device 120 and / or the processing device 130.
[0053] The monitoring device 110 can be installed on a gantry to obtain monitoring videos of a specified road section, which can reflect information such as vehicle flow and traffic conditions. In some embodiments, the monitoring device 110 can be set on a pan-tilt assembly, through which the monitoring angle of view can be adjusted. In some embodiments, the monitoring device 110 can have an independent power supply, which can send the collected monitoring videos to the network through wired or wireless (such as Bluetooth, WiFi, etc.) Figure 1 In some embodiments, Figure 1The monitoring device 110 may include multiple (eg, two or more) monitoring devices 110, and the multiple monitoring devices 110 may collect monitoring videos for the same or different road sections.
[0054] In some embodiments, the monitoring device 110 can send the monitoring video collected by the monitoring device 110 to the storage device 120, the processing device 130, the terminal device 140, etc. through the network 150. In some embodiments, the monitoring video collected by the monitoring device 110 can be processed by the processing device 130. For example, the processing device 130 can determine the pre-avoidance angle and overexposure possibility corresponding to each lane based on the monitoring video, and then determine the target monitoring angle based on this to prevent the monitoring video from having overexposure problems. In some embodiments, the pre-avoidance angle and overexposure possibility calculated by the processing device 130 for each lane can be sent to the storage device 120 for recording, or sent to the terminal device 140 for feedback to the user (such as traffic police or relevant management personnel).
[0055] Network 150 may facilitate the exchange of information and / or data. Network 150 may include Figure 1 In some embodiments, Figure 1 At least one component (eg, monitoring device 110, storage device 120, processing device 130, terminal device 140) can communicate with the network 150. Figure 1 at least one other component in the vehicle. For example, the processing device 130 may obtain a surveillance video collected for a target road section from the monitoring device 110 and / or the storage device 120 via the network 150. For another example, the processing device 130 may obtain a user operation instruction from the terminal device 140 via the network 150. Exemplary operation instructions may include but are not limited to accessing surveillance videos, reading a pre-avoidance angle and overexposure possibility corresponding to each lane determined based on the surveillance video, and a target monitoring angle determined based on the pre-avoidance angle and overexposure possibility, etc.
[0056] In some embodiments, the network 150 may be any form of wired or wireless network, or any combination thereof. By way of example only, the network 150 may include a cable network, a wired network, a fiber optic network, a telecommunications network, an intranet, the Internet, a local area network (LAN), a wide area network (WAN), a wireless local area network (WLAN), a metropolitan area network (MAN), a public switched telephone network (PSTN), a Bluetooth network, a ZigBee network, a near field communication (NFC) network, etc., or any combination thereof. In some embodiments, the network 150 may include at least one network access point, Figure 1 At least one component of the system may be connected to the network 150 through an access point to exchange data and / or information.
[0057] The storage device 120 may store data, instructions, and / or any other information. In some embodiments, the storage device 120 may store data obtained from the monitoring device 110, the processing device 130, and / or the terminal device 140. For example, the storage device 120 may store the monitoring video collected by the monitoring device 110; for another example, the storage device 120 may store the pre-avoidance angle and overexposure possibility corresponding to each lane calculated by the processing device 130. In some embodiments, the storage device 120 may store data and / or instructions used by the processing device 130 to execute or use to complete the exemplary method described in this specification (e.g., steps S1 to S5). In some embodiments, the storage device 120 may include a large-capacity memory, a removable memory, a volatile read-write memory, a read-only memory (ROM), etc., or any combination thereof. Exemplary large-capacity memory may include a magnetic disk, an optical disk, a solid-state disk, etc. In some embodiments, the storage device 120 may be implemented on a cloud platform. As an example only, the cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an internal cloud, a multi-layer cloud, etc., or any combination thereof.
[0058] In some embodiments, storage device 120 may be connected to network 150 to communicate with Figure 1 communicates with at least one other component (eg, monitoring device 110, processing device 130, terminal device 140). Figure 1 At least one component in the storage device 120 can access data, instructions or other information stored in the storage device 120 through the network 150. In some embodiments, the storage device 120 can be connected to the storage device 120. Figure 1 One or more components (eg, monitoring device 110, terminal device 140) are directly connected or communicated. In some embodiments, storage device 120 may be a part of monitoring device 110 and / or processing device 130.
[0059] The processing device 130 can process the data from the monitoring device 110, the storage device 120, the terminal device 140 and / or Figure 1 other components to obtain data and / or information. In some embodiments, the processing device 130 may obtain a monitoring video from any one or more of the monitoring device 110, the storage device 120, or the terminal device 140, and process the monitoring video to determine the pre-avoidance angle and overexposure possibility corresponding to each lane, and then determine the target monitoring angle based on this to prevent the monitoring video from being overexposed. In some embodiments, the processing device 130 may include a monitoring angle adjustment module for preventing the monitoring video from being overexposed, and the monitoring angle adjustment module may obtain a pre-stored computer instruction from the storage device 120, and execute the computer instruction to implement steps S1 to S5 described in this specification.
[0060] In some embodiments, the processing device 130 may be a single server or a server group. The server group may be centralized or distributed. In some embodiments, the processing device 130 may be local or remote. For example, the processing device 130 may access information and / or data from the monitoring device 110, the storage device 120, and / or the terminal device 140 via the network 150. For another example, the processing device 130 may be directly connected to the monitoring device 110, the storage device 120, and / or the terminal device 140 to access information and / or data. In some embodiments, the processing device 130 may be implemented on a cloud platform. For example, a cloud platform may include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, a cloud-to-cloud cloud, a multi-cloud, etc., or any combination thereof.
[0061] The terminal device 140 can receive, send and / or display data. The received data may include monitoring videos collected by the monitoring device 110, data stored in the storage device 120, data processed by the processing device 130, etc. The sent data may include data and instructions input by the user, etc. For example, the terminal device 140 can send the operation instructions input by the user to the monitoring device 110 through the network 150 to control the monitoring device 110 to perform corresponding image acquisition or viewing angle adjustment.
[0062] In some embodiments, the terminal device 140 may include a mobile device 141, a tablet computer 142, a laptop computer 143, etc., or any combination thereof. For example, the mobile device 141 may include a mobile phone, a personal digital assistant (PDA), a dedicated mobile terminal, etc., or any combination thereof. In some embodiments, the terminal device 140 may include an input device (such as a keyboard, a touch screen), an output device (such as a display, a speaker), etc. In some embodiments, the processing device 130 may be a part of the terminal device 140.
[0063] It should be noted that the above Figure 1 The description is only for example and explanation, and does not limit the scope of application of this specification. For those skilled in the art, under the guidance of this specification, Figure 1 Various modifications and changes may be made. However, these modifications and changes are still within the scope of this specification. For example, the monitoring device 110 may include more or fewer functional components.
[0064] It should also be noted that, in the embodiment of the present application, the aforementioned monitoring angle adjustment module can be configured in the form of software and / or hardware to the processing device 130, so as to process the monitoring video collected by the monitoring device 110, and determine the pre-avoidance angle and overexposure possibility corresponding to each lane based on the monitoring video, and then determine the target monitoring angle based on this to prevent the monitoring video from having an overexposure problem. Specifically, in the embodiment of the present application, the monitoring angle adjustment module can be used to perform the following steps:
[0065] S1, acquiring surveillance video data, and identifying lanes in the surveillance video.
[0066] The embodiment of the present application aims to optimize the acquisition angle of the surveillance video by analyzing the surveillance video and eliminate the vehicle flow counting error caused by overexposure. Therefore, in the embodiment of the present application, it is first necessary to collect surveillance video data within a specific time period.
[0067] Preferably, in some embodiments, surveillance video during the nighttime traffic peak period (e.g., 19:00-22:00) may be selected, and then the surveillance video data within this time period may be used for processing to determine a target surveillance angle based on this that can prevent the surveillance video from being overexposed.
[0068] Specifically, in the embodiment of the present application, in order to ensure the recognition and acquisition of subsequent monitoring avoidance angles and other features, a DNN (Deep Neural Networks) neural network can be used to first identify and acquire lane lines in the monitoring video, wherein the input of the DNN neural network is different frame images of the monitoring video, and the output is the lane line division result. The loss function can use a cross entropy function to obtain the lane line division result of each lane in the monitoring video. The specific implementation method of using the DNN neural network to identify lanes in the monitoring video can be regarded as a prior art and will not be discussed in detail in this specification.
[0069] S2, determining a moving direction of a vehicle in each lane, and calculating a pre-avoidance angle corresponding to each lane based on the moving direction of the vehicle.
[0070] In order to prevent the monitoring device from being overexposed due to changes in ambient brightness at night, the embodiment of the present application selects to analyze and judge the brightness of the video frames in the monitoring video data in real time. It can be understood that when the brightness threshold is exceeded, overexposure will be caused. Therefore, in the embodiment of the present application, in order to avoid the problem of picture recognition caused by the brightness being higher than the overexposure threshold, the monitoring angle of the monitoring device is selected to be adjusted so that it meets the requirements of low brightness changes.
[0071] Furthermore, in order to determine the angle adjustment range of the monitoring device, in an embodiment of the present application, you can choose to analyze the motion trajectory of the moving object, and then determine the corresponding avoidance angle of the monitoring device based on the changes in the motion trajectory of the moving object, so as to reduce or eliminate the probability of overexposure.
[0072] Specifically, in some embodiments, in order to determine the vehicle moving direction in each lane, the monitoring angle adjustment module can use the frame difference method to obtain the area in the target lane where the grayscale value difference is greater than a preset frame difference threshold (for example, it can be set to 40 grayscale values), and use the area where the grayscale value difference is greater than the preset frame difference threshold as the target moving area; then, the monitoring angle adjustment module can calculate the moving trajectory adaptability of the target moving area in the target lane based on the position change information of each pixel point in the target moving area; finally, according to the moving trajectory adaptability and the average moving direction of multiple pixels in the target moving area, the vehicle moving direction in the target lane is obtained.
[0073] The calculation process of the above vehicle moving direction can be expressed by the following formula:
[0074]
[0075]
[0076] in, Indicates the adaptability of the moving trajectory of the target moving area within the target lane. Indicates the first The pixel Euclidean distance between the position of a pixel point in the current frame and the original position in the previous frame (the pixel point with the closest gray value can be found in the n*n neighborhood corresponding to the same position in the current frame, and it is used as the corresponding point after the pixel point in the previous frame is moved. The pixel Euclidean distance between the two is , that is, moving distance of each moving point). The angle between the line connecting the position of the ith pixel in the target moving area in the previous frame and the position after moving in the current frame and the horizontal line of the image, that is, The moving direction of the moving point. Indicates the total number of pixels that meet the preset frame difference threshold, that is, the total number of pixels in the target moving area. Represents an anti-zero coefficient, which is used to prevent the denominator from being 0 and causing the formula to be meaningless (in this embodiment of the application, Can be set to a larger value, such as 10, to ensure The value range is around 1). Indicates the moving distance corresponding to all pixels that meet the preset frame difference threshold The mean of Indicates the moving direction corresponding to all pixels that meet the preset frame difference threshold The mean angle of . Indicates the moving direction of the vehicle in the target lane.
[0077] In the above calculation formula, the mobility trajectory adaptability The purpose is to analyze the rationality of the displacement of vehicle movement in the monitoring video. Specifically, in the embodiment of the present application, the frame difference method can be used to obtain the area in the target lane where the gray value difference is greater than the preset frame difference threshold, and the area where the gray value difference is greater than the preset frame difference threshold is taken as the target moving area, which corresponds to the moving target in the target lane. ( ) can characterize the rationality of the moving distance of the moving target (vehicle). All pixels that meet the preset frame difference threshold, as the pixel components of the vehicle, should have a displacement close to the same. (Right now On the contrary, if the pixel is not a component pixel of the vehicle, but an object moving a limited distance in other scenes, such as debris, the difference result will be farther away. Similarly, when the moving target is a relatively regular vehicle, that is, when a single vehicle body area moves, other areas will also move. The difference result of the angle ( ) is closer to 0, the denominator is closer to the value At this time, the closer the ratio result is to 1, the higher the adaptability of the corresponding moving trajectory. At this time, the angle mean The higher the credibility or adaptability of the vehicle's moving direction.
[0078] By calculating in the above way, the direction of vehicle movement in each lane can be obtained. After obtaining the direction of vehicle movement, in order to prevent the possibility of overexposure of the monitoring lens due to the increased concentration of car lights in the scene, it is necessary to analyze the corresponding pre-avoidance angle based on the direction of vehicle movement. The specific logic is: the higher the degree of parallelism between the effective angle range of the monitoring equipment and the direction of movement, the greater the possibility of overexposure, so it is necessary to avoid the angle corresponding to the direction of vehicle movement as much as possible.
[0079] In an embodiment of the present application, the pre-avoidance angle corresponding to the target lane can be obtained based on the vehicle moving direction in the target lane calculated by the aforementioned process and the connecting direction of the position of the monitoring device relative to the specified position in the target lane.
[0080] Specifically, in the embodiment of the present application, when the angle between the direction of the line connecting the position of the monitoring device relative to the first designated position in the target lane and the horizontal line of the monitoring image is within the first threshold range, the moving direction of the vehicle in the target lane can be deflected 30° to both sides to obtain the pre-avoidance angle corresponding to the target lane. Figure 2 In this specification, the first designated position may refer to a point on the central axis of each lane that is a designated distance (may be 5 meters or 10 meters) from the projection point of the monitoring device on the road surface in the road extension direction, for example Figure 2 D1, D2 and D3 in the figure are the first designated positions in lane A, lane B and lane C respectively. The first threshold range can be 80°~100°. For lane B, the direction of the line connecting its first designated position D2 and the position O of the monitoring device is relative to the horizontal line of the monitoring image (reference Figure 2 The angle between the lane B and the vehicle in lane B is approximately 90°. Deflect 30° to both sides to obtain the pre-avoidance angle corresponding to lane B. For example, when the moving direction of the vehicle in lane B is 90°, the corresponding pre-avoidance angle is 60°~120°.
[0081] When the angle between the direction of the line connecting the position of the monitoring device relative to the first designated position in the target lane and the horizontal line of the monitoring image is outside the first threshold range, a vertical line perpendicular to the vehicle moving direction in the target lane can be drawn through the first designated position, and the intersection of the vertical line and the lane line corresponding to the target lane is taken as the second designated position, and then the pre-avoidance angle corresponding to the target lane is obtained according to the direction of the line connecting the position of the monitoring device relative to the second designated position.
[0082] Continue to refer to Figure 2 ,At once Figure 2 For lane A in the image, since the angle between the line direction between the monitoring device position O and its first designated position D1 and the horizontal line of the monitoring image is greater than 100°, it is outside the first threshold range. At this time, a vertical line perpendicular to the vehicle moving direction in lane A can be drawn through the first designated position D1, and the intersection point (D4, D5) of the vertical line and the lane line corresponding to lane A is taken as the second designated position. Then, the pre-avoidance angle corresponding to lane A is obtained according to the line direction (OD4, OD5) between the monitoring device position O and the second designated position (D4, D5).
[0083] Similarly, for lane C, a vertical line perpendicular to the vehicle moving direction in lane C can be drawn through the first designated position D3 in lane C, and the intersection point (D6, D7) of the vertical line and the lane line corresponding to lane C is used as the second designated position. Then, the pre-avoidance angle corresponding to lane C is obtained based on the connection direction (OD6, OD7) of the monitoring device position O relative to the second designated position (D6, D7).
[0084] S3, calculating the overexposure possibility corresponding to each lane.
[0085] The pre-avoidance angle of the monitoring device is intended to eliminate the sudden increase or decrease in brightness caused by the concentration of vehicles on the lane. At a time point when the number of vehicles is relatively concentrated, there are many vehicles on each lane, so the corresponding pre-avoidance angle ranges may conflict with each other (i.e., it is impossible to take all lanes into account). At this time, the monitoring device may not be able to accurately optimize the angle. In order to eliminate the inability to accurately determine the angle range caused by this situation, in some embodiments, it is possible to analyze the degree of highlight tendency of different lanes, analyze the possibility of lane overexposure based on this degree, and obtain the corresponding pre-avoidance weight.
[0086] The more vehicles there are in a lane, the higher the corresponding highlight tendency (more lights); in addition, the type and purpose of the vehicle are different, and the corresponding headlight brightness is different, so the highlight tendency is also different. For example, different types of vehicles, such as passenger cars, trucks, large trucks, etc., are equipped with different types and brightness of lights due to their different designs and purposes. Generally speaking, large trucks or commercial vehicles, especially those that often travel at night or in poor visibility conditions, require stronger lighting to ensure safety. The higher the corresponding highlight tendency, the higher the exposure possibility, and the higher the corresponding avoidance weight.
[0087] Based on the above analysis, in the embodiment of the present application, the highlight tendency of each lane can be calculated to analyze its overexposure possibility, and then determine the weight value of its corresponding pre-avoidance angle. As a preferred example, the process of obtaining the highlight tendency and the overexposure possibility of different lanes is as follows:
[0088] In the embodiment of the present application, the Otsu threshold can be used to segment the vehicles and background in different lanes (the Otsu threshold is selected here instead of the edge detection operator to reduce the amount of calculation and increase the real-time nature of the analysis), and the size of the area enclosed by each connected domain in the lane after segmentation (the connected domain is intended to ensure that the outer contour of the vehicle is clearly visible) is obtained, and the corresponding highlight tendency is calculated, and then the overexposure possibility corresponding to each lane is characterized by the highlight tendency. The calculation process of the overexposure possibility can be expressed as follows:
[0089]
[0090] in, Indicates the overexposure possibility corresponding to the highlight tendency value of the target lane; It represents the average area size of all connected domains located in the target lane in the T-frame monitoring image; Indicates the number of connected domains whose area size meets the preset condition in the T-frame monitoring image (wherein the preset condition means that the area size is above the mean); Represents the difference in the mean grayscale values of the area corresponding to the target lane in the two adjacent frames of monitoring images (i.e., the difference between the mean grayscale value of the area corresponding to the target lane in the previous frame and the mean grayscale value of the area corresponding to the target lane in the next frame); Indicates The mean gray value of the area corresponding to the target lane in the frame monitoring image; Indicates the total number of frames involved in the calculation. In the embodiment of the present application, 15 frames are taken (i.e. =15, if the acquisition frequency of the monitoring device is 30 frames per second, the overexposure possibility is calculated once every half second); Represents the normalization operation, which is used to Mapped to the range of 0 to 1.
[0091] In the above calculation formula, the coefficient part The purpose is to quantify the above logic: the more vehicles there are in the lane, the higher the corresponding highlight tendency (the more headlights); the different types and uses of vehicles have different corresponding headlight brightness, so the highlight tendency is also different. For example, different types of vehicles, such as passenger cars, vans, and large trucks, are equipped with headlights of different types and brightness due to their different designs and uses. At this time, in order to adapt to this logic, by analyzing the number of connected domains in the lane and their corresponding area size, the corresponding overexposure possibility is obtained. The larger the value of is, the higher the possibility of overexposure of the lane is. , where the numerator is intended to quantify the brightness difference between the previous and next frames. The greater the brightness difference and the higher the cumulative sum, the higher the corresponding overexposure possibility. Corresponding to the scene, when the vehicles are more concentrated or closer to the monitoring equipment area, the higher the influence of the headlight brightness on the exposure of the monitoring equipment when collecting images, the higher the corresponding overexposure possibility; the denominator is intended to quantify the difference between the normalized mean grayscale value under the frame and the maximum normalized value corresponding to the maximum brightness, because when the monitoring equipment lens is overexposed, the biggest feature is that the overall grayscale value of the monitoring image of the frame is high, and the monitoring target cannot be distinguished, so the difference The smaller it is, the higher the corresponding overexposure degree will be.
[0092] In other words, in the embodiment of the present application, when calculating the overexposure possibility corresponding to each lane, the monitoring angle adjustment module can obtain multiple frames of monitoring images and determine the connected domain located in the target lane in each frame of monitoring images. Then, the average area size of all connected domains located in the target lane in the multiple frames of monitoring images is calculated ( ), and determine the number of connected domains whose area size meets the preset conditions in the multi-frame monitoring image ( ). Furthermore, the monitoring angle adjustment module can calculate the mean grayscale value in the target lane in each frame of the monitoring image ( ), and the grayscale value mean difference between the area corresponding to the target lane in each monitoring image frame and the area corresponding to the target lane in the previous monitoring image frame ( ); and obtain the first parameter ( based on the average area of all connected domains in the target lane and the number of connected domains whose area meets the preset conditions ), based on the gray value mean in the target lane and the gray value mean difference, the second parameter ( ). Finally, by calculating the sum of the second parameters corresponding to multiple frames of monitoring images and multiplying it by the aforementioned first parameter, the overexposure probability corresponding to the target lane is obtained. .
[0093] Specifically, in the embodiment of the present application, based on the gray value mean difference ( ) and the difference between the first normalized result corresponding to the mean grayscale value in the target lane and the maximum normalized value ( ), and obtain the first ratio ( ), and then use the first ratio as the second parameter corresponding to each frame of the monitoring image.
[0094] S4: Calculate a weight value of a pre-avoidance angle corresponding to each lane based on the overexposure possibility.
[0095] Through the above steps, the overexposure probability corresponding to each lane can be calculated. Further, the monitoring angle adjustment module can calculate the weight value of the pre-avoidance angle corresponding to each lane based on the overexposure probability.
[0096] Exemplarily, in some embodiments, the overexposure probability corresponding to the target lane may be normalized to obtain a second normalized result; then, the second normalized result is used as the weight value of the pre-avoidance angle corresponding to the target lane.
[0097] It can be understood that the lane with a higher exposure level needs to be avoided more, so the corresponding monitoring device has a higher pre-avoidance angle weight. Based on this, in some embodiments, the process can be expressed as follows:
[0098]
[0099] in, Indicates The weight value of the pre-avoidance angle corresponding to each lane; Indicates that the The degree of overexposure corresponding to each lane The normalized value (i.e. the second normalization result).
[0100] S5, determining a target monitoring angle according to a pre-avoidance angle and a weight value corresponding to each lane.
[0101] After obtaining the pre-avoidance angle and weight value corresponding to each lane, the monitoring angle adjustment module can determine the target monitoring angle of the monitoring device based on this. The target monitoring angle can be understood as a better acquisition angle that can prevent overexposure of the monitoring video.
[0102] Specifically, in some embodiments, the maximum angle range that ensures monitoring integrity can be first determined, and then the candidate angle range excluding the pre-avoidance angles corresponding to all lanes can be determined within the maximum angle range. Finally, the range can be reduced within the candidate angle range based on the weights corresponding to the aforementioned pre-avoidance angles to obtain the target monitoring angle.
[0103] More specifically, the monitoring angle adjustment module can determine a reduction value based on the weights corresponding to the pre-avoidance angles of each lane and the size of the candidate angle range; and then reduce the candidate angle range based on the reduction value so that the target monitoring angle further deviates from the pre-avoidance angle corresponding to the target lane.
[0104] For example, assuming that the pre-avoidance angle corresponding to lane B is 60°~120°, the pre-avoidance angle corresponding to lane A is 135°~150°, and the pre-avoidance angle corresponding to lane C is 25°~45°, and the maximum angle range to ensure monitoring integrity is 30°~150°, then the candidate angles can be 45°~60° and 120°~135°. At this time, the target monitoring angle can be determined within the two ranges of 45°~60° or 120°~135°.
[0105] In some embodiments, when there are multiple candidate angle ranges, a final candidate angle range may be selected from the multiple candidate angle ranges according to the weights corresponding to the pre-avoidance angles of each lane. For example, when the weight value corresponding to lane A is 0.8 (its corresponding pre-avoidance angle is 135°~150°), the weight value corresponding to lane B is 0.7 (its corresponding pre-avoidance angle is 60°~120°), and the weight value corresponding to lane C is 0.5 (its corresponding pre-avoidance angle is 25°~45°), the candidate angle range with the most pre-avoidance angles that deviate from lane A (i.e., 45°~60°) may be selected as the final candidate angle range.
[0106] Specifically, if 45°~60° is determined as the final candidate angle range, the reduction value can be further determined according to the weight values corresponding to lane B and lane C (because the candidate angle range is closest to the pre-avoidance angle range of lane B and lane C).
[0107] In some embodiments, the reduction value may be determined based on the larger of the weight values corresponding to lane B and lane C, and the size of the candidate angle range. In addition, in some embodiments, the reduction value on the side of the lane with a larger weight value may be larger than the reduction value on the side of the lane with a smaller weight value, so that the target monitoring angle deviates more from the pre-avoidance angle corresponding to the larger weight value.
[0108] For example, in some embodiments, if the weight value corresponding to lane B is greater than the weight value of lane C, in order to make the final target monitoring angle further deviate from the pre-avoidance angle corresponding to lane B, the reduction value of the pre-avoidance angle close to lane B can be determined based on the size of the candidate angle range (60°-45°=15°) and the weight value corresponding to lane B. , the reduction value of the pre-avoidance angle corresponding to the lane B is . Specifically, if =0.7, the target monitoring angle is 47.25°~54.75°.
[0109] On the contrary, if the weight value corresponding to lane C is greater than the weight value of lane B, the reduction value of the pre-avoidance angle end close to lane C should be greater than the reduction value of the pre-avoidance angle end far from lane C. Specifically, if is also 0.7, then the target monitoring angle should be 50.25°~57.75°.
[0110] It should be noted that the above data are only exemplary. In actual applications, the above weight values, pre-avoidance angles, and candidate angle ranges may be other values. In the embodiment of the present application, the corresponding target monitoring angle may be obtained based on the actual data obtained by calculation.
[0111] It is understood that after obtaining the above target monitoring angle, the acquisition angle of the monitoring device can be adjusted to the target monitoring angle range to prevent the monitoring video from being overexposed, thereby improving the recognizability of the monitoring video and the monitorability of the vehicle flow, and ensuring the accuracy of vehicle flow statistics based on the monitoring video. In some embodiments, the target monitoring angle can be determined based on the real-time monitoring video, so that the acquisition angle of the monitoring device can be adjusted in real time according to the actual situation.
[0112] In some embodiments, a machine learning algorithm can be used to obtain traffic flow results. In an embodiment of the present application, a machine learning or deep learning model can be selected for vehicle detection. Commonly used models include YOLO (You Only Look Once), SSD (Single Shot MultiBox Detector) or Faster R-CNN based on convolutional neural networks (CNN), etc. In the embodiment of the present application, the YOLO network is selected. Through training, the model can acquire the ability to recognize different types of vehicles (such as cars, trucks, etc.), and the loss function used in training is the cross entropy function.
[0113] Furthermore, an algorithm can be developed to identify and track vehicles from each video frame. The tracking algorithm can be SORT (Simple Online and Realtime Tracking) or Deep SORT, which can be used to track the movement of vehicles in the video. Finally, the traffic flow statistics can be obtained through statistical methods, for example, based on the number of vehicles passing through a specific area.
[0114] It should be understood that in this specification, Figure 1The shown highway automatic patrol system and its monitoring angle adjustment module can be implemented in various ways. For example, in some embodiments, the monitoring angle adjustment module can be implemented by hardware, software, or a combination of software and hardware. Among them, the hardware part can be implemented using dedicated logic; the software part can be stored in a memory and executed by an appropriate instruction execution system, such as a microprocessor or a dedicated design hardware. Those skilled in the art can understand that the above-mentioned system can be implemented using computer executable instructions and / or included in a processor control code, for example, such as a carrier medium such as a disk, CD or DVD-ROM, a programmable memory such as a read-only memory (firmware), or a data carrier such as an optical or electronic signal carrier. Such code is provided on the system and its modules of this specification. Not only can the hardware circuits such as ultra-large-scale integrated circuits or gate arrays, semiconductors such as logic chips, transistors, etc., or programmable hardware devices such as field programmable gate arrays, programmable logic devices, etc. be implemented, it can also be implemented by software executed by various types of processors, and it can also be implemented by a combination of the above-mentioned hardware circuits and software (for example, firmware).
[0115] In summary, the beneficial effects that may be brought about by the present invention include but are not limited to: (1) In the automatic highway patrol system provided in some embodiments of the present specification, by calculating the pre-avoidance angle and overexposure possibility corresponding to each lane, and then determining the target monitoring angle of the monitoring device based on this, the overexposure problem in the monitoring video can be effectively prevented, thereby improving the controllability and accuracy of the traffic flow monitoring results; (2) In the automatic highway patrol system provided in some embodiments of the present specification, by calculating the pre-avoidance angle corresponding to each lane based on the vehicle moving direction and the connecting direction of the position of the monitoring device relative to the specified position in the target lane, the target monitoring angle of the monitoring device can be determined for different lanes and under different circumstances. The required avoidance angle can be determined to provide data support for subsequent calculations and effectively prevent the overexposure problem in the monitoring video; (3) In the automatic highway inspection system provided in some embodiments of the present specification, the highlight tendency of each lane is determined by the average size of the connected domains in the target lane in multiple frames of monitoring images, the number of connected domains whose area size meets the preset conditions, the average grayscale value in the target lane in each frame of monitoring images, and the average grayscale value difference between the area corresponding to the target lane in each frame of monitoring images and the area corresponding to the target lane in the previous frame of monitoring images. Factors such as the number of vehicles and the type of vehicle (headlights) can be comprehensively considered to accurately measure the possibility of overexposure of each lane.
[0116] It should be noted that different embodiments may produce different beneficial effects. In different embodiments, the beneficial effects that may be produced may be any one or a combination of the above, or may be any other possible beneficial effects.
[0117] It should also be noted that the order of the above embodiments of the present invention is for description only and does not represent the advantages and disadvantages of the embodiments. The processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0118] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0119] The basic concepts of the present invention have been described above. Obviously, for those skilled in the art, the above detailed disclosure is only for example. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements and corrections to this specification. Such modifications, improvements and corrections are suggested in this specification, so such modifications, improvements and corrections still belong to the scope of the exemplary embodiments of this specification.
Claims
1. An automatic highway inspection system, It is characterized in that The system includes a monitoring angle adjustment module for preventing overexposure of the monitoring video, and the monitoring angle adjustment module is used to: Acquire surveillance video data, and identify lanes in the surveillance video; Determine a vehicle moving direction in each lane, and calculate a pre-avoidance angle corresponding to each lane based on the vehicle moving direction; Calculate the overexposure probability corresponding to each lane; Calculating a weight value of a pre-avoidance angle corresponding to each lane based on the overexposure possibility; Determine the target monitoring angle according to the pre-avoidance angle and weight value corresponding to each lane; When determining the moving direction of the vehicle in each lane, the monitoring angle adjustment module is specifically used to: Using the frame difference method to obtain the area in the target lane where the gray value difference is greater than a preset frame difference threshold, and taking the area where the gray value difference is greater than the preset frame difference threshold as the target moving area; Based on the position change information of each pixel point in the target moving area, calculating the moving trajectory adaptability of the target moving area in the target lane; According to the adaptability of the moving trajectory and the average of the moving directions of multiple pixel points in the target moving area, the moving direction of the vehicle in the target lane is obtained; When calculating the pre-avoidance angle corresponding to each lane based on the vehicle moving direction, the monitoring angle adjustment module is specifically used to: Based on the moving direction of the vehicle in the target lane and the direction of the line between the position of the monitoring device and the designated position in the target lane, obtaining a pre-avoidance angle corresponding to the target lane; The obtaining of the pre-avoidance angle corresponding to the target lane based on the moving direction of the vehicle in the target lane and the connecting direction of the position of the monitoring device relative to the designated position in the target lane specifically includes: When the angle between the direction of the line connecting the position of the monitoring device with respect to the first designated position in the target lane and the horizontal line of the monitoring image is within a first threshold range, the moving direction of the vehicle in the target lane is deflected by 30° to both sides to obtain a pre-avoidance angle corresponding to the target lane; When the angle between the direction of the line connecting the position of the monitoring device relative to the first designated position in the target lane and the horizontal line of the monitoring image is outside the first threshold range, a vertical line perpendicular to the moving direction of the vehicle in the target lane is drawn through the first designated position, and the intersection of the vertical line and the lane line corresponding to the target lane is taken as the second designated position, and then the pre-avoidance angle corresponding to the target lane is obtained according to the direction of the line connecting the position of the monitoring device relative to the second designated position; When calculating the overexposure possibility corresponding to each lane, the monitoring angle adjustment module is specifically used to: Acquire multiple monitoring image frames, and determine the connected domain located in the target lane in each monitoring image frame; Calculating the average area size of all connected domains located in the target lane in the multiple frames of monitoring images, and determining the number of connected domains whose area sizes meet preset conditions in the multiple frames of monitoring images; Calculate the mean grayscale value in the target lane in each frame of monitoring image, and the mean grayscale value difference between the area corresponding to the target lane in each frame of monitoring image and the area corresponding to the target lane in the previous frame of monitoring image; Obtaining a first parameter based on an average of the area sizes of all connected domains in the target lane and the number of connected domains whose area sizes meet a preset condition; Obtaining a second parameter based on the grayscale value mean in the target lane and the grayscale value mean difference; Calculating a sum of the second parameters corresponding to the multiple frames of monitoring images and multiplying the sum by the first parameter to obtain an overexposure possibility corresponding to the target lane; When calculating the weight value of the pre-avoidance angle corresponding to each lane based on the overexposure possibility, the monitoring angle adjustment module is specifically used to: Normalizing the overexposure probability corresponding to the target lane to obtain a second normalized result; Using the second normalized result as a weight value of the pre-avoidance angle corresponding to the target lane; When determining the target monitoring angle according to the pre-avoidance angle and weight value corresponding to each lane, the monitoring angle adjustment module is specifically used to: Determine the maximum angle range to ensure monitoring integrity; Determining a candidate angle range other than the pre-avoidance angles corresponding to all lanes within the maximum angle range; Performing range reduction within the candidate angle range based on the weight corresponding to the pre-avoidance angle to obtain a target monitoring angle; The step of reducing the range within the candidate angle range based on the weight corresponding to the pre-avoidance angle to obtain the target monitoring angle specifically includes: Determining a reduction value based on a weight corresponding to the pre-avoidance angle and a size of the candidate angle range; The candidate angle range is reduced based on the reduction value so that the target monitoring angle further deviates from the pre-avoidance angle corresponding to the target lane.
2. An automatic highway inspection system as claimed in claim 1, It is characterized in that The calculating, based on the position change information of each pixel point in the target moving area, the moving trajectory adaptability of the target moving area in the target lane specifically includes: Determine the corresponding pixel point of each pixel point in the target moving area in the previous frame of monitoring image; Based on the moving distance and moving direction of each pixel point in the target moving area relative to the corresponding pixel point in the previous frame monitoring image, the moving trajectory adaptability of the target moving area in the target lane is obtained.
3. The automatic highway inspection system according to claim 1, It is characterized in that The obtaining of the second parameter based on the grayscale value mean and the grayscale value mean difference in the target lane specifically includes: Obtaining a first ratio based on the grayscale value mean difference in the target lane and the difference between the first normalized result corresponding to the grayscale value mean and the maximum normalized value; The first ratio is used as the second parameter.
