A vehicle detection method, terminal and computer-readable storage medium

By detecting license plates and headlights on the image to be processed, and matching license plate areas based on the headlight area, the difficulty in detecting license plates caused by unclear vehicle profiles in night scenes is solved, and the accuracy of detection of vehicle headlights and license plates is improved.

CN114004965BActive Publication Date: 2025-05-27ZHEJIANG DAHUA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111166005.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2025-05-27
Estimated Expiration
2041-09-30

AI Technical Summary

Technical Problem

In the prior art, due to the unclear vehicle profile in the night scene, it is difficult to detect license plates.

Method used

By performing license plate detection and headlight detection on the image to be processed, the detection license plate area set and the detection light area set are obtained. Each headlight area pair is obtained based on the detection light area set, and the detection license plate area matching the pairs of each headlight area are determined from the detection license plate area set, and these areas are finally determined as vehicle detection results.

Benefits of technology

The vehicle's license plate can be detected without detecting the outline of the vehicle, reducing false alarms of license plates and headlights, and improving the accuracy of detection of vehicle headlights and license plates.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114004965B_ABST
    Figure CN114004965B_ABST
Patent Text Reader

Abstract

The present invention provides a vehicle detection method, a terminal and a computer-readable storage medium. The vehicle detection method includes performing license plate detection and headlight detection on a to-be-processed image to obtain a set of detected license plate regions and a set of detected headlight regions; based on the set of detected headlight regions, obtaining each pair of headlight regions; wherein, a pair of headlight regions includes different detected headlight regions belonging to the same vehicle in the set of detected headlight regions; determining the detected license plate regions matched by each pair of headlight regions from the set of detected license plate regions; and determining the detected headlight regions included in each pair of headlight regions and the determined detected license plate regions as the vehicle detection result of the to-be-processed image. In this application, first, the pairs of headlight regions are screened out from the set of detected headlight regions, and then the detected license plate regions corresponding to each pair of headlight regions are screened out from the set of detected license plate regions, reducing false alarms of license plates and headlights and improving the detection accuracy of vehicle headlights and license plates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and particularly to a vehicle detection method, a terminal and a computer-readable storage medium. Background Art

[0002] License plate location technology is a prerequisite for license plate recognition. The currently commonly used license plate location technology solution is through deep learning methods, generally divided into two steps. First, the vehicle detection network is used to detect the vehicle position, and then the vehicle detection position result is input into the license plate detection network for license plate position location. When this method is used in some special scenarios, such as night scenes, the vehicle contour is unclear, and the vehicle cannot be correctly detected, thus affecting the license plate detection. Summary of the Invention

[0003] The main technical problem to be solved by the present invention is to provide a vehicle detection method, a terminal and a computer-readable storage medium, so as to solve the problem of difficult license plate detection caused by unclear vehicle contours in night scenes in the prior art.

[0004] To solve the above technical problem, the first technical solution adopted by the present invention is: to provide a vehicle detection method, the method includes: performing license plate detection and headlight detection on the image to be processed to obtain a detected license plate area set and a detected headlight area set; based on the detected headlight area set, obtaining each pair of headlight areas; where, one pair of headlight areas includes different detected headlight areas in the detected headlight area set that belong to the same vehicle; determining the detected license plate area matched by each pair of headlight areas from the detected license plate area set; determining the detected headlight areas included in each pair of headlight areas and the determined detected license plate area as the vehicle detection result of the image to be processed.

[0005] Among them, determining the detected license plate area matched by each pair of headlight areas from the detected license plate area set further includes: if it is determined that there is a target pair of headlight areas in each pair of headlight areas, then performing license plate detection on the image area corresponding to the target pair of headlight areas in the image to be processed to obtain the license plate detection area matched by the target pair of headlight areas; where, the target pair of headlight areas is a pair of headlight areas in the detected license plate area set for which there is no matched detected license plate area.

[0006] Among them, license plate detection and headlight detection are performed on the image to be processed to obtain a set of detected license plate regions and a set of detected headlight regions, including: based on the object detection model, performing the license plate detection on the image to be processed, detecting each detected license plate region included in the image to be processed, and clustering the detected license plate regions to obtain the detected license plate regions; and based on the object detection model, performing the headlight detection on the image to be processed, detecting each detected headlight region included in the image to be processed, and clustering the detected headlight regions to obtain the detected headlight regions.

