A driving target detection method based on YOLOv5

By combining monocular vision ranging and lane detection with a YOLOv5-based vehicle target detection method, the problem of balancing accuracy and speed in target detection algorithms is solved, achieving efficient and accurate lane and obstacle detection while reducing hardware and labor costs.

CN116311170BActive Publication Date: 2026-03-03NANJING UNIV OF POSTS & TELECOMM
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310455559.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-25
Publication Date
2026-03-03
Estimated Expiration
2043-04-25

AI Technical Summary

Technical Problem

Existing target detection algorithms struggle to balance accuracy and speed. Monocular vision ranging algorithms lack sufficient accuracy in lane detection, and lane detection algorithms also suffer from insufficient adaptability and precision in different environments.

Method used

A driving target detection method based on YOLOv5 is adopted, which combines monocular vision ranging and lane line detection. Through hierarchical feature extraction and unsupervised iterative screening, target detection boxes are generated using YOLOv5 and combined with distance detection algorithms to integrate the multi-target detection results of the road surface.

Benefits of technology

It enables faster and more accurate target recognition in lane detection, simplifies computational complexity, improves the detection capability of dynamic and static obstacles, and reduces hardware requirements and human and material resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116311170B_ABST
    Figure CN116311170B_ABST
Patent Text Reader

Abstract

A driving target detection method based on YOLOv5, the data picture target label is marked, the YOLOv5 code training data set is improved, the corresponding category probability, target confidence and prediction box coordinate are calculated, and the target real-time detection is completed and the detection frame is marked; HSV three channel splitting is carried out, different channel characteristics are combined for region extraction, the feature mask of lane line is completed, then HSV three channels are combined into BGR color space, lane line target is determined through iteration screening, and more accurate mask is obtained through low requirement Canny edge detection and Hough transformation, so that the curvature lane line can be detected; on the strong hypothesis that the object stands on the ground, the lens distortion is corrected by camera calibration, and the camera imaging geometric model is established by using the parameters, the distance is measured by monocular vision; the moving target detection frame is obtained by using YOLOv5, the distance detection algorithm and the lane line detection are combined to complete the road surface target detection software. The method improves the accuracy and real-time performance of detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information technology, and in particular to a vehicle target detection method based on YOLOv5. Background Technology

[0002] With the continuous upgrading of computer equipment and the establishment of large-scale datasets, computer vision and deep learning technologies have developed rapidly, significantly improving the processing speed of image and video data. Computer equipment receives image data and utilizes deep learning algorithms to gain the ability to perceive image content. Currently, the combination of deep learning and computer vision technologies has led to a series of revolutions and new applications, with object detection and recognition becoming key technologies in many applications. The most prominent and important issue in object detection is the balance between recognition speed and accuracy. How to identify an object faster and more accurately has been a long-standing research direction. However, these two conditions are contradictory: increasing accuracy requires increasing algorithm complexity, which significantly increases computation time and reduces algorithm speed. Conversely, increasing recognition speed inevitably reduces accuracy. Therefore, balancing these two factors to create an algorithm that meets the demands of the times is extremely difficult.

[0003] Monocular vision ranging employs a dynamic ranging method. Compared to other ranging instruments on the market, such as microwave radar, lidar, and ultrasonic radar, its data acquisition method is relatively inviolable and less susceptible to external environmental signal propagation. This ranging method uses a visual approach similar to human eye perception, facilitating visualization and stereoscopic representation, and is more convenient and faster. Furthermore, this ranging method has a wide range of applications, particularly in intelligent transportation systems. The main technical challenge of monocular vision ranging lies in the accuracy of the algorithm. How to better map the object relationships in a more accurate three-dimensional coordinate system significantly impacts distance accuracy. If this technology is applied to target recognition in autonomous driving, minimizing the impact of vehicle vibrations on the road surface to maintain consistently high accuracy in distance measurement would be a promising research direction.

