Vehicle detection method and device, computer device and storage medium
By automatically reviewing vehicle violation images using deep learning theory, the problem of low efficiency in secondary review of vehicle violation images in existing technologies is solved, achieving efficient and accurate vehicle violation detection.
Patent Information
- Application Number
- CN202110129953.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-29
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2041-01-29
Smart Images

Figure CN112818847B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of vehicle detection, and in particular to a vehicle detection method and device, computer equipment and a storage medium. BACKGROUND
[0002] With the increase of the number of vehicles, the probability of traffic accidents on the road also increases. In the face of such a situation, it is necessary to require vehicles in motion to maintain a certain safety distance. For example, two vehicles in front of and behind each other on a highway need to maintain a certain safety distance; when a vehicle breaks down and needs to be moved to a safe area by a towing vehicle, the towing vehicle and the towed vehicle should maintain a certain safety distance during the movement.
[0003] With the application of security technology in the field of intelligent transportation, if the intelligent transportation system detects that the distance between vehicles is less than the safety distance, it will be judged as illegal behavior, and then trigger the camera to capture the vehicle illegal image. For the captured vehicle illegal image, secondary review is needed. In related technologies, the secondary review of the captured vehicle illegal image is usually performed by manual screening, which has the problem of low efficiency. SUMMARY
[0004] Therefore, it is necessary to provide a vehicle detection method, device, computer equipment and storage medium capable of improving the efficiency of secondary review of vehicle illegal images in view of the above technical problems.
[0005] In a first aspect, the embodiments of the present application provide a vehicle detection method, which comprises:
[0006] obtaining a to-be-detected image;
[0007] detecting the to-be-detected image, and if it is determined that there are multiple vehicles and an associated object in the to-be-detected image, locating two vehicles associated with the associated object from the multiple vehicles according to the associated object;
[0008] obtaining a first distance between the two vehicles according to position information of the two vehicles;
[0009] if the first distance is less than a first threshold, generating a detection result of vehicle illegal behavior.
[0010] In one of the embodiments, the detection of the to-be-detected image comprises:
[0011] performing target detection on the to-be-detected image, and if it is determined that there are multiple vehicles in the to-be-detected image, obtaining a vehicle region image corresponding to each vehicle;
[0012] locating a license plate region in each vehicle region image to obtain multiple license plate region images;
[0013] perform text recognition on each of the plurality of license plate region images to obtain a plurality of license plate information;
[0014] if there is license plate information identical to the standard license plate information in the plurality of license plate information, performing target detection on the to-be-detected image to determine that there is an associated object in the to-be-detected image.
[0015] In one of the embodiments, the associated object is a towing device; and the two vehicles associated with the associated object are located from the plurality of vehicles according to the associated object, including:
[0016] obtaining position information of a target vehicle corresponding to the standard license plate information, and position information of the towing device;
[0017] obtaining a second distance between the target vehicle and the towing device according to the position information of the target vehicle and the position information of the towing device;
[0018] if the second distance is less than a second threshold, regarding the target vehicle as a towing vehicle;
[0019] obtaining a third distance between other vehicles and the towing device according to position information of the other vehicles in the plurality of vehicles except the target vehicle and the position information of the towing device;
[0020] obtaining a third distance less than a third threshold, and regarding the vehicle corresponding to the third distance less than the third threshold as a towed vehicle.
[0021] In one of the embodiments, the towing device is a towing rope; the position information of the towing device includes position information of two end points of the towing rope; and the second distance between the target vehicle and the towing device is obtained according to the position information of the target vehicle and the position information of the towing device, including:
[0022] obtaining a second distance between the target vehicle and the two end points of the towing rope according to the position information of the target vehicle and the position information of the two end points of the towing rope;
[0023] if the second distance is less than a second threshold, regarding the target vehicle as a towing vehicle, including:
[0024] if the second distance between the target vehicle and one of the two end points of the towing rope is less than a second threshold, regarding the target vehicle as a towing vehicle.
[0025] In one of the embodiments, the third distance between the other vehicles and the towing device is obtained according to the position information of the other vehicles in the plurality of vehicles except the target vehicle and the position information of the towing device, including:
[0026] obtaining a third distance between the other vehicles and the other end point of the towing rope according to the position information of the other vehicles and the position information of the other end point of the towing rope.
[0027] In one embodiment, the method further includes:
[0028] obtaining an original image, the original image being a composite image obtained by stitching a plurality of illegal images, the plurality of illegal images being obtained by photographing a same illegal event;
[0029] identifying a boundary region in the original image;
[0030] cutting the original image according to the boundary region to obtain a plurality of to-be-detected images.
[0031] In one embodiment, the method further includes:
[0032] generating a detection result that the vehicle is legal when any one of the following conditions occurs:
[0033] the first distance is greater than or equal to the first threshold;
[0034] there is at most one vehicle in the to-be-detected image;
[0035] there is no associated object in the to-be-detected image;
[0036] it is determined that there are a plurality of vehicles and an associated object in the to-be-detected image, but at most one vehicle in the plurality of vehicles is associated with the associated object.
[0037] In a second aspect, an embodiment of the present application provides a vehicle detection device, the device comprising:
[0038] an obtaining module configured to obtain a to-be-detected image;
[0039] a detection module configured to detect the to-be-detected image to determine whether there are a plurality of vehicles and an associated object in the to-be-detected image;
[0040] an associated vehicle positioning module configured to, when it is determined that there are a plurality of vehicles and an associated object in the to-be-detected image, locate two vehicles associated with the associated object from the plurality of vehicles according to the associated object;
[0041] a first distance generating module configured to obtain a first distance of the two vehicles according to position information of the two vehicles;
[0042] a result generating module configured to generate a detection result that the vehicle is illegal when the first distance is less than a first threshold.
[0043] In a third aspect, an embodiment of the present application provides a computer device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the vehicle detection method of any one of the embodiments of the first aspect when executing the computer program.
[0044] In a fourth aspect, the embodiments of the present application provide a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the vehicle detection method in any of the embodiments of the first aspect.
[0045] The vehicle detection method, device, computer device and storage medium can detect the obtained to-be-detected image. If it is determined that there are multiple vehicles and an associated object in the to-be-detected image, two vehicles associated with the associated object are located from the multiple vehicles according to the associated object. A first distance of the two vehicles obtained according to position information of the two vehicles is obtained. If the first distance is less than a first threshold, a detection result of vehicle illegal operation is generated. The vehicle illegal operation image obtained is automatically audited based on the deep learning theory, which can improve the auditing efficiency of the vehicle illegal operation image and save labor cost. The two vehicles associated with the associated object are determined first, and then whether the vehicles are illegal is determined based on the distance between the two vehicles associated with the associated object, which can improve the accuracy of the auditing. BRIEF DESCRIPTION OF DRAWINGS
[0046] Figure 1 An application environment diagram of the vehicle detection method in an embodiment;
[0047] Figure 2 An application environment diagram of the vehicle detection method in another embodiment;
[0048] Figure 3 A flowchart of the vehicle detection method in an embodiment;
[0049] Figure 4 A flowchart of the step of detecting the to-be-detected image in an embodiment;
[0050] Figure 5 A flowchart of the step of determining the two vehicles associated with the towing device in an embodiment;
[0051] Figure 6 A flowchart of the vehicle detection method in an embodiment;
[0052] Figure 7 A block diagram of the vehicle detection device in an embodiment;
[0053] Figure 8 An internal structure diagram of the computer device in an embodiment. DETAILED DESCRIPTION
[0054] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and should not be used to limit the present application.
[0055] The vehicle detection method provided in the present application can be applied to the application environment as shown in Figure 1 The terminal 110 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices. The terminal 110 is deployed with one or more pre-trained deep learning models for detecting the to-be-detected image, and a judgment logic for judging whether the vehicle is illegal according to the output result of the deep learning model. Specifically, the terminal 110 acquires a detection request for detecting the to-be-detected image. The detection request can be triggered by a user, triggered by the terminal 110 when it detects that a preset condition is met, or sent by other electronic devices. The terminal 110 detects the to-be-detected image by using the pre-trained deep learning model, and determines whether there are multiple vehicles and associated objects in the to-be-detected image. If it is determined that there are multiple vehicles and associated objects in the to-be-detected image, two vehicles associated with the associated object are located from the multiple vehicles according to the associated object. The terminal 110 acquires a first distance between the two vehicles according to the position information of the two vehicles, and compares the first distance with a first threshold. If the first distance is less than the first threshold, a detection result that the vehicle is illegal is generated.
[0056] In another embodiment, the vehicle detection method provided in the present application can be applied to the application environment as shown in Figure 2 The terminal 210 communicates with the server 220 through a network. The terminal 210 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 220 can be implemented by an independent server or a server cluster composed of multiple servers. The server 220 is deployed with one or more pre-trained deep learning models for detecting the to-be-detected image, and a judgment logic for judging whether the vehicle is illegal according to the output result of the deep learning model. The server 220 acquires a detection request for detecting the to-be-detected image. The detection request can be triggered by the server 220 when it detects that a preset condition is met, or sent by the terminal 110. The server 220 detects the to-be-detected image by using the pre-trained deep learning model, and determines whether there are multiple vehicles and associated objects in the to-be-detected image. If it is determined that there are multiple vehicles and associated objects in the to-be-detected image, two vehicles associated with the associated object are located from the multiple vehicles according to the associated object. The server 220 acquires a first distance between the two vehicles according to the position information of the two vehicles, and compares the first distance with a first threshold. If the first distance is less than the first threshold, a detection result that the vehicle is illegal is generated. The server 220 can send the obtained detection result to the terminal 210, so that the terminal 210 can display the detection result of whether the vehicle is illegal on the screen.
[0057] In one embodiment, as shown in Figure 3 a vehicle detection method is provided, to which the method is applied Figure 1 for example to a terminal in
[0058] Step S310, obtaining a to-be-detected image.
[0059] The to-be-detected image refers to a vehicle illegal image to be detected for secondary review of whether the vehicle is illegal. The to-be-detected image can be obtained by an image acquisition device. The image acquisition device can be a camera, a video camera, etc. in an intelligent transportation system. The vehicle includes a motor vehicle, such as a car. Specifically, when the intelligent transportation system initially determines that the distance between two vehicles does not meet the requirements according to the collected image, the intelligent transportation system triggers the image acquisition device to collect the current vehicle illegal image and save it. The collected vehicle illegal image will be the to-be-detected image for secondary review.
[0060] Step S320, detecting the to-be-detected image to determine whether there are multiple vehicles and associated objects in the to-be-detected image.
[0061] The associated object refers to a reference object for determining whether the distance between vehicles meets the requirements. For example, if the distance between a towing vehicle and a towed vehicle needs to be determined, the associated object can be a towing device, such as a towing rope, etc. between the two vehicles; if the distance between two vehicles on a highway needs to be determined, the associated object can be a road marking line.
[0062] Specifically, after the terminal obtains the to-be-detected image, one or more pre-trained deep learning models can be used to detect the to-be-detected image. For example, a pre-trained object detection model can be used to detect the to-be-detected image. The terminal obtains the output result of the deep learning model. If it is determined according to the output result of the deep learning model that there are multiple vehicles and associated objects in the to-be-detected image, step S330 is performed.
[0063] Step S330, if it is determined that there are multiple vehicles and associated objects in the to-be-detected image, two vehicles associated with the associated object are located from the multiple vehicles according to the associated object.
[0064] The two vehicles associated with the associated object can be determined according to the illegal scene of the vehicle. For example, if the illegal scene of the vehicle is a towing vehicle driving scene, the two vehicles associated with the associated object can be the towing vehicle and the towed vehicle located at both ends of the towing device. If the illegal scene of the vehicle is a normal driving scene of vehicles on a highway, the two vehicles associated with the associated object can be vehicles located on the same side of the road marking line.
[0065] Specifically, the detection result output by the deep learning model includes the position information of the associated object and the position information of each vehicle. The terminal finds two vehicles associated with the associated object from the plurality of vehicles according to the position information of the associated object and the position information of each vehicle. If the two vehicles associated with the associated object are found, steps S340 and S350 are sequentially executed.
[0066] In step S340, a first distance between the two vehicles is obtained according to the position information of the two vehicles.
[0067] In step S350, if the first distance is less than a first threshold, a detection result of vehicle illegal is generated.
[0068] Specifically, the terminal obtains the position information of the two vehicles associated with the associated object. The first distance between the two vehicles is calculated according to the position information of the two vehicles. The obtained first distance is compared with the pre-configured first threshold. If the first distance is less than the first threshold, it is determined that the distance between the two vehicles associated with the associated object does not meet the requirements, and a detection result of vehicle illegal is generated.
[0069] In the above vehicle detection method, the obtained to-be-detected image is detected. If it is determined that there are a plurality of vehicles and an associated object in the to-be-detected image, two vehicles associated with the associated object are located from the plurality of vehicles according to the associated object. A first distance between the two vehicles is obtained according to the position information of the two vehicles. If the first distance is less than a first threshold, a detection result of vehicle illegal is generated. By automatically auditing the obtained vehicle illegal image based on the deep learning theory, the auditing efficiency of the vehicle illegal image can be improved, and the labor cost can be saved. By first determining the two vehicles associated with the associated object, and then judging whether the vehicle is illegal based on the distance between the two vehicles associated with the associated object, the accuracy of the audit can be improved.
[0070] In one embodiment, when the terminal is in the process of executing steps S310 to S350, if any of the following situations occurs, a detection result of vehicle legal is generated:
[0071] (1) There is at most one vehicle in the to-be-detected image. Specifically, since the terminal needs to detect whether the distance between two vehicles meets the requirements, if it is determined according to the output result of the deep learning model that there is at most one vehicle in the to-be-detected image, a detection result of vehicle legal can be generated.
[0072] (2) There is no associated object in the to-be-detected image. Specifically, when there is no associated object in the to-be-detected image, it means that the actual scene where the vehicle is located is different from the illegal scene to be detected, and a detection result of vehicle legal is generated.
[0073] (3) Determine that there are multiple vehicles and associated objects in the image to be detected, but at most one vehicle is associated with an associated object. For example, if the associated object is a towing device, and the terminal obtains that there is only one vehicle associated with the towing device, then it means that the actual scene where the vehicle is located is not the scene where the towing vehicle is driving, and a valid vehicle detection result is generated.
[0074] (4) The first distance is greater than or equal to the first threshold. If there are two vehicles among multiple vehicles that are associated with the associated object, but the first distance between the two vehicles is greater than or equal to the first threshold, then it means that the distance between the two vehicles meets the requirements, and a valid vehicle detection result is generated.
[0075] In this embodiment, by judging whether a vehicle violates the law based on multiple factors such as the number of vehicles in the image to be detected, the relationship between the vehicle and related objects, and the distance between vehicles, the terminal can better accommodate unknown scenarios while adhering to actual traffic rules during the automated secondary review process, thereby improving the usability of the vehicle detection method.
[0076] In one embodiment, such as Figure 4 As shown, step S320 involves detecting the image to be detected to determine whether multiple vehicles and associated objects exist in the image. This can be achieved through the following steps:
[0077] Step S321: Perform target detection on the image to be detected. If multiple vehicles are found in the image to be detected, obtain the vehicle region image corresponding to each vehicle.
[0078] Specifically, object detection in the image to be detected can be performed using a pre-trained first object detection model. This first object detection model can be any deep learning model suitable for object detection, such as RefineDet (a single-stage detector), Faster R-CNN (an object detection network), SSD (Single Shot Multibox Detector), and YOLO (You Only Look Once); or an improved model based on an existing model; or a self-designed model. After acquiring the image to be detected, it is input into the first object detection model. If the output of the first object detection model indicates the presence of multiple vehicle regions in the image, each vehicle region can be extracted and saved using methods such as cropping to obtain the corresponding vehicle region image.
[0079] Step S322: Locate the license plate region in each vehicle region image to obtain multiple license plate region images.
[0080] Specifically, the terminal inputs each obtained vehicle region image to a second target detection model. The second target detection model can be any deep learning model capable of target detection, such as RefineDet, Faster R-CNN, SSD, YOLO, or the like; or a model improved based on an existing model; or a self-designed model. The second target detection model detects whether a license plate region exists in each vehicle region image. If a license plate region exists in the vehicle region image, the license plate region in the vehicle region image can be extracted and saved by cropping or the like, to obtain a corresponding license plate region image.
[0081] Step S323, text recognition is performed on each license plate region image in the plurality of license plate region images, to obtain a plurality of license plate information.
[0082] Specifically, text recognition can be performed on each license plate region image based on a pre-trained text recognition model. The text recognition model can be any deep learning model capable of text recognition, such as a CNN (Convolutional Neural Networks), an LSTM (Long Short-Term Memory), or the like; or a model improved based on an existing model; or a self-designed model. The terminal inputs each obtained license plate region image to the text recognition model. Each license plate region image is recognized by the text recognition model, to obtain license plate information corresponding to each license plate region image.
[0083] Step S324, if the same license plate information as the standard license plate information exists in the plurality of license plate information, target detection is performed on the to-be-detected image, to determine that the associated object exists in the to-be-detected image.
[0084] The standard license plate information can refer to license plate information of a vehicle that is initially determined to be illegal. When the intelligent transportation system determines that the distance between two vehicles in motion does not meet the requirements, a vehicle illegal image is obtained. The standard license plate information of the illegal vehicle is obtained by recognizing the vehicle illegal image. The intelligent transportation system establishes a correspondence between the vehicle illegal image and the standard license plate information. When the vehicle illegal image is audited for the second time, the corresponding standard license plate information is obtained.
[0085] Specifically, the terminal compares each license plate information output by the text recognition model with the standard license plate information. If there is license plate information identical to the standard license plate information, it indicates that there is a target vehicle in the to-be-detected image that needs to be audited again for illegality. Further detection is continued on the to-be-detected image to determine whether there is an associated object in the to-be-detected image. Further, if the terminal determines that all the license plate information output by the text recognition model is different from the standard license plate information, it indicates that there is no target vehicle in the to-be-detected image that needs to be audited again for illegality, and a detection result of legal vehicle is generated.
[0086] In this embodiment, whether there is a target vehicle in the to-be-detected image is determined according to the comparison result of all the license plate information and the standard license plate information. In the case where there is no target vehicle, a detection result of legal target vehicle is generated and the secondary audit process is directly ended, so that the efficiency of secondary audit can be improved.
[0087] In one embodiment, the associated object is a towing device. Figure 5 As shown, in step S330, if it is determined that there are multiple vehicles and an associated object in the to-be-detected image, two vehicles associated with the associated object are located from the multiple vehicles according to the associated object, which can be achieved by the following steps:
[0088] In step S331, the position information of the target vehicle corresponding to the standard license plate information and the position information of the towing device are obtained.
[0089] In step S332, the second distance between the target vehicle and the towing device is obtained according to the position information of the target vehicle and the position information of the towing device.
[0090] In step S333, if the second distance is less than a second threshold, the target vehicle is taken as a towing vehicle.
[0091] The target vehicle refers to a vehicle to be audited again for illegality. Specifically, the terminal obtains the position information of the target vehicle and the position information of the towing device output by the deep learning model. The position information of the target vehicle can be the position information of a rectangular region where the target vehicle is located, and the position information of the towing device can be the position information of a rectangular region where the towing device is located. The terminal obtains the position information of a preset point from the position information of the target vehicle and the position information of the towing device. The preset point can be a preset end point or a center point of the rectangular region. The second distance between the target vehicle and the towing device is calculated according to the position information of the preset point of the target vehicle and the position information of the preset point of the towing device. The obtained second distance is compared with a second threshold. If the second distance is less than the second threshold, it indicates that the target vehicle is a vehicle associated with the towing device, and the target vehicle can be taken as a towing vehicle.
[0092] In step S334, a third distance between the other vehicles and the towing device is obtained according to the position information of the other vehicles and the position information of the towing device.
[0093] In step S335, the third distance less than the third threshold value is obtained, and the vehicle corresponding to the third distance less than the third threshold value is taken as the towed vehicle.
[0094] Specifically, since there are multiple vehicles in the image to be detected, after determining that the target vehicle is associated with the towing device, the terminal continues to calculate a third distance between each of the other vehicles and the towing device. The manner of calculating the third distance can refer to the calculation process of the second distance, which is not specifically described here. The terminal compares each obtained third distance with a third threshold value. If there is a third distance less than the third threshold value, it indicates that the vehicle corresponding to the third distance less than the third threshold value is another vehicle associated with the towing device, and the vehicle can be taken as the towed vehicle. The second threshold value and the third threshold value can be the same value.
[0095] In this embodiment, by determining whether the vehicle is associated with the towing device according to the distance between the vehicle and the towing device, the positioning result of the towing vehicle and the towed vehicle can be accurately obtained, thereby improving the accuracy of vehicle detection.
[0096] In one embodiment, the towing device is a towing rope, and the position information of the towing device includes position information of two end points of the towing rope. In step S332, the second distance between the target vehicle and the towing device is obtained according to the position information of the target vehicle and the position information of the towing device, including: obtaining the second distance between the target vehicle and the two end points of the towing rope according to the position information of the target vehicle and the position information of the two end points of the towing rope. In step S333, if the second distance is less than the second threshold value, the target vehicle is taken as the towing vehicle, including: if the second distance between the target vehicle and one of the two end points of the towing rope is less than the second threshold value, the target vehicle is taken as the towing vehicle.
[0097] Specifically, when the towing device is a towing rope, the result output by the deep learning model includes the position information of the two end points of the towing rope. The terminal calculates the second distance between the target vehicle and the two end points according to the position information of the two end points of the towing rope and the position information of the target vehicle. Then, each second distance is compared with the second threshold value. If the second distance between the target vehicle and one of the two end points is less than the second threshold value, the target vehicle is taken as the towing vehicle. Further, if the second distances between the target vehicle and the two end points are both less than the second threshold value, or the second distances between the target vehicle and the two end points are both greater than or equal to the second threshold value, it indicates that the target vehicle does not tow other vehicles, and a legal detection result of the vehicle can be generated.
[0098] In the embodiment, when the traction device is a traction rope, the distance between the two end points of the traction rope and the target vehicle is calculated, so that whether the target vehicle is a towing vehicle can be accurately determined, and the accuracy of vehicle detection can be improved.
[0099] In one embodiment, in step S334, the third distance between the other vehicles and the traction device is obtained according to the position information of the other vehicles and the position information of the traction device, and the third distance between the other vehicles and the other end point of the traction device is obtained according to the position information of the other vehicles and the position information of the other end point of the traction device.
[0100] Specifically, when the traction device is a traction rope and the second distance between the target vehicle and one end point of the traction rope is less than the second threshold, the terminal obtains the position information of the other end point. The other end point refers to the end point with a distance greater than or equal to the second threshold from the target vehicle. The third distance between the other end point and each of the other vehicles is calculated, and the obtained third distance is compared with the third threshold. If there is a third distance less than the third threshold, the vehicle corresponding to the third distance is regarded as a towed vehicle; if there is no third distance less than the third threshold, it means that there is no vehicle towed by the target vehicle among the other vehicles, and a legal vehicle detection result can be generated.
[0101] In the embodiment, when the traction device is a traction rope, the distance between the end point of the traction rope and each of the other vehicles is calculated, so that the towed vehicle can be accurately selected from the other vehicles, and the accuracy of vehicle detection can be improved.
[0102] In one embodiment, in step S310, the image to be detected is obtained, including: obtaining an original image, the original image being a synthesized image obtained by splicing a plurality of illegal images, the plurality of illegal images being obtained by photographing the same illegal event; identifying a boundary region in the original image; and cutting the original image according to the boundary region to obtain a plurality of images to be detected.
[0103] Specifically, for the same illegal event, the intelligent transportation system usually collects multiple vehicle illegal images. If the target vehicle illegal is initially audited according to the multiple illegal images, the intelligent transportation system can splice the multiple vehicle illegal images to obtain a composite image. When the vehicle illegal situation is secondarily audited, if the terminal detects that the obtained image is a composite image, the terminal can traverse the composite image using a rectangular frame to obtain an ROI (region of interest) image. The ROI image is input into a pre-trained classification model to predict whether the ROI image is a boundary region. The classification model can be a binary classification model. After obtaining the boundary region of the composite image, the terminal cuts the composite image according to the obtained boundary region to obtain multiple to-be-detected images. Then, the vehicle detection method described in any one of the above embodiments is used to detect each to-be-detected image. If the detection result of any to-be-detected image is vehicle illegal, a detection result of vehicle illegal can be generated.
[0104] In this embodiment, the boundary region of the composite image is obtained based on the deep learning theory, and multiple to-be-detected images are obtained by cutting based on the boundary region, which can improve the automation of vehicle detection and thus improve the efficiency of vehicle detection.
[0105] In one embodiment, as shown in Figure 6 a vehicle detection method is provided. In this embodiment, the associated object is a tow rope. Taking the case where the method is applied to a terminal as an example, the method includes the following steps:
[0106] In step S601, an original image is obtained, which is a composite image obtained by splicing multiple vehicle illegal images, and the multiple vehicle illegal images are obtained by photographing the same illegal event.
[0107] In step S602, a pre-trained classification model is used to identify a boundary region in the original image.
[0108] Specifically, a rectangular frame is used to traverse the original image to obtain an ROI image. The ROI image is input into a pre-trained classification model to predict whether the ROI image is a boundary region. The classification model can be a binary classification model.
[0109] In step S603, the original image is cut according to the boundary region to obtain multiple to-be-detected images.
[0110] In step S604, for each image to be detected, the first target detection model is used to detect the image to be detected to determine whether multiple vehicles exist in the image to be detected. If multiple vehicles exist, the vehicle region image of each vehicle is obtained, and step S605 is performed continuously. If at most one vehicle exists, step S616 is performed to generate a legal vehicle detection result. The first target detection model can use YOLO V4 (YOLO version 4). The basic network of YOLO V4 uses GhostNet (a kind of lightweight neural network), so that the detection speed of the first target detection model can be accelerated.
[0111] In step S605, the second target detection model is used to locate the license plate region in each vehicle region image.
[0112] The second target detection model can use SSD. The basic network of SSD uses ShuffleNet_V2 (a kind of lightweight neural network, version 2), so that the detection speed of the second target detection model can be accelerated.
[0113] In step S606, the text recognition model is used to perform text recognition on each license plate region image in the multiple license plate region images to obtain multiple license plate information. The text recognition model can use an LSTM model.
[0114] In step S607, if the same license plate information as the standard license plate information exists in the multiple license plate information, the vehicle corresponding to the standard license plate information is taken as a target vehicle, and step S608 is performed continuously. Otherwise, step S616 is performed to generate a legal vehicle detection result.
[0115] In step S608, target detection is performed on the image to be detected to determine whether a towrope exists in the image to be detected. If a towrope exists, step S609 is performed continuously. Otherwise, step S616 is performed to generate a legal vehicle detection result. In step S608, the first target detection model or the second target detection model can be used for target detection on the image to be detected, or a separately trained target detection model can be used.
[0116] In step S609, the second distance between the target vehicle and the two end points of the towrope is obtained according to the position information of the target vehicle and the position information of the two end points of the towrope.
[0117] In step S610, if the second distance between the target vehicle and one of the end points of the towrope is less than a second threshold, the target vehicle is taken as a towing vehicle, and step S611 is performed continuously. Otherwise, step S616 is performed to generate a legal vehicle detection result.
[0118] Step S611: Based on the location information of other vehicles and the location information of the other end of the traction rope, obtain the third distance between the other vehicles and the other end of the traction rope.
[0119] In step S612, if there is a third distance less than the third threshold, then the vehicle corresponding to the third distance less than the third threshold is taken as the towed vehicle, and step S613 is continued; otherwise, step S616 is executed to generate a valid vehicle detection result.
[0120] Step S613: Obtain the first distance between the two vehicles based on the position information of the towing vehicle and the towed vehicle.
[0121] Step S614: Compare the first distance with the first threshold. If the first distance is less than the first threshold, proceed to step S615 to generate a detection result of vehicle violation; otherwise, proceed to step S616 to generate a detection result of vehicle compliance.
[0122] Step S615: Generate the detection results of vehicle violations.
[0123] Step S616: Generate a valid vehicle detection result.
[0124] It should be understood that although the steps in the flowchart above are shown sequentially as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps.
[0125] In one embodiment, such as Figure 7 As shown, a vehicle detection device 700 is provided, including: an acquisition module 701, a detection module 702, an associated vehicle positioning module 703, a distance generation module 704, and a result generation module 705, wherein:
[0126] The acquisition module 701 is configured to acquire a to-be-detected image; the detection module 702 is configured to detect the to-be-detected image to determine whether a plurality of vehicles and an associated object exist in the to-be-detected image; the associated vehicle positioning module 703 is configured to, when it is determined that the plurality of vehicles and the associated object exist in the to-be-detected image, locate two vehicles associated with the associated object from the plurality of vehicles according to the associated object; the distance generation module 704 is configured to acquire a first distance between the two vehicles according to position information of the two vehicles; and the result generation module 705 is configured to generate a detection result of vehicle illegal behavior when the first distance is less than a first threshold.
[0127] In one embodiment, the detection module 702 includes: a first target detection unit configured to perform target detection on the to-be-detected image, and acquire a vehicle region image corresponding to each vehicle if it is determined that a plurality of vehicles exist in the to-be-detected image; a license plate region detection unit configured to locate a license plate region in each vehicle region image to obtain a plurality of license plate region images; a text recognition unit configured to perform text recognition on each license plate region image in the plurality of license plate region images to obtain a plurality of license plate information; and a second target detection unit configured to, when the same license plate information as standard license plate information exists in the plurality of license plate information, perform target detection on the to-be-detected image to determine that the associated object exists in the to-be-detected image.
[0128] In one embodiment, the associated object is a towing device; and the associated vehicle positioning module 703 includes: a first acquisition unit configured to acquire position information of a target vehicle corresponding to the standard license plate information and position information of the towing device; a second distance generation unit configured to obtain a second distance between the target vehicle and the towing device according to the position information of the target vehicle and the position information of the towing device; a first comparison unit configured to compare the second distance with a second threshold value, and if the second distance is less than the second threshold value, the target vehicle is taken as a towing vehicle; a third distance generation unit configured to obtain a third distance between other vehicles except the target vehicle in the plurality of vehicles and the towing device according to the position information of the other vehicles and the position information of the towing device; and a second comparison unit configured to compare the third distance with a third threshold value, acquire the third distance less than the third threshold value, and take the vehicle corresponding to the third distance less than the third threshold value as a towed vehicle.
[0129] In one embodiment, the towing device is a towing rope; the position information of the towing device includes position information of two end points of the towing rope; the second distance generation unit is configured to obtain a second distance between the target vehicle and the two end points of the towing rope according to the position information of the target vehicle and the position information of the two end points of the towing rope; and the first comparison unit is configured to compare the second distance between the target vehicle and one of the two end points of the towing rope with the second threshold value, and if the second distance between the target vehicle and one of the two end points of the towing rope is less than the second threshold value, the target vehicle is taken as the towing vehicle.
[0130] In one embodiment, a third distance generating unit is configured to obtain a third distance between the other vehicle and the other end of the tow rope according to the position information of the other vehicle and the position information of the other end of the tow rope.
[0131] In one embodiment, the acquisition module 701 comprises: a second acquisition unit configured to acquire an original image, the original image being a composite image obtained by splicing a plurality of illegal images, the plurality of illegal images being obtained by photographing the same illegal event; a boundary identifying unit configured to identify a boundary region in the original image; and a clipping unit configured to clip the original image according to the boundary region to obtain a plurality of to-be-detected images.
[0132] In one embodiment, when any one of the following conditions occurs, a detection result of vehicle legality is generated: the first distance is greater than or equal to the first threshold; there is at most one vehicle in the to-be-detected image; there is no associated object in the to-be-detected image; it is determined that there are a plurality of vehicles and an associated object in the to-be-detected image, but at most one vehicle in the plurality of vehicles is associated with the associated object.
[0133] The specific limitations of the vehicle detection apparatus can refer to the limitations of the vehicle detection method in the foregoing, which will not be described herein. Each module in the vehicle detection apparatus described above can be realized by software, hardware, and combinations thereof, in whole or in part. Each module described above can be embedded in or independent of a processor in a computer device in hardware form, or can be stored in a memory in a computer device in software form, so as to be called and executed by a processor to perform the operations corresponding to each module.
[0134] In one embodiment, a computer device is provided, which can be a terminal, and an internal structure diagram thereof can be as shown in Figure 7 The computer device comprises a processor, a memory, a communication interface, a display screen, and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The communication interface of the computer device is configured to perform wired or wireless communication with an external terminal. The wireless communication can be achieved through WIFI, a carrier network, NFC (near field communication), or other technologies. The computer program is executed by the processor to implement a vehicle detection method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or can be a key, trackball, or touchpad arranged on the shell of the computer device. In addition, an external keyboard, touchpad, or mouse can also be used.
[0135] Those skilled in the art can understand that Figure 7 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0136] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program:
[0137] An image to be detected is acquired; the image to be detected is detected, and if it is determined that there are multiple vehicles and an associated object in the image to be detected, two vehicles associated with the associated object are located from the multiple vehicles according to the associated object; a first distance of the two vehicles obtained according to position information of the two vehicles is acquired; and if the first distance is less than a first threshold, a detection result of vehicle illegal is generated.
[0138] In one embodiment, the processor implements the following steps when executing the computer program:
[0139] Target detection is performed on the image to be detected, and if it is determined that there are multiple vehicles in the image to be detected, a vehicle region image corresponding to each vehicle is acquired; a license plate region in each vehicle region image is located to obtain multiple license plate region images; text recognition is performed on each license plate region image in the multiple license plate region images to obtain multiple license plate information; and if there is license plate information identical to standard license plate information in the multiple license plate information, target detection is performed on the image to be detected to determine that there is an associated object in the image to be detected.
[0140] In one embodiment, the associated object is a towing device; and the processor implements the following steps when executing the computer program:
[0141] Position information of a target vehicle corresponding to the standard license plate information and position information of the towing device are acquired; a second distance of the target vehicle and the towing device is obtained according to the position information of the target vehicle and the position information of the towing device; if the second distance is less than a second threshold, the target vehicle is taken as a towing vehicle; a third distance of other vehicles except the target vehicle in the multiple vehicles and the towing device is obtained according to position information of the other vehicles and the position information of the towing device; and a vehicle corresponding to the third distance less than a third threshold is taken as a towed vehicle.
[0142] In one embodiment, the towing device is a towing rope; the position information of the towing device includes position information of two end points of the towing rope; and the processor implements the following steps when executing the computer program:
[0143] According to the position information of the target vehicle and the position information of the two end points of the tow rope, a second distance between the target vehicle and the two end points of the tow rope is obtained; and if the second distance between the target vehicle and one of the two end points of the tow rope is less than a second threshold, the target vehicle is taken as the towing vehicle.
[0144] In one embodiment, the processor implements the following steps when executing the computer program:
[0145] According to the position information of the other vehicle and the position information of the other end point of the tow rope, a third distance between the other vehicle and the other end point of the tow rope is obtained.
[0146] In one embodiment, the processor implements the following steps when executing the computer program:
[0147] An original image is obtained, the original image being a composite image obtained by splicing a plurality of illegal images, the plurality of illegal images being obtained by photographing the same illegal event; a boundary region in the original image is identified; and the original image is cut according to the boundary region to obtain a plurality of to-be-detected images.
[0148] In one embodiment, the processor implements the following steps when executing the computer program:
[0149] When any one of the following conditions occurs, a detection result of vehicle legality is generated: the first distance is greater than or equal to the first threshold; there is at most one vehicle in the to-be-detected image; there is no associated object in the to-be-detected image; it is determined that there are a plurality of vehicles and an associated object in the to-be-detected image, but there is at most one vehicle associated with the associated object in the plurality of vehicles.
[0150] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following steps:
[0151] A to-be-detected image is obtained; the to-be-detected image is detected, and if it is determined that there are a plurality of vehicles and an associated object in the to-be-detected image, two vehicles associated with the associated object are located from the plurality of vehicles according to the associated object; a first distance between the two vehicles obtained according to the position information of the two vehicles is obtained; and if the first distance is less than a first threshold, a detection result of vehicle illegality is generated.
[0152] In one embodiment, the computer program is executed by a processor to implement the following steps:
[0153] The target detection is performed on the to-be-detected image. If multiple vehicles exist in the to-be-detected image, a vehicle region image corresponding to each vehicle is obtained. A license plate region in each vehicle region image is located to obtain multiple license plate region images. Text recognition is performed on each license plate region image in the multiple license plate region images to obtain multiple license plate information. If the same license plate information as the standard license plate information exists in the multiple license plate information, the target detection is performed on the to-be-detected image to determine that the associated object exists in the to-be-detected image.
[0154] In one embodiment, the associated object is a towing device; and the computer program is executed by the processor to implement the following steps:
[0155] The position information of a target vehicle corresponding to the standard license plate information and the position information of the towing device are obtained. The second distance between the target vehicle and the towing device is obtained according to the position information of the target vehicle and the position information of the towing device. If the second distance is less than a second threshold, the target vehicle is determined as a towing vehicle. The third distance between other vehicles in the multiple vehicles and the towing device is obtained according to the position information of the other vehicles and the position information of the towing device. The vehicle corresponding to the third distance less than a third threshold is determined as a towed vehicle.
[0156] In one embodiment, the towing device is a towing rope; and the position information of the towing device includes the position information of two end points of the towing rope. The computer program is executed by the processor to implement the following steps:
[0157] The second distance between the target vehicle and the two end points of the towing rope is obtained according to the position information of the target vehicle and the position information of the two end points of the towing rope. If the second distance between the target vehicle and one of the two end points of the towing rope is less than a second threshold, the target vehicle is determined as a towing vehicle.
[0158] In one embodiment, the computer program is executed by the processor to implement the following steps:
[0159] The third distance between the other vehicles and the other end point of the towing rope is obtained according to the position information of the other vehicles and the position information of the other end point of the towing rope.
[0160] In one embodiment, the computer program is executed by the processor to implement the following steps:
[0161] An original image is obtained. The original image is a synthesized image obtained by splicing multiple illegal images. The multiple illegal images are obtained by photographing the same illegal event. A boundary region in the original image is identified. The original image is cut according to the boundary region to obtain multiple to-be-detected images.
[0162] In one embodiment, the computer program is executed by the processor to implement the following steps:
[0163] When any one of the following occurs, a vehicle legal detection result is generated: the first distance is greater than or equal to the first threshold; there is at most one vehicle in the to-be-detected image; there is no associated object in the to-be-detected image; it is determined that there are multiple vehicles and associated objects in the to-be-detected image, but there is at most one vehicle associated with the associated object in the multiple vehicles.
[0164] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, the processes of the above-mentioned embodiments of the methods can be included. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0165] Any combination of the technical features of the above embodiments can be made. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.
[0166] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are all within the scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A vehicle inspection method, characterized in that, The method includes: Acquire the image to be detected; The image to be detected is then inspected. If it is determined that multiple vehicles and associated objects exist in the image to be detected, then... Based on the associated object, two vehicles associated with the associated object are located from among the plurality of vehicles; wherein, when the associated object is a towing device, a second distance between the target vehicle and the towing device is calculated based on the position information of the target vehicle and the towing device; if the second distance is less than a second threshold, the target vehicle is designated as the towing vehicle; based on the position information of the other vehicles among the plurality of vehicles besides the target vehicle and the towing device, a third distance between the other vehicles and the towing device is obtained, and the vehicle corresponding to the third distance less than the third threshold is designated as the towing vehicle; Obtain the first distance between the two vehicles based on their location information; If the first distance is less than the first threshold, a detection result for vehicle violation is generated.
2. The method according to claim 1, characterized in that, The detection of the image to be detected includes: Target detection is performed on the image to be detected. If it is found that there are multiple vehicles in the image to be detected, the vehicle region image corresponding to each vehicle is obtained. Locate the license plate region in each vehicle region image to obtain multiple license plate region images; Text recognition is performed on each of the multiple license plate area images to obtain multiple license plate information; If any of the multiple license plate information contains a license plate that is identical to the standard license plate information, then target detection is performed on the image to be detected to determine that the associated object exists in the image to be detected.
3. The method according to claim 2, characterized in that, The standard license plate information includes the license plate information of vehicles initially identified as violating the law. If there is a license plate information that is the same as the standard license plate information among the multiple license plate information, then target detection is performed on the image to be detected. This includes: when performing a second review of the vehicle violation image, obtaining the corresponding standard license plate information; if there is a license plate information that is the same as the standard license plate information among the multiple license plate information, then target detection is performed on the image to be detected.
4. The method according to claim 1, characterized in that, The traction device is a traction rope; the position information of the traction device includes the position information of the two ends of the traction rope. The step of obtaining the second distance between the target vehicle and the traction device based on the location information of the target vehicle and the location information of the traction device includes: Based on the location information of the target vehicle and the location information of the two ends of the traction rope, a second distance between the target vehicle and the two ends of the traction rope is obtained; If the second distance is less than the second threshold, then the target vehicle is used as the towing vehicle, including: If the second distance between the target vehicle and one of the endpoints of the towing rope is less than the second threshold, then the target vehicle is designated as the towing vehicle.
5. The method according to claim 4, characterized in that, The step of obtaining the third distance between the other vehicles and the traction device based on the position information of the other vehicles (excluding the target vehicle) and the position information of the traction device includes: Based on the location information of the other vehicles and the location information of the other end of the traction rope, a third distance between the other vehicles and the other end of the traction rope is obtained.
6. The method according to any one of claims 1 to 5, characterized in that, The acquisition of the image to be detected includes: Acquire the original image, which is a composite image obtained by stitching together multiple illegal images, which are taken of the same illegal event; Identify the boundary regions in the original image; The original image is cropped based on the boundary region to obtain multiple images to be detected.
7. The method according to any one of claims 1 to 5, characterized in that, The method further includes: A valid vehicle detection result is generated when any of the following conditions are met: The first distance is greater than or equal to the first threshold; The image to be detected contains at most one vehicle; The associated object does not exist in the image to be detected; It is determined that the multiple vehicles and the associated object exist in the image to be detected, but at most one of the multiple vehicles is associated with the associated object.
8. A vehicle detection device, characterized in that, The device includes: The acquisition module is used to acquire the image to be detected; The detection module is used to detect the image to be detected and determine whether there are multiple vehicles and related objects in the image to be detected; The associated vehicle positioning module is used to locate two vehicles associated with the associated object from among the multiple vehicles when it is determined that the multiple vehicles and the associated object exist in the image to be detected; it is also used to calculate a second distance between the target vehicle and the towing device based on the position information of the target vehicle and the towing device when the associated object is a towing device; if the second distance is less than a second threshold, the target vehicle is designated as the towing vehicle; and to obtain a third distance between other vehicles and the towing device based on the position information of the other vehicles among the multiple vehicles excluding the target vehicle and the towing device, and designate the vehicles corresponding to the third distance less than the third threshold as the towing vehicles. The first distance generation module is used to obtain the first distance between the two vehicles based on their location information. The result generation module is used to generate a detection result of vehicle violation when the first distance is less than a first threshold.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Vehicle following distance automatic recording system and method
CN105427619A
Automatic processing method and device of vehicle violation, computer equipment and storage medium
CN110415529A
Vehicle illegal driving detection method and device, computer equipment and storage medium
CN111539317A
Illegal vehicle detection method and device, computer equipment and storage medium
CN111652137A