[0007] Among them, license plate detection and headlight detection are performed on the image to be processed to obtain a set of detected license plate regions and a set of detected headlight regions, and further include: determining the center coordinates of each detected headlight region and the center coordinates of each detected license plate region; arranging the center coordinates corresponding to all the detected license plate regions included in the set of detected license plate regions according to a first rule; arranging the center coordinates corresponding to all the detected headlight regions included in the set of detected headlight regions according to a second rule.

[0008] Among them, based on the set of detected headlight regions, various headlight region pairs are obtained, including: selecting one detected headlight region from the set of detected headlight regions, and matching the selected detected headlight region with other detected headlight regions included in the set of detected headlight regions; respectively determining whether the relationship between the selected detected headlight region and other detected headlight regions included in the set of detected headlight regions meets a preset condition; if the relationship between the selected detected headlight region and one of the other detected headlight regions included in the set of detected headlight regions meets the preset condition, then determining that the detected headlight region that meets the preset condition and the selected detected headlight region are paired.

[0009] Among them, respectively determining whether the relationship between the selected detected headlight area and other detected headlight areas included in the detected headlight area set meets a preset condition includes: respectively determining whether the vertical distance between the central coordinate of the selected detected headlight area and the central coordinate of each of the other detected headlight areas included in the detected headlight area set is less than a threshold; respectively determining whether the horizontal distance between the central coordinate of the selected detected headlight area and the central coordinate of each of the other detected headlight areas included in the detected headlight area set meets the threshold range; if the relationship between the selected detected headlight area and one of the other detected headlight areas included in the detected headlight area set meets the preset condition, determining that the detected headlight area that meets the preset condition is paired with the selected detected headlight area, including: if the vertical distance between the central coordinate of the selected detected headlight area set and the central coordinate of one of the other detected headlight areas included in the detected headlight area set is less than the threshold, and the horizontal distance between the central coordinate of the selected detected headlight area and the central coordinate of the detected headlight area corresponding to the vertical distance less than the threshold meets the threshold range, then determining that the detected headlight area that meets the threshold range is paired with the selected detected headlight area.

[0010] Among them, based on the detected headlight area set, obtaining each pair of headlight areas further includes: if the relationships between the selected detected headlight area and other detected headlight areas included in the detected headlight area set do not meet the preset condition, deleting the selected detected headlight area.

[0011] Among them, determining the detected license plate area matched with each pair of headlight areas from the detected license plate area set includes: determining the central position between the two central coordinates corresponding to the two detected headlight areas in the target pair of headlight areas; determining whether the detected license plate area in the detected license plate area set is at a preset position of the central position; if one of the detected license plate areas in the detected license plate area set is at the preset position of the central position, retaining the detected license plate area.

[0012] To solve the above technical problem, the second technical solution adopted by the present invention is: providing a terminal, the terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor is used to execute program data to implement the steps in the above vehicle detection method.

[0013] To solve the above technical problems, the third technical solution adopted by the present invention is: to provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the above vehicle detection method are implemented.

[0014] The beneficial effects of the present invention are as follows: Different from the prior art, a vehicle detection method, a terminal and a computer-readable storage medium are provided. The vehicle detection method includes performing license plate detection and headlight detection on a to-be-processed image to obtain a set of detected license plate regions and a set of detected headlight regions; based on the set of detected headlight regions, obtaining each pair of headlight regions; wherein, a pair of headlight regions includes different detected headlight regions belonging to the same vehicle in the set of detected headlight regions; determining the detected license plate regions matching each pair of headlight regions from the set of detected license plate regions; and determining the detected headlight regions included in each pair of headlight regions and the determined detected license plate regions as the vehicle detection result of the to-be-processed image. In this application, first, the pairs of headlight regions are screened out from the set of detected headlight regions, and then the detected license plate regions corresponding to each pair of headlight regions are screened out from the set of detected license plate regions. It is possible to detect the license plate of a vehicle without detecting the contour of the vehicle, reducing false alarms of the license plate and headlight, and improving the detection accuracy of the vehicle headlight and license plate. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0016] Figure 1 is a schematic flowchart of the vehicle detection method provided by the present invention;