[0004] Lane detection is an environmental perception application that aims to detect lane lines using onboard cameras or LiDAR. In recent years, with the development and implementation of computer vision applications, lane detection has gained widespread attention, leading to a series of lane detection methods. The main problems with lane detection algorithms are that lane lines are generally elongated and narrow, requiring robust high- and low-level feature fusion to simultaneously acquire global spatial structural relationships and detailed localization accuracy; the state of lane lines is uncertain, influenced by factors such as occlusion, wear, road discontinuities, and weather conditions (rain, snow). Therefore, the network needs strong reasoning capabilities to handle different situations. Summary of the Invention

[0005] The technical problem this invention aims to solve is that target detection requires a large amount of data for model training, necessitating significant human and material resources for developers and expensive hardware for users. To address this issue, a driving target detection method based on YOLOv5 is proposed, which can integrate various targets to achieve efficient road surface detection. This method utilizes open-source code for real-time target detection and marks them with bounding boxes; it performs hierarchical feature extraction on the entire image and uses unsupervised iterative filtering to determine lane line targets; it employs a monocular vision-based distance measurement algorithm based on the strong assumption that objects are standing on the ground; it uses YOLOv5 to obtain moving target detection boxes, and then uses these boxes as the basis for obtaining a base map for static lane line target detection. Combined with a distance detection algorithm, the results are integrated to obtain the multi-target road surface detection results.

[0006] A driving target detection method based on YOLOv5 includes the following steps:

[0007] Step 1: Real-time detection of the target and marking it with a detection box;

[0008] Step 2: Perform hierarchical feature extraction on the entire image and determine the lane line targets through unsupervised iterative screening;

[0009] Step 3, an algorithm for measuring distance using monocular vision based on the strong assumption that the object is standing on the ground;

[0010] Step 4: Use YOLOv5 to obtain the moving target detection box, then use it as the basis to obtain the base map for static target detection of lane lines, and combine it with the distance detection algorithm to obtain the multi-target detection results of the road surface.

[0011] Furthermore, in step 1, the samples are labeled and trained using an open-source model, including: target labeling of a large number of samples in the dataset, setting the parameters of the training model for different situations, further simplifying the model and improving the training and detection speed; by collecting sample data in various environments, target labeling them and training the corresponding model, and continuously supplementing and modifying the data samples with reference to the Precision, Recall and mAP metrics.

[0012] Further, in step 1, the collected dashcam video is segmented using Python programming; the video is then segmented into images for annotation.

[0013] Determine the labeled categories of the dataset, including pedestrians, bicycles, and speed limit signs;

[0014] The calibrated images are input into the training file provided by YOLOv5. By selecting the corresponding model configuration file, the recognition model file provided by the official system is trained independently and personalized. After obtaining the new model, it is optimized to finally obtain the results of dynamic target detection for vehicles and pedestrians.

[0015] Furthermore, in step 2, the original image pixels are converted from the BGR color space to the HSV color space, and the image is processed and channels are split using cv2 related code to obtain the H hue channel, S saturation channel, and V luminance channel.

[0016] The lane lines are divided into white lane lines and yellow lane lines. The white lane lines are directly extracted from the BGR color space using the Canny function. For the yellow lane lines, the Canny function is used to extract features from the BGR color image of the original image and the S saturation grayscale image in the HSV space. The two extraction results are then XORed. The edges of the yellow lane lines obtained from the S channel and the white lane lines obtained from the original image are superimposed on a black pixel background to obtain a binarized image containing accurate edges of lane lines of different colors.

[0017] Furthermore, in step 2, the Hough function is used to set three parameters, including the minimum number of pixels that make up the line segment, the minimum length of the line segment, and the maximum span between two points in the line segment, to obtain multi-line segment data with more line points, longer length, and moderate span between two line points.

[0018] The multi-segment data is further iterated and filtered based on lane line features, and least squares fitting is performed to obtain a clearer but incomplete main line.

[0019] Furthermore, in step 2, the further iterative screening of multiple line segments uses a Hough function-like processing method. That is, for several line segments whose features have already been extracted once, the slope, orientation, and length of the lines they belong to are further extracted. Several line segments with small slope differences and similar line positions are refitted into the same line segment as the main line. The slope, length, and number are used to determine whether it represents a lane line, thereby eliminating noise.

