A yolov5-based vehicle illegal parking identification method
By using the YOLOv5 detection model and perceptual hashing algorithm, the problems of accuracy and computational efficiency in vehicle illegal parking identification are solved, achieving efficient and accurate vehicle illegal parking identification, reducing false alarms and duplicate alarms, and making it suitable for vehicle illegal parking identification in urban governance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2026-03-20
AI Technical Summary
Existing vehicle illegal parking identification methods based on object detection are not accurate enough, and there are problems of missed and false alarms. In addition, they are computationally efficient, making it difficult to apply them efficiently in urban governance.
The YOLOv5 detection model is used. By collecting, cleaning and labeling images of parked vehicles, the model is trained and deployed. The perceptual hash algorithm is used to determine changes in vehicle position. Similarity and overlap thresholds are set to determine whether a vehicle is illegally parked. The model is deployed on a GPU server for real-time recognition.
It achieves efficient and accurate vehicle illegal parking identification, reduces false alarms and duplicate alarms, improves the accuracy of the detection model in real-world scenarios, and reduces system construction costs.
Smart Images

Figure CN115546181B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of deep learning image analysis processing, and in particular to a vehicle illegal parking identification method based on yolov5. BACKGROUND
[0002] With the development of modern economic society, people's living standards are improving, and the number of cars is also increasing. In real life, the phenomenon of random parking of vehicles also increases, which brings great challenges to urban management. For the treatment of vehicle illegal parking, the traditional way is generally to arrange traffic police or urban management to patrol the area prone to illegal parking behavior within a certain period of time, which not only consumes a lot of manpower and material resources, but also has low processing efficiency. With the popularity of camera monitoring, cameras are installed in areas prone to illegal parking, and vehicle illegal parking identification methods based on monitoring video images and deep learning are emerging like mushrooms after rain, which are generally divided into vehicle illegal parking identification methods based on target detection and vehicle illegal parking identification methods based on target tracking. The vehicle illegal parking identification method based on target tracking can well distinguish whether the vehicle constitutes an illegal parking behavior, but it requires a large amount of computing power and needs to match a huge computing system. In the context of urban management, there are often hundreds or thousands of cameras, and the computing efficiency is required to be high. The vehicle illegal parking identification method based on target detection can quickly detect vehicle position information with small computing overhead, but there is a lot of room for improvement in how to more accurately judge whether the vehicle is illegal parking.
[0003] Therefore, how to provide an efficient and accurate vehicle illegal parking identification method has become a technical problem to be solved. SUMMARY
[0004] Therefore, the present application aims to solve the problem of inaccurate vehicle illegal parking identification based on target detection, false positives and false negatives, and provides a fast and accurate vehicle illegal parking identification method, which can accurately identify whether the vehicle is illegal parking and record warning pictures, facilitating urban management.
[0005] In one aspect, the present application provides a vehicle illegal parking identification method based on yolov5, comprising:
[0006] Step S1: Collect and analyze vehicle parking pictures to obtain a vehicle parking data set, train and deploy a yolov5 detection model according to the vehicle parking data set;
[0007] Step S2: Configure system algorithm parameters through a page, call the deployed yolov5 detection model according to the configured system algorithm parameters, process pictures under the camera, and output vehicle position information;
[0008] Step S3: According to the vehicle position information in the current frame picture and the last frame picture, it is judged whether the vehicle in the current frame picture is illegally parked, and alarm information is output for the illegally parked vehicle.
[0009] Further, the step S1 of the vehicle illegal parking identification method based on yolov5 comprises:
[0010] Step S11: Collect vehicle parking pictures, perform cleaning and labeling processing on the collected vehicle parking pictures, obtain a vehicle parking dataset, and divide the vehicle parking dataset into a training dataset and a test dataset according to a proportion;
[0011] Step S12: Training the yolov5 detection model using the training dataset, and saving the model parameters in the training process;
[0012] Step S13: Verify the saved model parameters using the test dataset, and obtain an optimized yolov5 detection model;
[0013] Step S14: Deploy the optimized yolov5 detection model on a GPU server.
[0014] Further, in the step S1 of the vehicle illegal parking identification method based on yolov5, the vehicle parking dataset is obtained by collecting and analyzing vehicle parking pictures, comprising:
[0015] Collect vehicle parking pictures through a monitoring camera, and remove invalid pictures in the collected vehicle parking pictures according to picture definition and whether they are intact;
[0016] Use a labelImg labeling tool to label a rectangular frame of a vehicle in the vehicle parking picture, mark the vehicle type, generate an xml labeling file, and convert the xml labeling file into a txt file suitable for the yolov5 detection model, wherein each line in the txt file represents information of one vehicle, including a vehicle category, a vehicle center point horizontal coordinate, a vehicle center point vertical coordinate, a vehicle width and a vehicle height.
[0017] Further, in the step S1 of the vehicle illegal parking identification method based on yolov5, the yolov5 detection model is trained and deployed according to the vehicle parking dataset, comprising: in the training process, the training dataset is expanded through a data enhancement method, and the data enhancement method comprises picture rotation, picture translation, picture folding and picture random cropping.
[0018] Further, the step S2 of the vehicle illegal parking identification method based on yolov5 comprises:
[0019] Step S21: configure system algorithm parameters through a page, the system algorithm parameters including: task start time, camera id, illegal parking duration threshold, vehicle confidence, and illegal parking area;
[0020] Step S22: call the yolov5 detection model deployed in step S1 using the configured system algorithm parameters;
[0021] Step S23: detect the vehicle with a confidence greater than or equal to the set vehicle confidence in the vehicle parking picture using the deployed yolov5 detection model;
[0022] Step S24: detect whether the vehicle in step S23 is in the illegal parking area using the deployed yolov5 detection model, and when the vehicle is in the illegal parking area, initialize the alarm flag bit to 0 and output the vehicle position information added with the initialized alarm flag bit.
[0023] Further, the step S3 of the yolov5-based vehicle illegal parking identification method includes:
[0024] Obtain the vehicle position information in the current frame picture and the previous frame picture, set a coincidence degree threshold, and determine whether the positions in the current frame picture and the previous frame picture are the same position according to the vehicle position information in the current frame picture and the previous frame picture;
[0025] If the positions in the current frame picture and the previous frame picture are the same position, calculate the similarity of the vehicles in the two frame pictures through a perceptual hashing algorithm, and determine whether the vehicles in the two frame pictures are the same vehicle according to the similarity;
[0026] If the vehicles in the two frame pictures are the same vehicle, assign the alarm flag bit of the previous frame picture to the current frame picture, assign the time generated by the previous frame picture to the time generated by the current frame picture, and determine whether the vehicle in the current frame picture is illegally parked according to the alarm flag bit of the current frame picture and the illegal parking duration;
[0027] If the vehicle in the current frame picture is determined to be illegally parked, alarm and modify the alarm flag bit of the current frame picture to 1.
[0028] Further, in the yolov5-based vehicle illegal parking identification method, the coincidence degree threshold is set, and whether the positions in the current frame picture and the previous frame picture are the same position is determined according to the vehicle position information in the current frame picture and the previous frame picture, including:
[0029] Calculate the intersection area and the union area of the vehicle rectangular frame labeled in the current frame picture and the vehicle rectangular frame labeled in the previous frame picture;
[0030] The ratio of the intersection area to the union area is taken as the coincidence degree value, the coincidence degree value is compared with a set coincidence degree threshold value, if the coincidence degree value is greater than or equal to the coincidence degree threshold value, it is determined that the positions in the current frame picture and the last frame picture are the same position; if the coincidence degree value is less than the coincidence degree threshold value, it is determined that the positions in the current frame picture and the last frame picture are different positions.
[0031] Further, in the vehicle illegal parking identification method based on yolov5, if the positions in the current frame picture and the last frame picture are the same position, the similarity of the vehicles in the two frame pictures is calculated through the perceptual hashing algorithm, and whether the vehicles in the two frame pictures are the same vehicle is judged according to the similarity, comprising:
[0032] The pixels of the current frame picture and the last frame picture are scaled to 32*32, and 32*32 pixel value matrices of the two frame pictures are obtained respectively, and the scaled two frame pictures are converted into gray scale pictures.
[0033] Discrete cosine transforms are respectively performed on the 32*32 pixel value matrices of the two frame pictures, corresponding 8*8 matrices are respectively obtained from the top left corners of the transformed matrices, the corresponding 8*8 matrices are respectively stretched into 1*64 vectors, and the average values of the 64 values in the 1*64 vectors are respectively calculated.
[0034] Each pixel in the current frame gray scale picture is traversed, and the gray scale value of each pixel is compared with the corresponding average value; each pixel in the last frame gray scale picture is traversed, and the gray scale value of each pixel is compared with the corresponding average value; if the gray scale value of the pixel is greater than the average value, 1 is recorded, otherwise 0 is recorded, and the hash values composed of 64-bit 1 or 0 values of the two frame pictures are respectively obtained.
[0035] The Hamming distance dist between the hash values of the two frame gray scale pictures is calculated, and the Hamming distance dist is converted into a similarity according to the following formula:
[0036] similarity=1-dist*1.0 / 64
[0037] In the formula, similarity is the similarity, and dist is the Hamming distance.
[0038] A similarity threshold value is set, if the similarity is greater than the similarity threshold value, it is determined that the vehicles in the current frame picture and the last frame picture are the same vehicle; if the similarity is not greater than the similarity threshold value, it is determined that the vehicles in the current frame picture and the last frame picture are different vehicles.
[0039] Further, in the vehicle illegal parking identification method based on yolov5, whether the vehicle in the current frame picture is illegally parked is judged according to the alarm flag bit and the illegal parking duration of the current frame picture, including: if the alarm flag bit of the current frame picture is 0, and the vehicle parking duration is greater than the illegal parking duration threshold, it is determined that the vehicle in the current frame picture is illegally parked.
[0040] Further, the vehicle illegal parking identification method based on yolov5 includes: in the task starting time, the operation of step S3 is executed cyclically.
[0041] The vehicle illegal parking identification method based on yolov5 has the following beneficial effects:
[0042] 1. The vehicle illegal parking can be efficiently and accurately identified, and false alarms or repeated alarms can be avoided.
[0043] 2. The detection model can be optimized based on the collected data to improve the accuracy of the detection model in actual scenarios.
[0044] 3. The vehicle illegal parking identification system can be implemented based on the existing monitoring system to reduce the construction cost of the vehicle illegal parking identification system. BRIEF DESCRIPTION OF DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0046] Figure 1 A flow chart of a vehicle illegal parking identification method based on yolov5 according to an exemplary first embodiment of the present application.
[0047] Figure 2 A flow chart of a vehicle illegal parking identification method based on yolov5 according to an exemplary second embodiment of the present application.
[0048] Figure 3 A flow chart of a vehicle illegal parking identification method based on yolov5 according to an exemplary third embodiment of the present application.
[0049] Figure 4 A schematic diagram of the intersection area and the union area of the vehicle rectangular frame in an exemplary fourth embodiment of the present application. DETAILED DESCRIPTION
[0050] The embodiments of the present application will be described in detail below with reference to the drawings.
[0051] It should be noted that the following embodiments and features in the embodiments can be combined with each other in the case of no conflict; and all other embodiments obtained by those skilled in the art based on the embodiments in the present disclosure without creative labor are within the scope of protection of the present disclosure.
[0052] It should be noted that various aspects of the embodiments described below are within the scope of the appended claims. As will be apparent, the aspects described herein can be embodied in a variety of ways, and that the specification should be considered exemplary only. It should be understood that any feature described herein as being part of one aspect can be implemented with any other aspect. That is, the description of any feature, aspect, or embodiment as part of an aspect is not to be construed as being only part of that aspect. The aspects described herein can be implemented in hardware, software, or a combination thereof. The aspects described herein can be implemented in one or more computer programs that run and / or are executed on one or more computers. The aspects described herein can be implemented in a plurality of different ways.
[0053] The names involved in the following embodiments are explained as follows:
[0054] yolov5: the fifth version of the target detection algorithm yolo (you only look once), which is a general target detection model. It is used to find all objects in an image and give their category information and location information.
[0055] Figure 1 The flow chart of a yolov5-based vehicle illegal parking identification method according to the exemplary first embodiment of the present application is shown in Figure 1 As shown in the figure, the method of the present embodiment comprises:
[0056] Step S1: collecting and analyzing vehicle parking pictures to obtain a vehicle parking data set, training and deploying a yolov5 detection model according to the vehicle parking data set;
[0057] Step S2: configuring system algorithm parameters through a page, calling the deployed yolov5 detection model according to the configured system algorithm parameters, processing pictures under the camera, and outputting vehicle location information;
[0058] Step S3: determining whether the vehicle in the current frame picture is illegally parked according to the vehicle location information in the current frame picture and the previous frame picture, and outputting alarm information for the illegally parked vehicle.
[0059] In actual application, in step S1 of the method of the present embodiment, collecting and analyzing vehicle parking pictures to obtain a vehicle parking data set comprises:
[0060] The vehicle parking pictures are collected by monitoring cameras, and invalid pictures in the collected vehicle parking pictures are removed according to the picture definition and whether the pictures are intact.
[0061] A labelImg labeling tool is used to label a rectangular frame of a vehicle in the vehicle parking picture, mark a vehicle type, generate an xml labeling file, and convert the xml labeling file into a txt file suitable for a yolov5 detection model. Each line in the txt file represents information of one vehicle, including a vehicle category, a vehicle center point horizontal coordinate, a vehicle center point vertical coordinate, a vehicle width, and a vehicle height. The vehicle category includes a car, a bus, a truck, and the like.
[0062] In actual application, in step S1 of the method, a yolov5 detection model is trained and deployed according to a vehicle parking dataset, including: in the training process, a training dataset is expanded by a data enhancement method, and the data enhancement method includes picture rotation, picture translation, picture folding, and picture random cropping. The picture rotation refers to rotating the picture at any angle; the picture translation refers to moving the picture horizontally or vertically to make the target located at the center of the picture; the picture folding refers to folding in the horizontal or vertical direction; and the picture random cropping refers to randomly cropping a part of the picture and adjusting the cropped area to the size of the original picture. Expanding the training dataset by the data enhancement method can reduce overfitting and improve the generalization ability of the model.
[0063] Figure 2 For a flowchart of a yolov5-based vehicle illegal parking identification method according to an exemplary second embodiment of the present application, the method includes Figure 1 as shown in the preferred implementation of the method, Figure 2 step S1 of the method includes:
[0064] Step S11: Collect vehicle parking pictures, perform cleaning and labeling processing on the collected vehicle parking pictures, obtain a vehicle parking dataset, and divide the vehicle parking dataset into a training dataset and a test dataset according to a proportion;
[0065] Step S12: Train a yolov5 detection model by using the training dataset, and save model parameters in the training process;
[0066] Step S13: Verify the saved model parameters by using the test dataset, and obtain an optimized yolov5 detection model;
[0067] Step S14: Deploy the optimized yolov5 detection model on a GPU server.
[0068] In practical applications, step S11 of the method of the embodiment can divide the vehicle parking data set into a training data set and a test data set in a ratio of 8:2. Step S14 of the method of the embodiment deploys the optimized yolov5 detection model on a GPU server, and the server can be called through an API to output information.
[0069] Figure 3 For a flowchart of a yolov5-based vehicle illegal parking identification method according to an exemplary third embodiment of the application, the embodiment is Figure 1 As shown in the preferred implementation of the method, Figure 3 Step S2 of the method of the embodiment includes:
[0070] Step S21: Configure system algorithm parameters through a page, wherein the system algorithm parameters include a task start time, a camera id, an illegal parking duration threshold, a vehicle confidence, and an illegal parking area.
[0071] Step S22: Call the yolov5 detection model deployed in step S1 by using the configured system algorithm parameters.
[0072] Step S23: Detect a vehicle with a confidence greater than or equal to a set vehicle confidence in a vehicle parking picture by using the deployed yolov5 detection model.
[0073] Step S24: Detect whether the vehicle in step S23 is in an illegal parking area by using the deployed yolov5 detection model, initialize an alarm flag to 0 when the vehicle is in the illegal parking area, and output vehicle position information added with the initialized alarm flag.
[0074] The exemplary fourth embodiment of the application provides a yolov5-based vehicle illegal parking identification method, and the embodiment is Figure 1 As shown in the preferred implementation of the method, Step S3 of the method of the embodiment includes:
[0075] Obtain vehicle position information in a current frame picture and a previous frame picture.
[0076] Set a coincidence threshold, and determine whether the positions in the current frame picture and the previous frame picture are the same position according to the vehicle position information in the current frame picture and the previous frame picture, specifically including: calculating an intersection area and a union area of a vehicle rectangular frame labeled in the current frame picture and a vehicle rectangular frame labeled in the previous frame picture, Figure 4An intersection area and a union area of the rectangular frames of the vehicles are shown in the figure; a ratio of the intersection area to the union area is taken as a coincidence value, the coincidence value is compared with a set coincidence threshold value, if the coincidence value is greater than or equal to the coincidence threshold value, it is determined that the positions in the current frame picture and the previous frame picture are the same position; if the coincidence value is less than the coincidence threshold value, it is determined that the positions in the current frame picture and the previous frame picture are different positions.
[0077] If the positions in the current frame picture and the previous frame picture are the same position, the similarity of the vehicles in the two frame pictures is calculated by the perceptual hashing algorithm, and whether the vehicles in the two frame pictures are the same vehicle is determined according to the similarity, specifically, comprising:
[0078] The pixels of the current frame picture and the previous frame picture are scaled to 32*32, and 32*32 pixel value matrices of the two frame pictures are obtained respectively, and the scaled two frame pictures are converted into gray scale pictures;
[0079] Discrete cosine transforms are respectively performed on the 32*32 pixel value matrices of the two frame pictures, corresponding 8*8 matrices are respectively obtained from the top left corners of the transformed matrices, the corresponding 8*8 matrices are respectively stretched into 1*64 vectors, and the average values of the 64 values in the 1*64 vectors are respectively calculated;
[0080] Each pixel in the current frame gray scale picture is traversed, and the gray scale value of each pixel is compared with the corresponding average value; each pixel in the previous frame gray scale picture is traversed, and the gray scale value of each pixel is compared with the corresponding average value; if the gray scale value of the pixel is greater than the average value, 1 is recorded, otherwise 0 is recorded, and hash values composed of 64-bit 1 or 0 values of the two frame pictures are respectively obtained;
[0081] The Hamming distance dist between the hash values of the two frame gray scale pictures is calculated, and the Hamming distance dist is converted into a similarity according to the following formula:
[0082] similarity=1-dist*1.0 / 64
[0083] In the formula, similarity is the similarity, and dist is the Hamming distance; the Hamming distance is the number of different characters corresponding to the positions of two equal-length strings.
[0084] A similarity threshold value is set, if the similarity is greater than the similarity threshold value, it is determined that the vehicles in the current frame picture and the previous frame picture are the same vehicle; if the similarity is not greater than the similarity threshold value, it is determined that the vehicles in the current frame picture and the previous frame picture are different vehicles.
[0085] If the vehicle in the two frames of pictures is the same vehicle, the alarm flag bit of the previous frame of pictures is assigned to the current frame of pictures, the time generated by the previous frame of pictures is assigned to the time generated by the current frame of pictures, so that the earliest parking time of the vehicle can be marked, and the judgment of the illegal parking duration is facilitated; whether the vehicle in the current frame of pictures is illegally parked is judged according to the alarm flag bit and the illegal parking duration of the current frame of pictures, specifically, including: if the alarm flag bit of the current frame of pictures is 0, and the parking duration of the vehicle is greater than the illegal parking duration threshold, it is determined that the vehicle in the current frame of pictures is illegally parked.
[0086] If the vehicle in the current frame of pictures is determined to be illegally parked, an alarm is given and the alarm flag bit of the current frame of pictures is modified to 1.
[0087] In actual application, the method of the embodiment is cyclically executed in the task starting time. The method of the embodiment judges whether the positions in the current frame of pictures and the previous frame of pictures are the same position, judges whether the vehicles in the two frames of pictures are the same vehicle according to the similarity, judges whether the vehicle in the current frame of pictures is illegally parked according to the alarm flag bit and the illegal parking duration of the current frame of pictures, and if the vehicle in the current frame of pictures is determined to be illegally parked, an alarm is given and the alarm flag bit of the current frame of pictures is modified to 1, so that false alarms or repeated alarms can be avoided.
[0088] The above is only a specific embodiment of the present application, but the protection scope of the present application is not limited to this, any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A method for identifying illegally parked vehicles based on YOLOv5, characterized in that, The method includes: Step S1: Collect and parse vehicle parking images to obtain a vehicle parking dataset, and train and deploy a YOLOv5 detection model based on the vehicle parking dataset; Step S2: Configure the system algorithm parameters through the page, call the deployed YOLOv5 detection model according to the configured system algorithm parameters, process the images under the camera, and output the vehicle location information; Step S3: Based on the vehicle position information in the current frame image and the previous frame image, determine whether the vehicle in the current frame image is illegally parked, and output alarm information for illegally parked vehicles; Step S3 includes: Obtain vehicle position information from the current frame image and the previous frame image; set an overlap threshold, and determine whether the positions in the current frame image and the previous frame image are the same based on the vehicle position information from the current frame image and the previous frame image. If the current frame image is at the same position as the previous frame image, the similarity between the vehicles in the two frames is calculated using a perceptual hash algorithm, and the similarity is used to determine whether the vehicles in the two frames are the same vehicle. If the vehicle in the two frames is the same vehicle, the alarm flag bit of the previous frame is assigned to the current frame, and the time when the previous frame was generated is assigned to the time when the current frame was generated. Based on the alarm flag bit and the duration of illegal parking in the current frame, it is determined whether the vehicle in the current frame is illegally parked. If a vehicle in the current frame is determined to be illegally parked, an alarm will be triggered and the alarm flag in the current frame will be changed to 1.
2. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, Step S1 includes: Step S11: Collect images of parked vehicles, clean and label the collected images to obtain a vehicle parking dataset, and divide the vehicle parking dataset into a training dataset and a test dataset according to the proportion. Step S12: Train the YOLOv5 detection model using the training dataset and save the model parameters during the training process; Step S13: Use the test dataset to verify the saved model parameters and obtain the optimized YOLOv5 detection model; Step S14: Deploy the optimized YOLOv5 detection model on the GPU server.
3. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, In step S1, vehicle parking images are collected and parsed to obtain a vehicle parking dataset, including: Images of parked vehicles are captured using surveillance cameras, and invalid images are removed based on their clarity and condition. The labelImg annotation tool is used to annotate the rectangular boxes of vehicles in the parked vehicle images, marking the vehicle type, generating an XML annotation file, and then converting the XML annotation file into a TXT file suitable for the YOLOv5 detection model. Each line in the TXT file represents the information of a vehicle, including the vehicle category, the x-coordinate of the vehicle center point, the y-coordinate of the vehicle center point, the vehicle width, and the vehicle height.
4. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, In step S1, the YOLOv5 detection model is trained and deployed based on the vehicle parking dataset, including: during the training process, the training dataset is expanded using data augmentation methods, such as image rotation, image translation, image flipping, and random image cropping.
5. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, Step S2 includes: Step S21: Configure system algorithm parameters through the page. The system algorithm parameters include: task start time, camera ID, illegal parking duration threshold, vehicle confidence level, and illegal parking area. Step S22: Use the configured system algorithm parameters to call the YOLOv5 detection model deployed in step S1; Step S23: Use the deployed YOLOv5 detection model to detect vehicles in the parked vehicle images whose confidence level is greater than or equal to the set vehicle confidence level; Step S24: Use the deployed YOLOv5 detection model to detect whether the vehicle in step S23 is in the illegal parking area. If the vehicle is in the illegal parking area, initialize the alarm flag to 0 and output the vehicle location information with the initialized alarm flag.
6. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, Set an overlap threshold to determine whether the vehicle positions in the current frame and the previous frame are the same, based on the vehicle position information in the current frame and the previous frame. This includes: Calculate the intersection area and union area of the vehicle bounding boxes labeled in the current frame image and the vehicle bounding boxes labeled in the previous frame image; The ratio of the intersection area to the union area is used as the overlap value. The overlap value is compared with the set overlap threshold. If the overlap value is greater than or equal to the overlap threshold, it is determined that the position in the current frame image and the previous frame image are the same position. If the overlap value is less than the overlap threshold, it is determined that the position in the current frame image and the previous frame image are different positions.
7. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, If the current frame image and the previous frame image are at the same location, the similarity between the vehicles in the two frames is calculated using a perceptual hash algorithm. Based on the similarity, it is determined whether the vehicles in the two frames are the same vehicle, including: Scale the pixels of the current frame image and the previous frame image to 32*32, and obtain 32*32 pixel value matrices for the two frames. Then convert the scaled two frames images into grayscale images. Perform discrete cosine transform on the 32*32 pixel value matrix of the two frames respectively, obtain the corresponding 8*8 matrix from the top left corner of the transformed matrix, stretch the corresponding 8*8 matrix into a 1*64 vector, and calculate the average value of the 64 values in the 1*64 vector respectively. Iterate through each pixel in the current frame's grayscale image, comparing the grayscale value of each pixel with the corresponding average value; iterate through each pixel in the previous frame's grayscale image, comparing the grayscale value of each pixel with the corresponding average value; if the grayscale value of a pixel is greater than the average value, record it as 1, otherwise record it as 0, and obtain the hash value of the two frames of images, which consists of 64 bits of 1 or 0. Calculate the Hamming distance (dist) between the hash values of two grayscale images, and convert the Hamming distance (dist) into a similarity using the following formula: similarity = 1 - dist * 1.0 / 64 In the formula, similarity is the similarity score, and dist is the Hamming distance; A similarity threshold is set. If the similarity is greater than the threshold, the vehicle in the current frame is determined to be the same vehicle as the vehicle in the previous frame. If the similarity is not greater than the threshold, the vehicle in the current frame is determined to be a different vehicle from the vehicle in the previous frame.
8. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, Determine whether a vehicle in the current frame image is illegally parked based on the alarm flag bit and the duration of illegal parking in the current frame image, including: if the alarm flag bit of the current frame image is 0 and the vehicle parking duration is greater than the illegal parking duration threshold, then determine that the vehicle in the current frame image is illegally parked.
9. The vehicle illegal parking identification method based on YOLOv5 according to claim 1, characterized in that, The method includes: repeatedly executing the operation of step S3 during the task start time.
Citation Information
Patent Citations
Motor vehicle illegal parking intelligent identification method and system based on deep learning
CN114648748A