[0017] Figure 2 is a schematic flowchart of a specific embodiment of the vehicle detection method provided by the present invention;

[0018] Figure 3 is a schematic diagram of a specific embodiment of the vehicle detection method provided by the present invention;

[0019] Figure 4 is a schematic block diagram of an embodiment of the terminal provided by the present invention;

[0020] Figure 5 is a schematic block diagram of an embodiment of the computer-readable storage medium provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0021] The following will describe the solutions of the embodiments of the present application in detail with reference to the accompanying drawings of the specification.

[0022] In the following description, specific details such as specific system architectures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the present application.

[0023] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the front and back associated objects. Furthermore, "plurality" in this article means two or more than two.

[0024] To enable those skilled in the art to better understand the technical solution of the present invention, the following further describes in detail a vehicle detection method provided by the present invention in conjunction with the accompanying drawings and specific embodiments.

[0025] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of the license plate positioning method provided by the present invention. In this embodiment, a vehicle detection method is provided, and the license plate positioning method includes the following steps.

[0026] S11: Perform license plate detection and headlight detection on the image to be processed, and obtain a set of detected license plate regions and a set of detected headlight regions.

[0027] Specifically, the image to be processed can be obtained through an image acquisition device, and the image to be processed includes vehicles. The image acquisition device can be a camera or a mobile phone with a photographing function. Among them, the number of vehicles can be one or multiple. The vehicles can be motor vehicles. The target detection model is used to perform target detection on the image to be processed, and a set of detected headlight regions and a set of detected license plate regions of all vehicles included in the image to be processed are detected. Among them, the set of detected headlight regions includes at least one detected headlight region, and the detected headlight region is the position of the headlight detection frame of the detected vehicle in the image to be processed. The set of detected license plate regions includes at least one detected license plate region, and the detected license plate region is the position of the license plate detection frame of the detected vehicle in the image to be processed.

[0028] S12: Based on the set of detected headlight regions, obtain pairs of each headlight region.

[0029] Specifically, based on the object detection model, headlight detection is performed on the image to be processed, and each detected headlight area included in the image to be processed is detected. Then, the detected headlight areas are clustered to obtain the detected headlight areas. In this embodiment, the vehicle is a motor vehicle, there are two front lights on the motor vehicle, and there are also two rear lights on the motor vehicle. According to the positions between the two headlights on the same end of the same vehicle, the detected headlight areas that can form a headlight area pair are screened out from the detected headlight area set, and the unpaired detected headlight areas in the detected headlight area set are removed.

[0030] S13: Determine the detected license plate areas that match each headlight area pair from the detected license plate area set.

[0031] Specifically, in this embodiment, the license plate of the motor vehicle is located at the front end and the rear end of the vehicle. The license plate at the front end of the vehicle and the license plate at the rear end of the vehicle are both located at a position close to the bottom of the vehicle at the midpoint of the line connecting the two headlights set on the same end. In other alternative embodiments, the license plate at the front end of the motor vehicle is located at a position close to the bottom of the vehicle at the midpoint of the line connecting the two front headlights; the license plate at the rear end of the motor vehicle can also be located at a position close to the roof of the vehicle at the midpoint of the line connecting the two rear headlights, such as a truck. Based on the positional relationship between the headlight positions of the paired headlights and the license plate positions, the detected license plate areas corresponding to each detected headlight pair can be screened out from the detected license plate area set, thereby realizing the detection of the license plate of the vehicle.

[0032] S14: Determine the detected headlight areas included in each headlight area pair and the determined detected license plate areas as the vehicle detection result of the image to be processed.

[0033] Specifically, screen out the detected license plate areas corresponding to the headlight area pairs from the detected license plate area set, remove the uncorresponding detected license plate areas, and output the two detected headlight areas included in the headlight area pair and the corresponding detected license plate areas as the vehicle detection result of the image to be processed. In another alternative embodiment, output the screened detected license plate areas as the vehicle detection result of the image to be processed.