[0020] Furthermore, the iterative screening process using a Hough function-like approach involves transforming the four parameters (x1, y1, x2, y2) of the two points into three feature parameters: the slope k of the line containing the point (i.e., the angle α formed by the intersection with the X-axis), the distance d from the line to the origin, and the length L of the line segment itself. First, the line segment with the largest absolute slope (the most sloping segment) is selected from many line segments and used as the standard line segment for this iteration to screen all line segments. Then, all line segments with similar slopes and close distances to the origin are selected and fitted to form the main line. The most sloping line in this iteration is closest to the lane line, but further confirmation is needed. The number of similar line segments is used as the criterion; if the number is greater than or equal to a certain threshold, it is confirmed as a lane line. If no similar line segments are found, its length becomes the sole criterion; if the length is long enough, it is considered a lane line; if it is less than the threshold, it is not considered a lane line and is excluded. The next line with the largest slope is then selected as the criterion for the next iteration, until the lane line is determined or all line segments are excluded.

[0021] Furthermore, in step 2, the straight line containing the main line is expanded to obtain a lane line region with a relatively small width. This region is used as a mask to re-perform the original image with a lower-requirement Canny function edge detection to obtain an accurate lane line edge map. Then, the Hough function line feature extraction is performed, setting parameters to detect a number of short lines with few detection points, discontinuous spans, and short line lengths, so as to ensure that all lane lines with a certain curvature are detected.

[0022] Furthermore, in step 3, the depth information of the three-dimensional target is calculated from the two-dimensional image by a strong assumption that the target is on the ground and the camera's height and focal length remain unchanged; set the vehicle A and the vehicle in front B, and use a camera with focal length f and height H to detect the vehicle in front; the actual distance is Z, and the projection of the detection frame's point in the image is y; thus, Z = fH / y is obtained.

[0023] Further, step 3 transforms the two-dimensional information of the image into a three-dimensional model for camera calibration; the three-dimensional scene is reconstructed from the obtained image, and the Zhang Zhengyou checkerboard calibration method is used to obtain the camera's intrinsic parameter matrix A(fx,fy,u,v,f) (the parameters of the intrinsic parameter matrix are: f: focal length, in millimeters; fx and fy are the pixel focal lengths of the x-axis and y-axis, respectively; u and v are the pixel coordinates of the points in the image coordinate system on the x-axis and y-axis, in pixels, with the origin being the top left corner of the image, and the positive directions being the x-axis to the right and the y-axis to the bottom), extrinsic parameter matrix [R|T] (R is a three-row, three-column rotation matrix, and T is a three-row, one-column relative displacement vector), and distortion coefficients [k1,k2,k3,...,p1,p2,...).

[0024] The beneficial effects of this invention are:

[0025] (1) This method utilizes the YOLOv5 algorithm, which is currently a better target detection algorithm. The model trained by this algorithm can identify the pre-defined target object at a faster speed and with higher accuracy.

[0026] (2) Using a distance detection algorithm based on monocular vision and target boxes, the distance relationship between the camera and the detected object in the two-dimensional coordinate system of the image is traced back to the three-dimensional coordinate system by extracting the parameters generated by camera parameter calibration and the pixel coordinates of the target boxes generated by YOLOv5 algorithm. The actual distance can be calculated using a simple three-dimensional coordinate formula. This algorithm is simpler, has lower computational complexity, and is faster.

[0027] (3) This method has better simplicity and faster calculation speed than existing autonomous driving road detection algorithms, enabling better detection of dynamic pedestrians and vehicles as well as static obstacles to achieve better avoidance. Attached Figure Description

[0028] Figure 1 This is a schematic diagram of the detection process in an embodiment of the present invention.

[0029] Figure 2 This is a schematic diagram of the target detection process based on the YOLOv5 algorithm in an embodiment of the present invention.

[0030] Figure 3 This is a flowchart illustrating the implementation scheme of monocular visual ranging in an embodiment of the present invention.

