Vehicle reverse running detection method and device and computer readable storage medium
1. A vehicle reverse running detection method is characterized in that: the method comprises the following steps:
acquiring a road image in a detection area, and determining the probability that a lane in the detection area is a forward lane based on a neural network model;
acquiring images of a plurality of moving vehicles in a detection area, and determining reverse driving probabilities of the plurality of vehicles based on a neural network model;
and determining whether reverse driving behaviors exist in the plurality of vehicles according to the probability that the lane is a forward lane and the reverse driving probabilities of the plurality of vehicles.
2. The vehicle reverse running detection method according to claim 1, characterized in that:
the method for acquiring the road image in the detection area and acquiring the images of a plurality of moving vehicles in the detection area comprises the following steps:
and carrying out mobile acquisition on road information in the detection area and generating an image while moving.
3. The vehicle reverse running detection method according to claim 2, characterized in that:
the method for determining the lane in the detection area as the forward lane comprises the following steps:
determining that a lane where equipment for mobile acquisition is located is a forward lane;
and judging whether the lane line in the road image is a broken line, if so, determining that the lanes on two sides of the lane line are forward lanes.
4. The vehicle reverse running detection method according to claim 2, characterized in that:
the method for determining the reverse driving probability of a plurality of vehicles comprises the following steps: obtaining a moving target map through a moving target detection algorithm, recording the moving target map as M, and recording surrounding frames of all target vehicles detected in the current frame as Cn, wherein n is 1, 2, 3 …;
thus, the moving vehicle On, M ☉ Cn,
wherein ☉ is a matting operation on the image of the bounding box;
and inputting the obtained moving vehicle image into a trained reverse running detection model to obtain the reverse running probability of the vehicle.
5. The vehicle reverse running detection method according to any one of claims 1 to 4, characterized in that:
determining whether the vehicles have reverse driving behaviors, including determining the probability of the reverse driving behaviors of a target vehicle in the vehicles, and determining whether the target vehicle has the reverse driving behaviors according to the probability of the reverse driving of the target vehicle.
6. The vehicle reverse running detection method according to claim 5, characterized in that:
the probability of determining that the target vehicle has reverse driving behavior is obtained by the following formula (I):
formula (I):
wherein P (R) is the probability that the lane line is the dotted line, P (D) is the probability that the target vehicle is in the reverse direction, and P (D)n') is the probability that the orientation of the nth vehicle except the target vehicle on the lane of the target vehicle is reverse; a is1Weighting factor for probability of lane line being broken line, a2A weighting factor that is the probability that the target vehicle orientation is reverse.
7. The vehicle reverse running detection method according to claim 2,
the method for acquiring the road information in the detection area in a mobile mode and generating the image while moving further comprises the following steps: and carrying out scene semantic segmentation on the road image in the detection area.
8. A vehicle reverse travel detection apparatus, characterized by comprising:
the data acquisition module is used for carrying out mobile acquisition on the road information and generating data while moving;
the first determining module is used for determining the probability that the lane is a forward lane based on the data of the road information;
the second determination module is used for determining the probability that the vehicle runs reversely based on the data of the road information;
and the third determination module is used for determining whether the vehicle has reverse driving behavior or not based on the probability that the lane is a forward lane and the probability that the vehicle runs in the reverse direction.
9. The vehicle reverse running detection apparatus according to claim 8,
the data acquisition module comprises:
a moving unit for moving on a road;
and the camera shooting unit is connected with the mobile unit and is used for acquiring images of vehicles and lane lines in the visual field.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which, when being executed by a processor, carries out the steps of the vehicle reverse running detection method according to any one of claims 1 to 7.
Background
With the rapid development of social economy, the continuous expansion of population and the acceleration of urbanization process in China, the quantity of motor vehicles owned in China is also rapidly increased, and consequently, more motor vehicle peccancy driving problems are caused.
Most of the existing vehicle retrograde motion detection methods are in a fixed scene, namely a camera head is arranged above a bayonet or a road, a shooting area is relatively fixed, and the action range is limited. Meanwhile, the existing method can only judge the retrograde motion of the current lane, but cannot identify the retrograde motion on the surrounding road.
The patent application with the application number of CN201811654238.0 provides a method, a device and a system for monitoring vehicle violation, wherein the method comprises the following steps: acquiring a current monitoring image; carrying out traffic identification on the current monitoring image to obtain the category of the traffic identification contained in the current monitoring image; carrying out vehicle identification on the current monitoring image to obtain the information of the vehicle contained in the current monitoring image; and judging whether the vehicle breaks rules or not according to the type of the traffic identification and the information of the vehicle.
The scheme adopts a non-yes judgment method, and the accuracy and the reliability of the judgment result cannot meet the requirements of the existing market.
The present invention has been made in view of this situation.
Disclosure of Invention
The technical problem to be solved by the invention is to overcome the defects of the prior art and provide a vehicle retrograde motion detection method, which can refer to more basic information to help judgment by obtaining various basic algorithm results related to retrograde motion, then establishing a retrograde motion judgment logic and judging whether the vehicle is retrograde motion, so that the detection method has higher robustness.
Another object of the present invention is to provide a vehicle reverse running detection apparatus.
It is another object of the present invention to provide a computer readable medium for implementing the vehicle reverse travel detection method described above.
In order to solve the technical problems, the invention adopts the technical scheme that:
a vehicle reverse running detection method comprises the following steps:
acquiring a road image in a detection area, and determining the probability that a lane in the detection area is a forward lane based on a neural network model;
acquiring images of a plurality of moving vehicles in a detection area, and determining reverse driving probabilities of the plurality of vehicles based on a neural network model;
and determining whether reverse driving behaviors exist in the plurality of vehicles according to the probability that the lane is a forward lane and the reverse driving probabilities of the plurality of vehicles.
Further, the method for acquiring the road image in the detection area and acquiring the images of a plurality of moving vehicles in the detection area comprises the following steps:
and carrying out mobile acquisition on road information in the detection area and generating an image while moving.
Further, the method for determining the lane in the detection area as the forward lane comprises the following steps:
determining that a lane where equipment for mobile acquisition is located is a forward lane;
and judging whether the lane line in the road image is a broken line, if so, determining that the lanes on two sides of the lane line are forward lanes.
Further, the method for determining the reverse driving probability of a plurality of vehicles comprises the following steps: obtaining a moving target map through a moving target detection algorithm, recording the moving target map as M, and recording surrounding frames of all target vehicles detected in the current frame as Cn, wherein n is 1, 2, 3 …;
thus, the moving vehicle On, M ☉ Cn,
wherein ☉ is a matting operation on the image of the bounding box;
and inputting the obtained moving vehicle image into a trained reverse running detection model to obtain the reverse running probability of the vehicle.
Further, determining whether the plurality of vehicles have reverse driving behaviors includes determining the probability that a target vehicle in the plurality of vehicles has the reverse driving behaviors, and determining whether the target vehicle has the reverse driving behaviors according to the probability that the target vehicle runs in the reverse direction.
Further, the probability of determining that the target vehicle has reverse driving behavior is obtained by the following formula (one):
formula (I):
wherein P (R) is the probability that the lane line is the dotted line, P (D) is the probability that the target vehicle is in the reverse direction, and P (D)n') is the probability that the orientation of the nth vehicle except the target vehicle on the lane of the target vehicle is reverse; a is1Weighting factor for probability of lane line being broken line, a2A weighting factor that is the probability that the target vehicle orientation is reverse.
Further, after the mobile acquisition of the road information in the detection area and the generation of the image while moving, the method further comprises the following steps: and carrying out scene semantic segmentation on the road image in the detection area.
A vehicle reverse travel detection apparatus comprising:
the data acquisition module is used for carrying out mobile acquisition on the road information and generating data while moving;
the first determining module is used for determining the probability that the lane is a forward lane based on the data of the road information;
the second determination module is used for determining the probability that the vehicle runs reversely based on the data of the road information;
and the third determination module is used for determining whether the vehicle has reverse driving behavior or not based on the probability that the lane is a forward lane and the probability that the vehicle runs in the reverse direction.
Further, the data acquisition module comprises:
a moving unit for moving on a road;
and the camera shooting unit is connected with the mobile unit and is used for acquiring images of vehicles and lane lines in the visual field.
A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the vehicle reverse running detection method as described above.
After the technical scheme is adopted, compared with the prior art, the invention has the following beneficial effects.
1. The invention is different from the traditional snapshot of the violation behaviors in the fixed scene, the judgment of the vehicle retrograde motion in the mobile camera scene is a difficult thing, and the proposal provided by the invention solves the problem to a certain extent.
2. The invention provides a method for identifying various basic information in a road scene and then solving the problem of detecting the vehicle driving against the regulations by establishing a scene heuristic model.
3. According to the invention, a scene model is constructed according to the results of various basic algorithms and is used for judging the reverse driving of the vehicle on the lane.
The following describes embodiments of the present invention in further detail with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention, are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention without limiting the invention to the right. It is obvious that the drawings in the following description are only some embodiments, and that for a person skilled in the art, other drawings can be derived from them without inventive effort. In the drawings:
FIG. 1 is a schematic flow chart of a vehicle reverse travel detection method of the present invention;
fig. 2 is a schematic diagram of the vehicle reverse running detection apparatus of the present invention.
It should be noted that the drawings and the description are not intended to limit the scope of the inventive concept in any way, but to illustrate it by a person skilled in the art with reference to specific embodiments.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and the following embodiments are used for illustrating the present invention and are not intended to limit the scope of the present invention.
In the description of the present invention, it should be noted that the terms "upper", "lower", "front", "rear", "left", "right", "vertical", "inner", "outer", etc., indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, and are only for convenience of description and simplicity of description, but do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; may be directly connected or indirectly connected through an intermediate. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
As shown in fig. 1 and 2, the present invention provides a vehicle reverse driving detection method, apparatus and computer readable medium.
As shown in fig. 1, the vehicle reverse driving detection method includes the following steps: acquiring a road image in a detection area, and determining the probability that a lane in the detection area is a forward lane based on a neural network model; acquiring images of a plurality of moving vehicles in a detection area, and determining reverse driving probabilities of the plurality of vehicles based on a neural network model; and determining whether reverse driving behaviors exist in the plurality of vehicles according to the probability that the lane is a forward lane and the reverse driving probabilities of the plurality of vehicles.
In detail, the real environment is complex and changeable, and the lane line detection algorithm, the vehicle position detection algorithm and the vehicle orientation detection algorithm are easily interfered by external factors such as weather, illumination, shielding and the like, so that the detection result of the algorithm is often deviated from the actual condition. The judgment of the reverse violation needs to use the comprehensive judgment of the results of the algorithms such as lane lines, vehicle directions and the like, and if one algorithm has a wrong result, the final judgment is directly influenced. Therefore, the retrograde motion detection method provided by the invention adds artificial confidence to alleviate the phenomenon on the basis of obtaining the result of each element for judging the retrograde motion of the vehicle.
In other words, the method is different from the prior art that the result is determined by directly adopting the algorithm judgment result when determining whether the vehicle has the reverse driving behavior, and determines the confidence coefficient of the result after obtaining the result of the lane line, correspondingly, determines the confidence coefficient of the result after obtaining the result that the vehicle is in the reverse direction, and determines that the vehicle has the reverse driving behavior based on the confidence coefficients of the two results, so that the detection method can refer to more basic information to help the judgment, and the detection result has higher robustness.
In an alternative embodiment of the present invention, the method for acquiring the road image in the detection area and acquiring the images of a plurality of moving vehicles in the detection area comprises: and carrying out mobile acquisition on road information in the detection area and generating an image while moving.
In detail, a moving camera is used to obtain a video image of a road, and the camera can be arranged in front of or behind a moving vehicle or a robot to provide a video stream for an algorithm.
Based on this, the method for determining the lane in the detection area as the forward lane comprises the following steps: determining that a lane where equipment for mobile acquisition is located is a forward lane; and judging whether the lane line in the road image is a broken line, if so, determining that the lanes on two sides of the lane line are forward lanes.
In detail, based on the video image of the road obtained by the mobile camera, a lane line detection algorithm SCNN is used to obtain a lane line result, and the lane line detection algorithm result is recorded as L, where L is a curve equation representing the lane line in an image coordinate system. Left is the type of the Left side line of the lane and Right is the type of the Right side line of the lane. Assuming that n lane lines can be detected from one frame image, a method of determining a driving direction of a lane according to an output result of the lane lines is as follows:
1. the method comprises the steps that the current lane of a vehicle where a mobile camera is located is a forward lane by default;
2. if the lane line on the left or right of the current lane is a dotted line, determining that the lanes on the left and right sides of the lane are also forward lanes;
3. and (3) if the left lane line or the right lane line of the forward lane determined in the step (2) is a dotted line, determining that the left lane or the right lane of the lane is also the forward lane.
Then the set of forward lanes R ═ { R1, R2, R3, … } may be defined. Where R1 is the own lane, Rn (n > ═ 2) can be expressed as:
rn ═ { Left (R) —, R Left lane or Right (R) —, R Right lane };
wherein R belongs to the set R.
Further, in an embodiment of the present invention, a method for determining a reverse driving probability of a plurality of vehicles includes: obtaining a moving target map through a moving target detection algorithm YoloV3, marking the moving target map as M, and marking the surrounding frames of all target vehicles detected in the current frame as Cn, wherein n is 1, 2, 3 …; thus, a moving vehicle On, M ☉ Cn can be obtained, wherein ☉ is a cutout operation of the surrounding frame On the image; and inputting the obtained moving vehicle image into a trained reverse running detection model AlexNet to obtain the reverse running probability of the vehicle.
The method comprises the steps of determining whether reverse driving behaviors exist in a plurality of vehicles, including determining the probability of the reverse driving behaviors existing in a target vehicle in the plurality of vehicles, and determining whether the target vehicle has the reverse driving behaviors according to the probability of the reverse driving of the target vehicle.
In detail, when the invention detects whether the vehicle has the reverse driving behavior, the conclusion of yes or no is not directly obtained, but the probability that the vehicle moving moves in the reverse direction is obtained to judge whether the vehicle is the vehicle violating the reverse driving regulations.
Specifically, after the moving vehicle set On and the forward lane set Rn are obtained, the direction of the moving vehicle in the forward lane is determined, and a vehicle whose direction is determined as the head of the vehicle, that is, a vehicle opposite to the head of the vehicle, is searched for. Suppose a vehicle traveling in the reverse direction is represented by set V.
Therefore, the invention also takes the running information of other vehicles in the scene as the judgment basis, not only knows the object itself, but also comprehensively judges the environment around the object after understanding, thereby further improving the judgment accuracy.
The probability of determining that the target vehicle has reverse driving behavior is obtained by the following formula (I):
formula (I):
wherein P (R) is the probability that the lane line is the dotted line, P (D) is the probability that the target vehicle is in the reverse direction, and P (D)n') is the probability that the orientation of the nth vehicle except the target vehicle on the lane of the target vehicle is reverse; a is1Weighting factor for probability of lane line being broken line, a2A weighting factor that is the probability that the target vehicle orientation is reverse.
In the above scheme, p (r) represents the confidence that the lane line is a dashed line, p (d) represents the confidence that the moving vehicle is oriented in the reverse direction, p (r) and p (d) derive the confidence from the algorithm SCNN and the algorithm Alexnet, respectively, a1Weighting factor representing the confidence of the dotted line, a2Confidence of retrograde movement of vehicle against regulationA weighting factor. The weighting coefficients can be values verified by experiments, and the weighting coefficients are set in advance according to actual conditions, wherein a1Take 0.5, a2Take 0.2.
P (Dn') represents the probability that the detected target vehicle is in the lane where another vehicle runs in the wrong direction. Therefore, the last term in the expression (one) represents the average probability of the reverse running of all other vehicles on the lane where the target vehicle is located, and if the probability is high, the current target vehicle is likely to be misjudged. This follows the concept of scene heuristics.
In some embodiments of the present invention, after the step of performing mobile acquisition of road information in the detection area and generating images while moving, the method further comprises the following steps: and carrying out scene semantic segmentation on the road image in the detection area. For example, a moving vehicle, a vehicle direction, a lane line type, and the like associated with the reverse travel determination element are segmented. The scheme can be carried out by adopting a scene semantic segmentation algorithm UNet.
As shown in fig. 2, the vehicle reverse travel detection device according to the present invention includes:
the data acquisition module is used for carrying out mobile acquisition on the road information and generating data while moving;
the first determining module is used for determining the probability that the lane is a forward lane based on the data of the road information;
the second determination module is used for determining the probability that the vehicle runs reversely based on the data of the road information;
and the third determination module is used for determining whether the vehicle has reverse driving behavior or not based on the probability that the lane is a forward lane and the probability that the vehicle runs in the reverse direction.
Further, the data acquisition module comprises:
a moving unit for moving on a road;
and the camera shooting unit is connected with the mobile unit and is used for acquiring images of vehicles and lane lines in the visual field.
In detail, the invention is different from the traditional snapshot of the violation behaviors in the fixed scene, the judgment of the vehicle retrograde motion in the mobile camera scene is a difficult thing, and the proposal provided by the invention solves the problem to a certain extent.
In addition, the behavior of vehicle retrograde motion is difficult to directly solve by a simple method based on a traditional algorithm or deep learning at present, and the invention provides a method for identifying various basic information in a road scene at first and then solving the problem of retrograde motion violation driving by establishing a scene heuristic model.
In addition, the invention constructs a scene model according to the results of various basic algorithms for judging the reverse running of the vehicles on the lane, and not only utilizes the self information of the target vehicle, but also utilizes the scene information around the vehicle.
Corresponding to the vehicle reverse driving detection method, the embodiment of the invention also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program is executed by a processor to execute the steps of the vehicle reverse driving detection method.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the vehicle reverse driving detection apparatus described above may refer to the corresponding process in the method embodiment, and is not described in detail herein. In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and there may be other divisions in actual implementation, and for example, a plurality of modules or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or modules through some communication interfaces, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.