[0034] The vehicle detection method provided in this embodiment includes performing license plate detection and headlight detection on the image to be processed, obtaining a set of detected license plate regions and a set of detected headlight regions; based on the set of detected headlight regions, obtaining each pair of headlight regions; where a pair of headlight regions includes different detected headlight regions belonging to the same vehicle in the set of detected headlight regions; determining the detected license plate regions matching each pair of headlight regions from the set of detected license plate regions; and determining the detected headlight regions included in each pair of headlight regions and the determined detected license plate regions as the vehicle detection result of the image to be processed. In this application, first, the pairs of headlight regions are screened out from the set of detected headlight regions, and then the detected license plate regions corresponding to each pair of headlight regions are screened out from the set of detected license plate regions. It is possible to detect the license plate of the vehicle without detecting the contour of the vehicle, reducing false alarms of the license plate and the headlights, and improving the detection accuracy of the vehicle headlights and license plate.

[0035] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a specific embodiment of the license plate positioning method provided by the present invention. In this embodiment, a vehicle detection method is provided, and the license plate positioning method includes the following steps.

[0036] S21: Based on the target detection model, perform license plate detection and headlight detection on the image to be processed, obtaining a set of detected license plate regions and a set of detected headlight regions.

[0037] Specifically, the image to be processed includes vehicles. Among them, the number of vehicles can be one or multiple. Among them, the vehicle can be a motor vehicle. Based on the target detection model, perform license plate detection on the image to be processed, detect each detected license plate region included in the image to be processed, and cluster the detected license plate regions to obtain the detected license plate regions. Based on the target detection model, perform headlight detection on the image to be processed, detect each detected headlight region included in the image to be processed, and cluster the detected headlight regions to obtain the detected headlight regions.

[0038] In an optional embodiment, the target detection model is trained with a training sample set composed of multiple images marked with the detected license plate positions and the detected headlight positions to improve the detection accuracy of the target detection model.

[0039] Generally, there are two headlights and one license plate on the same side of the same vehicle. Since the detected license plate regions and / or the detected headlight regions of the vehicles in the image to be processed may be blocked or out of the frame, the number of detected headlight regions and the number of detected license plate regions obtained by detection do not correspond. Therefore, the number of detected headlight regions included in the set of detected headlight regions is not related to the number of detected license plate regions included in the set of detected license plate regions.

[0040] Determine the central coordinates corresponding to each detected license plate region; arrange the central coordinates corresponding to all the detected license plate regions included in the detected license plate region set according to the first rule. The central coordinates corresponding to the detected license plate region are the positions of the vehicle's detected license plate region in the image to be processed. Extract the horizontal coordinates in the central coordinates of each detected license plate region included in the detected license plate region set, and arrange them in ascending order, so as to obtain the arranged central coordinates and the correspondingly arranged detected license plate regions in sequence, that is, the detected license plate regions included in the detected license plate region set are arranged in sequence according to the magnitudes of the horizontal coordinates. In another alternative embodiment, extract the vertical coordinates in the central coordinates of each detected license plate region included in the detected license plate region set, and arrange them in ascending order, so as to obtain the arranged central coordinates and the correspondingly arranged detected license plate regions in sequence, that is, the detected license plate regions included in the detected license plate region set are arranged in sequence according to the magnitudes of the vertical coordinates. In another alternative embodiment, set the upper left corner of the image to be processed as the coordinate origin, determine the distance from each detected license plate region to the origin according to the central coordinates of the detected license plate region, and then arrange all the detected license plate regions in sequence from near to far from the origin according to the distance from the detected license plate region to the origin.

[0041] Determine the central coordinates corresponding to each detected headlight region; arrange the central coordinates corresponding to all the detected headlight regions included in the detected headlight region set according to the second rule. Among them, the central coordinates corresponding to the detected headlight region are the positions of the vehicle's detected headlight region in the image to be processed. Extract the horizontal coordinates in the central coordinates of each detected headlight region included in the detected headlight region set, and arrange them in ascending order, so as to obtain the arranged central coordinates and the correspondingly arranged detected headlight regions in sequence, that is, the detected headlight regions included in the detected headlight region set are arranged in sequence according to the magnitudes of the horizontal coordinates. In another alternative embodiment, extract the vertical coordinates in the central coordinates of each detected headlight region included in the detected headlight region set, and arrange them in ascending order, so as to obtain the arranged central coordinates and the correspondingly arranged detected headlight regions in sequence, that is, the detected headlight regions included in the detected headlight region set are arranged in sequence according to the magnitudes of the vertical coordinates. In another alternative embodiment, set the upper left corner of the image to be processed as the coordinate origin, determine the distance from each detected headlight region to the origin according to the central coordinates of the detected headlight region, and then arrange all the detected headlight regions in sequence from near to far from the origin according to the distance from the detected headlight region to the origin.