[0031] Figure 4 This is a schematic diagram of the lane line detection algorithm in an embodiment of the present invention.

[0032] Figure 5 This is a schematic table illustrating the data of each channel in the HSV color space in an embodiment of the present invention.

[0033] Figure 6 This is a schematic diagram of point E representing a line in an embodiment of the present invention.

[0034] Figure 7 This is a schematic diagram of point F representing a line in an embodiment of the present invention.

[0035] Figure 8 A schematic diagram illustrating the determination of a straight line between two points in an embodiment of the present invention.

[0036] Figure 9 This is a schematic diagram showing that the three points are not on a straight line in an embodiment of the present invention.

[0037] Figure 10 This is a schematic diagram of converting the rectangular coordinate system to a polar coordinate system in an embodiment of the present invention.

[0038] Figure 11 This is a schematic diagram of the target detection frame generated in an embodiment of the present invention.

[0039] Figure 12 This is a mapping diagram from the side or top view of the vehicle in an embodiment of the present invention.

[0040] Figure 13 This is a mapping diagram with the viewing direction of the front of the vehicle in the embodiment of the present invention. Detailed Implementation

[0041] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings.

[0042] Extract target information that affects vehicle driving conditions from official, online download, and self-shot videos containing lane markings.

[0043] The lane detection technique in this method first converts the video stream from the BGR three-color channel to the HSV color space, and then segments the H, S, and V channels respectively.

[0044] First, examine the image's H tone channel (which has been merged with the adjusted S and V channels into a solid color). From the tone channel, you can see that more saturated and bright objects, such as the orange buildings in the distance, the blue sky, the red billboards, and the green lane dividers, are displayed in the V tone channel. However, grayer and darker objects, such as the road surface and buildings in shadow, are correspondingly "dyed" into red and cyan by the nearby saturated colors. Judging solely by tone is insufficient.

[0045] Combined with the single S-channel GRAY grayscale image, a comparison between the S saturation channel and the original image shows that the more vibrant the color, the more pronounced the white appears. The boundary contrast of the H-channel colors is clearly visible.

[0046] A single-V channel GRAY grayscale image is a simple black and white image, suitable for judging white lane lines.

[0047] In practical applications, the S saturation channel image and the H color channel image are processed together. The Canny edge detection function is used to obtain the clear boundary of S, and then the color feedback of H is used to extract the required color area, such as extracting the yellow lane line.

[0048] Then, the V luminance channel is processed separately using the Canny function to obtain a clear boundary between black and white colors.

[0049] By integrating the image information from both sources, the outline of the lane lines is basically clear, but there is still noise, such as arrows, lane lines that are not in the current lane, and the distant horizon.

[0050] The Hough function is specifically designed for handling straight lines and circles. Its three main parameters are the minimum number of points forming the line, the minimum length of the line, and the maximum span between any two points forming the line. The required lane lines have distinct characteristics: they are significantly longer than typical noise lines, the points are continuous and numerous, and considering the presence of dashed lines, the span is set to a moderate value.

[0051] Due to the complex and varied road conditions, a highly precise mask was not set here, as it would not be well applicable in different situations and might result in the failure to detect necessary lane lines. The initial Hough function analysis reveals a significant amount of noise, and also shows that the same line segment is sometimes drawn as multiple segments.

[0052] When processing several line segments, we first start with the slope of the line on which the line segment is located. It can be seen that the slope of the line closest to the two sides of the car is often the largest in absolute value. This is not accurate, but we can judge the line segments by traversing them from high to low slope, so as to find the line segment that best matches the characteristics of the lane line.

[0053] This involves feature extraction of line segments, and here we will explain the principle of the Hough function, which is specifically used to handle line features.

[0054] The Hough Transform (for lines): Essentially, it's about "reducing lines to points," using a single point to represent a line. For any line j passing through a fixed point D(1,2), a perpendicular line can be drawn from the origin O(0,0) intersecting E. It's easy to see that the locus of E is a circle. In this case, E represents line j, and the entire circle represents all lines passing through D. For example... Figure 6 As shown.