[0042] Among them, the first rule may be the same as the second rule or may be different from the second rule.

[0043] S22: Select a detected headlight region from the detected headlight region set.

[0044] Specifically, select the central coordinates of one detected headlight area from among the multiple detected headlight areas included in the detected headlight area set. Preferably, select the central coordinates corresponding to the first detected headlight area arranged in the detected headlight area set. For example, the central coordinates corresponding to the selected detected headlight area are A 1 (x 1 , y 1 ). It is also possible to select the central coordinates corresponding to any detected headlight area in the detected headlight area set. For example, the central coordinates corresponding to the selected detected headlight area are A 3 (x 3 , y 3 ).

[0045] S23: Determine whether the relationship between the selected detected headlight area and the other detected headlight areas included in the detected headlight area set meets a preset condition.

[0046] Specifically, respectively determine whether the vertical distance between the central coordinates of the selected detected headlight area and the central coordinates of each of the other detected headlight areas included in the detected headlight area set is less than a threshold value. For example, determine whether the vertical distance |y 1 (x 1 , y 1 ) and the central coordinates A 2 (x 2 , y 2 ) of another detected headlight area, |y 2 - y 1 | is less than the set threshold value α. α is set according to the fact that two headlights in the same vehicle are at the same height position. If the y-values of the two central coordinates differ greatly, it indicates that these two detected headlight areas do not belong to the same vehicle; if the difference between the y-values of the two central coordinates is less than the set threshold value, it indicates that these two detected headlight areas belong to the same end of the same vehicle.

[0047] Respectively determine whether the horizontal distance between the central coordinates of the selected detected headlight area and the central coordinates of each of the other detected headlight areas meets the threshold range. For example, determine whether the horizontal distance |x 1 (x 1 , y 1 ) and the central coordinates A 2 (x 2 , y 2 ) of another detected headlight area, |x 2 - x 1Whether it is greater than β and less than γ. β is to avoid detecting two detected headlight areas for the same detected headlight area of a vehicle, matching the center coordinates corresponding to the two detected headlight areas obtained from the same detected headlight area, and thus preventing false reporting; γ is to exclude matching the detected headlight area of the first vehicle arranged horizontally with the detected headlight area of the adjacent second vehicle, and thus improving the matching accuracy. Among them, β and γ are determined according to the positions of the two detected headlight areas in the vehicle. If the x values of the two center coordinates differ greatly or are very small, it indicates that the two detected headlight areas do not belong to the same vehicle.

[0048] If the relationship between the selected detected headlight area and one of the other detected headlight areas included in the detected headlight area set meets the preset condition, then step S24 is executed; if the relationship between the selected detected headlight area and all of the other detected headlight areas in the detected headlight area set does not meet the preset condition, then step S25 is executed.

[0049] S24: Determine that the detected headlight area meeting the preset condition and the selected detected headlight area are matched into a pair of headlight areas.

[0050] Specifically, if the relationship between the selected detected headlight area and one of the other detected headlight areas included in the detected headlight area set meets the preset condition, then it is determined that the corresponding detected headlight area and the selected detected headlight area match each other, that is to say, the detected headlight area meeting the preset condition and the selected detected headlight area belong to a pair of headlights on the same vehicle. In a specific embodiment, if the horizontal distance between the center coordinate of the selected detected headlight area and the center coordinate of one of the other detected headlight areas meets the threshold range, and the vertical distance between the center coordinate of the selected detected headlight area and the center coordinate of the detected headlight area whose horizontal distance meets the threshold range is less than the threshold, then it is determined that the detected headlight areas corresponding to the center coordinates meeting the preset range and threshold and the selected detected headlight area belong to a pair of headlights on the same vehicle, and both are at the front end or both are at the rear end of the vehicle, and the detected headlight area and the selected detected headlight area are matched into a pair of headlight areas.

[0051] S25: Delete the detected headlight.

[0052] Specifically, if the relationship between the selected detected headlight area and all the detected headlight areas in other detected headlight areas in the detected headlight area set does not meet the preset conditions, it is determined that the selected detected headlight area does not match any of the other detected headlight areas. That is to say, the selected detected headlight area and the other detected headlight areas do not belong to the same vehicle, and then the selected detected headlight area is deleted. In a specific embodiment, if the horizontal distance between the central coordinates of the selected detected headlight area and the central coordinates of all the detected headlight areas in other detected headlight areas in the detected headlight area set does not meet the threshold range, or the vertical distance between the central coordinates of the selected detected headlight area and the central coordinates of all the detected headlight areas in other detected headlight areas in the detected headlight area set is not less than the threshold, it is determined that the detected headlight area corresponding to the selected central coordinates and the other detected headlight areas do not belong to the same vehicle. After deleting the selected detected headlight area, directly jump to step S22.

[0053] S26: Determine the central position between the two central coordinates corresponding to the two detected headlight areas of the target headlight area pair.

[0054] Specifically, in a motor vehicle, the detected license plate area is generally located at a position slightly below the center of the line connecting a pair of detected headlight areas. Therefore, in order to determine the detected license plate area corresponding to the detected headlight area of the vehicle, it is necessary to determine the central position on the line connecting the center coordinates of the two matching detected headlight areas. For example, detected headlight area A 1 is paired with detected headlight area A 2 , then the central position between the central coordinates corresponding to detected headlight area A 1 and the central coordinates corresponding to detected headlight area A 2 is

[0055] S27: Determine whether each detected license plate area in the detected license plate area set is at the preset position of the central position.

[0056] Specifically, since the license plate is located at a position slightly below the center of the line connecting a pair of headlights, then determine the positional relationship between the central coordinates of each detected license plate area in the detected license plate area set and the central position. Specifically, set the preset position where the license plate is slightly below the central position according to the actual situation. Among them, the preset position is a preset range. Determine whether the central coordinates of each detected license plate area are within the preset range.

[0057] If the central coordinates of a detected license plate area in the detected license plate area set are at the preset position of the central position, directly jump to step S28; if the central coordinates of all the detected license plate areas included in the detected license plate area set are not at the preset position of the central position, directly jump to step S29.

[0058] S28: Use the detected license plate position as the detected license plate corresponding to a pair of detected vehicle lights.

[0059] Specifically, if the center coordinate of a detected license plate area in the detected license plate area set is at the preset position in the central position, it indicates that the pair of detected vehicle light areas match successfully with the detected license plate area at the preset position in the central position. Use the detected license plate with the center coordinate at the preset position in the central position as the license plate corresponding to the pair of detected vehicle lights in step S26, and output the detected license plate area as the vehicle detection result of the image to be processed.

[0060] S29: Extract the image at the preset position in the central position and perform detection again.

[0061] Specifically, if the center coordinates of all detected license plate areas included in the detected license plate area set are not at the preset position in the central position, it indicates that the target vehicle light area pair does not match successfully with all detected license plate areas in the detected license plate area set. Segment the image area at the preset position in the central position corresponding to the target vehicle light area pair, and perform detection again through the target detection model. Output the detected license plate area obtained by the detection as the detection result of the image to be processed, avoid missed detection of vehicle detection, and thus improve the accuracy of vehicle detection.