[0055] The same applies to the fixed point F(2,1), such as Figure 7 As shown.

[0056] It is evident that the two circles intersect at a single point except for the origin, which means "two points determine a straight line". The same logic applies to M(3,0). Figure 8 As shown.

[0057] At this point, the three circles intersect at a single point other than the origin, meaning "points D, F, and M are on the same straight line." If they do not intersect at a point other than the origin, then it can be determined that the three points are not on a straight line. Figure 9 As shown.

[0058] The intersection point N represents the same straight line of D, F, and M. The Hough transform converts a line into points. In practical calculations, it's often necessary to determine whether dozens of scattered points lie on a straight line; in this case, the rectangular coordinate system is converted to a polar coordinate system, such as... Figure 10 As shown.

[0059] At the same time, the intersection points are reduced to a range with little difference. If they are within the threshold, they can be considered as a straight line. For example, A and B in the figure are close to each other and can be considered as being on the same straight line.

[0060] Therefore, three features of the line segment need to be considered: two are the angle and distance in the Hough transform, and the other is the length of the line segment. From the initially obtained line segments, a matrix `angle_distance_length` containing these three features is generated. The actual processing involves iterating through this matrix. First, the `angle_distance_length` data of a relatively sloping line segment is obtained from largest to smallest. This is compared with the three features of other line segments. If the angle difference is small and the distance is short, it is considered to be within the "threshold for judging it as the same straight line". These line segments classified as the same line will be subjected to least-squares fitting to obtain the main line segments, referred to as the main lines. Simultaneously, if the number of these line segments considered as the same line reaches a certain amount, they are unlikely to be noise and are retained. At this point, the judgment of the original line segment data ends. However, if these line segments are close to vertical or horizontal, they obviously cannot be lane lines, so they are removed from the original data, and the next relatively sloping line segment is searched for. If only one line is relatively sloping, its length is used for judgment; if it is long enough, it is considered a lane line; if it is relatively short, it is considered noise.

[0061] The result of performing a Hough-like transform on the original data is two main lines, which can be basically considered as lane lines. However, due to the high requirements for judgment, this is not actually comprehensive.

[0062] Sometimes lane lines are not displayed completely. To obtain complete lane lines, the main line is expanded to create a long strip of a certain width, which serves as a mask for accurate lane line detection. Hough then displays all the line segments, resulting in auxiliary line segments, or simply auxiliary lines. The main line and auxiliary lines are then superimposed to obtain the final lane line detection result, thus completing the lane line detection process.

[0063] The target distance detection in this solution is based on monocular vision distance detection, camera imaging principle, YOLOv5 target detection to generate frames, and Zhang Zhengyou's checkerboard calibration method.

[0064] First, the YOLOv5 algorithm is used to generate object detection bounding boxes. Then, the midpoint of the bottom edge of the bounding box is used as the vehicle's position. Figure 11 The position of the label in the text.

[0065] The pixel coordinates are calculated. The reason for choosing this point is that the vehicle is driving on the ground by default, so the distance from this point to the camera's height is fixed. Using this as a reference standard is more helpful in calculating the actual coordinate position in the three-dimensional coordinate system.

[0066] Then, using Zhang Zhengyou's checkerboard calibration method, the camera was used to take multi-angle photos of the checkerboard image. The CameraCalibration function in MATLAB's computer vision processing capabilities was then used to calibrate the camera's intrinsic parameters. After calibration, the two-dimensional coordinates in the image could be converted into a real three-dimensional matrix using a matrix. Based on the pixel coordinates obtained above and the pre-set camera height, the actual positions between objects could be reconstructed proportionally. Figure 12 This is a mapping from the side or top view of the vehicle, with the vehicle's direction of travel as the z-axis. Figure 13 This is a mapping of the viewpoint from the front of the vehicle.

[0067] By mapping the real-world three-dimensional coordinate system, the distance between the detected vehicle and the camera can be calculated using a simple distance calculation formula, i.e., the distance between the two vehicles.

[0068] The YOLOv5s model was trained on a specific dataset. PyQt and OpenCV were combined to use Timer semaphores to display lane line detection, distance detection and object detection together.