[0062] Please refer to Figure 3 , Figure 3 which is a schematic diagram of a specific embodiment of the license plate positioning method provided by the present invention. In a specific embodiment, an image to be processed is obtained, and the detected vehicle light area set A = {A 1 , A 2 , A 3 , …, A n} obtained by detecting the image to be processed, where A 1 , A 2 , A 3 , …, A n represent different detected vehicle light areas. The detected license plate area set B = {B 1 , B 2 , B 3 , …, B m} is obtained, where B 1 , B 2 , B 3 , …, B m represent different detected license plate areas. Sort the detected license plate area set B = {B 1 (x 1 , y 1 ), B 2 (x 2 , y 2 ), B 3 (x3 , y 3 ), … B m (x m , y m ),} where x m > x 3 > x 2 > x 1 . Sort the detected headlight area set A = {A 1 (x 1 , y 1 ), A 2 (x 2 , y 2 ), A 3 (x 3 , y 3 ), … A n (x n , y n ),} where x n > x 3 > x 2 > x 1 . Take out the center coordinates A 1 (x 1 , y 1 ) of a headlight area in the detected headlight area set and match it with the center coordinates of other headlight areas. Judge whether the horizontal distance |x 1 (x 1 , y 1 ) of the selected headlight area and the center coordinates A 2 (x 2 , y 2 ) of another headlight area is greater than β and less than γ, and judge whether the vertical distance |y 2 - x 1 | of the selected headlight area and the center coordinates A 1 (x 1 , y 1 ) of another headlight area and the center coordinates A 2 (x 2 , y 2 ) of another headlight area is |y 2 - y 1|Whether it is less than the set threshold α. If the relationship between the selected headlight area and one of the other headlight areas in the detected headlight area set does not meet the preset condition, the selected headlight area is deleted, and the second headlight area is selected and matched with the remaining other headlight areas. If the relationship between the selected headlight area and one of the other headlight areas in the detected headlight area set meets the preset condition, it is determined that the corresponding headlight area and the selected headlight area match each other, the central coordinates corresponding to the two paired headlight areas are extracted, and it is determined whether the license plate area included in the detected license plate area set is at a position slightly lower than the center of the connection line of the central coordinates of the paired headlight areas. If a license plate area in the detected license plate area set is at a position slightly lower than the center of the connection line of the central coordinates of the paired headlight areas, the corresponding license plate area is output as the vehicle detection result of the image to be processed.

[0063] The vehicle detection method provided in this embodiment includes performing license plate detection and headlight detection on the image to be processed to obtain a detected license plate area set and a detected headlight area set; based on the detected headlight area set, obtaining each pair of headlight areas; where a pair of headlight areas includes different detected headlight areas belonging to the same vehicle in the detected headlight area set; determining the detected license plate areas matching each pair of headlight areas from the detected license plate area set; and determining the detected headlight areas included in each pair of headlight areas and the determined detected license plate areas as the vehicle detection result of the image to be processed. In this application, first, the pairs of headlight areas are screened out from the detected headlight area set, and then the detected license plate areas corresponding to each pair of headlight areas are screened out from the detected license plate area set. It is possible to detect the license plate of the vehicle without detecting the contour of the vehicle, reduce the false alarms of the license plate and the headlights, and improve the detection accuracy of the vehicle headlights and license plate.

[0064] Refer to Figure 4 , Figure 4 FIG. is a schematic block diagram of an embodiment of a terminal provided by the present invention. The terminal 70 in this embodiment includes: a processor 71, a memory 72, and a computer program stored in the memory 72 and executable on the processor 71. When the computer program is executed by the processor 71, it implements the above vehicle detection method. To avoid repetition, it will not be elaborated here one by one.

[0065] Refer to Figure 5 , Figure 5 FIG. is a schematic block diagram of an embodiment of a computer-readable storage medium provided by the present invention.

[0066] In an embodiment of the present application, a computer-readable storage medium 90 is further provided. The computer-readable storage medium 90 stores a computer program 901. The computer program 901 includes program instructions. When the processor executes the program instructions, it implements the vehicle detection method provided in the embodiment of the present application.

[0067] Among them, the computer-readable storage medium 90 may be an internal storage unit of the computer device in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium 90 may also be an external storage device of the computer device, such as a plug-in hard disk equipped on the computer device, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc.

[0068] The above are only the embodiments of the present invention, and do not limit the patent protection scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be equally included in the patent protection scope of the present invention.

Claims

1. A vehicle detection method, characterized in that, the method includes: performing license plate detection and headlight detection on the image to be processed to obtain a set of detected license plate regions and a set of detected headlight regions; based on the set of detected headlight regions, obtaining each pair of headlight regions; wherein, one pair of headlight regions includes different detected headlight regions in the set of detected headlight regions that belong to the same vehicle; determining the detected license plate regions that match each pair of headlight regions from the set of detected license plate regions; determining the detected headlight regions included in each pair of headlight regions and the determined detected license plate regions as the vehicle detection result of the image to be processed; the determining the detected license plate regions that match each pair of headlight regions from the set of detected license plate regions includes: determining the central position between two central coordinates corresponding to the two detected headlight regions in the target pair of headlight regions; the target pair of headlight regions is a pair of headlight regions in the set of detected license plate regions for which no matching detected license plate region exists; judging whether the detected license plate regions in the set of detected license plate regions are at a preset position of the central position; if one of the detected license plate regions in the set of detected license plate regions is at the preset position of the central position, then retaining the detected license plate region.

2. The vehicle detection method according to claim 1, characterized in that, the determining the detected license plate regions that match each pair of headlight regions from the set of detected license plate regions further includes: if it is determined that there is a target pair of headlight regions among each pair of headlight regions, then performing license plate detection on the image region corresponding to the target pair of headlight regions in the image to be processed to obtain the license plate detection region that matches the target pair of headlight regions.

3. The vehicle detection method according to claim 1, characterized in that, the performing license plate detection and headlight detection on the image to be processed to obtain a set of detected license plate regions and a set of detected headlight regions includes: performing the license plate detection on the image to be processed based on a target detection model, detecting each detected license plate region included in the image to be processed, and clustering the detected license plate regions to obtain the detected license plate regions; and performing the headlight detection on the image to be processed based on the target detection model, detecting each detected headlight region included in the image to be processed, and clustering the detected headlight regions to obtain the detected headlight regions.

4. The vehicle detection method according to claim 3, characterized in that, the performing license plate detection and headlight detection on the image to be processed to obtain a set of detected license plate regions and a set of detected headlight regions further includes: determining the central coordinate of each detected headlight region and the central coordinate of each detected license plate region; arranging the central coordinates corresponding to all the detected license plate regions included in the set of detected license plate regions according to a first rule; arranging the central coordinates corresponding to all the detected headlight regions included in the set of detected headlight regions according to a second rule.

5. The vehicle detection method according to claim 4, characterized in that, Based on the detected headlight area set, obtaining each pair of headlight areas includes: Selecting one of the detected headlight areas in the detected headlight area set, and matching the selected detected headlight area with other detected headlight areas included in the detected headlight area set; Respectively determining whether the relationship between the selected detected headlight area and other detected headlight areas included in the detected headlight area set meets a preset condition; If the relationship between the selected detected headlight area and one of the other detected headlight areas included in the detected headlight area set meets the preset condition, then determine that the detected headlight area that meets the preset condition and the selected detected headlight area are paired.

6. The vehicle detection method according to claim 5, wherein, The step of respectively determining whether the relationship between the selected detected headlight area and other detected headlight areas included in the detected headlight area set meets a preset condition includes: Respectively determining whether the vertical distance between the center coordinates of the selected detected headlight area and the center coordinates of each of the other detected headlight areas included in the detected headlight area set is less than a threshold; respectively determining whether the horizontal distance between the center coordinates of the selected detected headlight area and the center coordinates of each of the other detected headlight areas included in the detected headlight area set meets the threshold range; The step of if the relationship between the selected detected headlight area and one of the other detected headlight areas included in the detected headlight area set meets the preset condition, then determining that the detected headlight area that meets the preset condition and the selected detected headlight area are paired includes: If the vertical distance between the center coordinates of the selected detected headlight area set and the center coordinates of one of the other detected headlight areas included in the detected headlight area set is less than the threshold, and the horizontal distance between the center coordinates of the selected detected headlight area and the center coordinates of the detected headlight area corresponding to the vertical distance less than the threshold meets the threshold range, then determine that the detected headlight area that meets the threshold range and the selected detected headlight area are paired.

7. The vehicle detection method according to claim 5, wherein, Based on the detected headlight area set, obtaining each pair of headlight areas further includes: If the relationship between the selected detected headlight area and other detected headlight areas included in the detected headlight area set does not meet the preset condition, then delete the selected detected headlight area.

8. A vehicle detection terminal, wherein, The vehicle detection terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor. The processor is configured to execute program data to implement the steps in the vehicle detection method according to any one of claims 1 to 7.

9. A computer-readable storage medium, wherein, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the vehicle detection method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Vehicle detection method and device, and computer storage medium

    CN111652143A