[0069] The above description is only a preferred embodiment of the present invention. The scope of protection of the present invention is not limited to the above embodiments. Any equivalent modifications or changes made by those skilled in the art based on the content disclosed in the present invention should be included within the scope of protection set forth in the claims.

Claims

1. A driving target detection method based on YOLOv5, characterized in that: The method includes the following steps: Step 1: Real-time detection of the target and marking it with a detection box; Step 2: Perform layered feature extraction on the entire image and determine lane line targets through unsupervised iterative filtering. During lane line detection, the video stream is first converted from the BGR three-color channel to the HSV color space, and the H, S, and V channels are segmented separately. The S saturation channel image and the H color channel image are processed together, and the Canny edge detection function is used to obtain the clear boundary of S. Then, the required color region is extracted from the color feedback of H. The V brightness channel is processed separately using the Canny function to obtain the clear boundary of black and white. The image information obtained from both aspects is integrated to obtain the outline of the lane line. A Hough-like transform is performed to obtain two main lines on the left and right sides of the lane line. Based on the main lines, the straight lines containing the main lines are expanded to obtain long strips with a certain width, which are used as a mask for accurate lane line detection. The Hough transform then displays all line segments, obtaining auxiliary line segments. The main lines and auxiliary line segments are superimposed to obtain the final lane line detection result. In the Hough transform, three features of a line segment are considered: angle, distance, and length. From the initially obtained line segments, a matrix `angle_distance_length` containing these three features is generated. The actual processing involves iterating through this matrix. First, a relatively slanted line segment's `angle_distance_length` is obtained from largest to smallest. This is then compared with the three features of other line segments. If the angle difference is small and the distance is short, it is considered to be within the threshold for classifying them as the same line. These line segments classified as the same line are then subjected to least-squares fitting to obtain the main line segments, referred to as the principal lines. Simultaneously, if the number of these line segments considered as the same line reaches a certain quantity, they are not considered noise and are retained. At this point, the judgment of the original line segment data ends. If these line segments are close to vertical or horizontal, then remove them from the original data and look for the next line segment that is relatively the steepest; at the same time, if there is only one line that is relatively the steepest, then judge it by its length. If it is long enough, it is considered a lane line; if it is short, it is considered noise. Step 3, an algorithm for measuring distance using monocular vision based on the strong assumption that the object is standing on the ground; Step 4: Use YOLOv5 to obtain the moving target detection box, then use it as the basis to obtain the base map for static target detection of lane lines, and combine it with the distance detection algorithm to obtain the multi-target detection results of the road surface.

2. The vehicle target detection method based on YOLOv5 according to claim 1, characterized in that: In step 1, the samples are labeled and trained using an open-source model, including: target labeling of a large number of samples in the dataset, setting the parameters of the training model for different situations, further simplifying the model and improving the training and detection speed; by collecting sample data in various environments, target labeling them and training the corresponding model, and continuously supplementing and modifying the data samples with reference to the Precision, Recall and mAP metrics.

3. The vehicle target detection method based on YOLOv5 according to claim 2, characterized in that: Step 1 involves using Python programming to cut the collected dashcam videos into segments for annotation. Determine the labeled categories of the dataset, including pedestrians, bicycles, and speed limit signs; The calibrated images are input into the training file provided by YOLOv5. By selecting the corresponding model configuration file, the recognition model file provided by the official system is trained independently and personalized. After obtaining the new model, it is optimized to finally obtain the results of dynamic target detection for vehicles and pedestrians.

4. The vehicle target detection method based on YOLOv5 according to claim 1, characterized in that: In step 2, the original image pixels are converted from the BGR color space to the HSV color space. The image is processed and channels are split using cv2 related code to obtain the H hue channel, S saturation channel, and V luminance channel. Lane lines are divided into white lane lines and yellow lane lines; the white lane lines are directly extracted from the BGR color space using the Canny function. For the yellow lane lines, Canny function features are extracted from the BGR color map and the S-saturation grayscale map in the HSV space of the original image, respectively. The two extraction results are then XORed to form an image. The yellow lane line edges obtained from the S channel and the white lane lines obtained from the original image are superimposed on the black pixel background to obtain a binarized image containing accurate lane line edges of different colors.

5. The vehicle target detection method based on YOLOv5 according to claim 4, characterized in that: In step 2, the Hough function is used to set three parameters, including the minimum number of pixels that make up the line segment, the minimum length of the line segment, and the maximum span between two points in the line segment, to obtain multi-line segment data with more line points, longer length, and moderate span between two line points. The multi-segment data is further iterated and filtered based on lane line features, and least squares fitting is performed to obtain a clearer but incomplete main line.

6. The vehicle target detection method based on YOLOv5 according to claim 5, characterized in that: In step 2, the further iterative screening of multiple line segments uses a Hough function-like processing method. That is, for several line segments whose features have been extracted once, the slope, orientation, and length of the line they belong to are further extracted. Several line segments with small slope differences and similar line positions are refitted into the same line segment as the main line. The slope, length, and quantity are used to determine whether it represents a lane line, thereby eliminating noise.

7. The vehicle target detection method based on YOLOv5 according to claim 6, characterized in that: The specific process of using the Hough function-like iterative screening is as follows: The four parameters (x1, y1, x2, y2) of the coordinates of two points are transformed into three feature parameters: the slope k of the line containing the point (i.e., the angle α formed by the intersection with the X-axis), the distance d of the line from the origin, and the length L of the line segment itself. First, the line segment with the largest absolute slope (the most sloping segment) is selected from many line segments and used as the standard line segment for this iteration to screen all line segments. Then, all line segments with similar slopes and close distances to the origin are selected and fitted to form the main line. The most sloping line in this iteration is closest to the lane line, but further confirmation is needed. The number of similar line segments is used as the judgment criterion; if the number is greater than or equal to a certain threshold, it is confirmed as a lane line. If there are no similar line segments, its length becomes the sole criterion; if the length is long enough, it is considered a lane line; if it is less than the threshold, it is not considered a lane line and is excluded. The next line with the largest slope is selected as the standard for the next iteration, until the lane line is determined or all line segments are excluded.

8. The driving target detection method based on YOLOv5 according to claim 1, characterized in that: In step 2, the straight line containing the main line is expanded to obtain a lane line region with a relatively small width. This region is used as a mask to re-perform Canny function edge detection on the original image to obtain an accurate lane line edge map. Then, Hough function line feature extraction is performed, setting parameters to detect a few short lines with few detection points, short spans, and short line lengths, so as to ensure that all lane lines with a certain curvature are detected.

9. The vehicle target detection method based on YOLOv5 according to claim 1, characterized in that: In step 3, the depth information of the three-dimensional target is calculated from the two-dimensional image based on a strong assumption that the target is on the ground and the camera's height and focal length remain unchanged. Let the car in front be A, and the car in front be B. A camera with focal length f and height H is used to detect the car in front. The actual distance is Z, and the projection of the detection frame point in the image is y. We get Z = fH / y.

10. The driving target detection method based on YOLOv5 according to claim 1, characterized in that: Step 3 transforms the two-dimensional information of the image into a three-dimensional model for camera calibration. The three-dimensional scene is reconstructed from the obtained image, and the Zhang Zhengyou checkerboard calibration method is used to obtain the camera's intrinsic parameter matrix A(fx,fy,u,v,f). The parameters in the intrinsic parameter matrix are as follows: f: focal length, in millimeters; fx and fy are the pixel focal lengths of the x-axis and y-axis, respectively; u and v are the pixel coordinates of the points in the image coordinate system on the x-axis and y-axis, in pixels, with the origin being the top left corner of the image. The positive directions are x-axis to the right and y-axis downwards. The extrinsic parameter matrix is ​​[R|T], where R is a 3x3 rotation matrix, and T is a 3x1 relative displacement vector and distortion coefficients [k1,k2,k3,...,p1,p2,...].

Citation Information

Patent Citations

  • Multi-lane lane line detection method

    CN113239733A