Vehicle detection method and system based on yolov11
By analyzing grayscale gradient changes and constructing closed contours, and combining the YOLOv11 model to filter and adjust vehicle detection results, the problem of detection instability in multi-vehicle overlapping scenarios was solved, and the continuity and accuracy of vehicle detection were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SOUTHWEST JIAOTONG UNIV
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-12
AI Technical Summary
Existing vehicle detection technologies struggle to accurately identify occluded or overlapping vehicles in scenarios with multiple overlapping vehicles, similar colors, or staggered positions. Frequent frame offsets between frames lead to decreased detection continuity, affecting the stability of target tracking and the completeness of quantity determination.
By analyzing grayscale gradient changes to identify gradient intervals at vehicle edges, a closed contour is constructed and target rectangular contours are selected to generate feature-concentrated blocks. Target area values are selected based on edge variation and path density. Overlapping segments are selected using the YOLOv11 model. Vehicle spacing and continuous pixel lines are analyzed to generate clustered region indices. The center point of the vehicle's front is extracted and trajectory coherence groups are selected. Finally, merging and boundary adjustments are performed to generate vehicle detection results.
It improves image boundary stability, target cluster density adaptability, and inter-frame tracking continuity reliability, effectively separates multi-target interference, and maintains the regional structure consistency of detection results.
Smart Images

Figure CN122023904A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of vehicle inspection technology, and more specifically, to a vehicle inspection method and system based on YOLOv11. Background Technology
[0002] Existing vehicle detection technologies perform classification and localization through the overall response of feature maps. Image boundary and contour features are extracted from the backbone layer of the network. They lack preliminary segmentation and screening of local structures at the input stage. Boundaries between regions are uniformly processed, which cannot adapt to scenarios with multiple overlapping vehicles, similar colors, or staggered positions. Insufficient sensitivity to layer changes causes large fluctuations in regional responses, making it difficult to accurately identify occluded overlapping vehicles or targets with unclear boundaries. Inter-frame frame offset occurs frequently. In typical urban traffic scenarios such as lane clustering and high-speed lane changes, the detection continuity is significantly reduced, affecting the stable output of target tracking and the completeness of quantity judgment. Summary of the Invention
[0003] The purpose of this invention is to provide a vehicle detection method and system based on YOLOv11 to improve the aforementioned problems. To achieve this objective, the technical solution adopted by this invention is as follows:
[0004] Firstly, this application provides a vehicle detection method based on YOLOv11, comprising:
[0005] Obtain the pixel matrix of urban road image frames, and identify the gradient range of vehicle body edges by analyzing gray-level gradient changes;
[0006] A closed contour is constructed based on the gradient interval of the vehicle body edge, and a target rectangular contour is obtained by filtering based on geometric conditions; the chromaticity of the color blocks within the target rectangular contour is analyzed to generate feature concentration blocks;
[0007] The target area value is obtained based on the edge variation and path density in the feature set block.
[0008] Based on the ratio of the target area value and the area value of the nearest vehicle frame region given by the YOLOv11 model, overlapping segments are selected.
[0009] Response segments are obtained by analyzing continuous pixel lines in overlapping segments;
[0010] Analyze the vehicle spacing in the response segment and generate a clustering region index based on the analysis results;
[0011] Based on the clustering region index, the center point of the vehicle head is extracted and the offset information between adjacent frames is obtained. Based on the offset information, the trajectory coherence group is filtered to generate continuous trajectory segments of the vehicle.
[0012] Based on continuous vehicle trajectory segments, vehicle detection results are generated by merging and boundary adjustment through analysis of the ratio of lateral offset to longitudinal overlap.
[0013] Secondly, this application also provides a vehicle detection system based on YOLOv11, which includes:
[0014] The first module is used to acquire the pixel matrix of urban road image frames and identify the gradient range of vehicle body edges by analyzing gray-level gradient changes.
[0015] The second module is used to construct a closed contour based on the gradient interval of the vehicle body edge, and to obtain the target rectangular contour by filtering based on geometric conditions; the color intensity of the color blocks within the target rectangular contour is analyzed to generate feature concentration blocks;
[0016] The third module is used to filter based on the edge variation and path density in the feature set blocks, and to obtain the target area value based on the filtering results.
[0017] The fourth module is used to filter out overlapping segments based on the ratio of the target area value to the area value of the nearest vehicle frame region given by the YOLOv11 model.
[0018] The fifth module is used to filter out response segments by analyzing continuous pixel lines in overlapping segments;
[0019] The sixth module is used to analyze the vehicle spacing in the response fragment and generate a clustering region index based on the analysis results;
[0020] The seventh module is used to extract the center point of the vehicle head and obtain the offset information between adjacent frames based on the clustering region index, filter the trajectory coherence groups based on the offset information, and generate continuous trajectory segments of the vehicle.
[0021] The eighth module is used to generate vehicle detection results by analyzing the ratio of lateral offset to longitudinal overlap based on continuous vehicle trajectory segments, performing merging processing and boundary adjustment.
[0022] The beneficial effects of this invention are as follows:
[0023] In this invention, during the image input stage, boundary abrupt change regions are identified through gray-level gradient difference. Image space segmentation is constructed by combining closed contours and color block clustering. Region filtering is performed based on the area overlap ratio and connected path features between layer segments and vehicle body frame regions. Target cluster index is constructed using the degree of overlap of vehicle heads and lateral spacing. Then, continuous moving objects are filtered by the stability of the trajectory offset of the target center point in consecutive frames. Finally, overlapping frame regions are merged based on the stability of horizontal and vertical structural extension to form a continuously distributed target set. This processing logic establishes a filtering and correspondence mechanism between image space segments and target motion states, improving boundary stability, target cluster density adaptability, and the continuous reliability of inter-frame tracking. It effectively separates multi-target interference and maintains the consistency of the regional structure of the detection results.
[0024] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing embodiments of the invention. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 This is a flowchart of a vehicle detection method based on YOLOv11 according to an embodiment of this application;
[0027] Figure 2 This is a flowchart illustrating the process of obtaining feature blocks in the feature set of this invention.
[0028] Figure 3 This is a flowchart illustrating the process of obtaining the response fragment of the present invention;
[0029] Figure 4 This is a flowchart illustrating the process of obtaining the clustered region index in this invention.
[0030] Figure 5 This is a flowchart illustrating the process of acquiring continuous trajectory segments of a vehicle according to the present invention.
[0031] Figure 6 This is a flowchart illustrating the process of obtaining vehicle detection results according to the present invention. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0033] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0034] Ultrasonic guided waves are widely recognized as one of the most promising technologies for rapid inspection and health monitoring of large structures due to their unique advantages such as long propagation distance and sensitivity to minute defects. Existing research shows that the unique geometric features of butt welds can form waveguide structures, allowing energy trapping mechanisms to act on the weld region, resulting in characteristic guided waves propagating along the weld length. Shear-type guided waves in butt welds exhibit non-leakage characteristics due to their lowest phase velocity across most frequency bands, while compression-type waves are only non-leakage in the low-frequency band. Therefore, shear-type guided waves, with their excellent energy localization capabilities, are the ideal mode for weld defect detection. However, in engineering, guided waves from thick plate butt welds (with substrate thickness often greater than 10 mm) exhibit strong multimodal characteristics. This not only makes it difficult to effectively excite single-mode SHO-like waves, but also, after the SHO-like waves interact with defects, some energy is easily converted into higher-order modes, resulting in complex signals and difficulties in analysis. Therefore, there is an urgent need to develop advanced detection technologies and signal identification methods to achieve guided wave detection without a reference signal.
[0035] Example 1
[0036] See Figure 1 This embodiment provides a vehicle detection method based on YOLOv11, including steps S100, S200, S300, S400, S500, S600, S700 and S800.
[0037] S100. Obtain the pixel matrix of urban road image frames, and identify the gradient interval of vehicle body edges by analyzing gray-level gradient changes; specifically as follows:
[0038] S110. For each pixel, extract the gray value and perform a horizontal difference operation to obtain the gradient change matrix of the pixel.
[0039] To obtain the pixel matrix of the vehicle driving area in an urban road image frame, for example, acquire an image frame with a resolution of 1920x1080 pixels. First, process the pixel data within the rectangular area designated as the vehicle driving area, starting from the top left corner (300, 400) and ending at the bottom right corner (1800, 900). For each pixel position within this area, for example, the pixel with coordinates (501, 602), extract its 8-bit grayscale value, denoted as . ,in , Its grayscale value It then retrieves the grayscale value of the pixel (501, 603) at the same horizontal position in the next vertically adjacent row. ;
[0040] Perform a lateral difference operation, which calculates the grayscale value of the pixel and its right-hand neighbor (502, 602). The difference, and the grayscale values of the corresponding pixel (501, 603) in the next row and its right-side adjacent pixel (502, 603). The difference is used to obtain two difference values. and Next, calculate the absolute value of the difference between the horizontal differences between these two vertically adjacent rows, that is... After performing this operation on all pixels within the entire vehicle driving area, a gradient change value matrix is obtained.
[0041] S120. For each row in the gradient change value matrix, determine whether the mean of that row is greater than the preset gradient activation value. If so, obtain the continuous difference interval.
[0042] For example, the gradient change values of 151 consecutive pixels from (500, 610) to (650, 610) constitute a sequence. If the mean value is greater than the preset gradient activation value of 15, then they are aggregated into a continuous difference interval.
[0043] S130. Determine whether the gray-level gradient change trend within the continuous difference interval conforms to the preset vehicle body edge change pattern, and obtain the pattern selection result.
[0044] The vehicle body edge change pattern is defined as a gradient value that is low at both ends of the interval, monotonically increases towards the center of the interval to a peak value, and then monotonically decreases. The difference between the peak value and the mean at both ends is greater than 5. In this example, the peak value of the sequence is 28, and the values at both ends are 18 and 19, which conforms to this pattern.
[0045] S140. Based on the noise region in the pixel grayscale removal mode filtering results, obtain the vehicle body edge gradient interval.
[0046] A pixel grayscale uniformity index is added to the calculation area. This index is obtained by the ratio of the standard deviation to the mean of all pixel grayscale values in the calculation area. For example, in a noise area with coordinates ranging from (800, 500) to (820, 520), the pixel grayscale mean is 130 and the standard deviation is 35. The calculated grayscale uniformity index is 35 / 130 = 0.269. The grayscale uniformity threshold is set to 0.2. This threshold is set by statistically analyzing the grayscale uniformity of 1000 images containing typical noise areas such as road surfaces, tree shadows, and building shadows, and taking the 80th percentile of the distribution as the threshold. Since the calculated index of 0.269 is higher than the threshold of 0.2, the area is judged as a noise area and excluded from subsequent processing. Conversely, for the previously identified interval with a length of 151 pixels, the calculated grayscale uniformity index is 0.08, which is lower than the grayscale uniformity threshold of 0.2, so it is retained. Finally, multiple gradient intervals that meet the conditions are identified in the image frame.
[0047] S200. Construct a closed contour based on the gradient interval of the vehicle body edge, and obtain the target rectangular contour by filtering based on geometric conditions; analyze the chromaticity of the color blocks within the target rectangular contour to generate feature concentration blocks; as follows:
[0048] S210. By connecting the gradient intervals of the vehicle body edge, a closed contour is generated, and the ratio of the area to the perimeter of the closed contour is calculated.
[0049] Based on the gradient interval values of the vehicle body edges, the set of boundary pixel coordinates of all intervals that can form a closed contour in the image is extracted. For example, by connecting four identified edge gradient intervals, a closed polygonal contour is formed, and the coordinates of all boundary pixels of this contour are recorded in a set. Among them This represents the total number of boundary pixels, i.e., the perimeter. At this point, these contours may overlap because vehicles or other objects in the image may share edges or overlap, requiring further reduction of interference caused by overlap.
[0050] Assuming the total number of boundary pixels of a contour The perimeter of this area is 420 pixels. The area of the region is obtained by counting all the pixels within the contour. Each pixel unit is used to calculate the ratio of the area to the perimeter of the region. The specific calculation method is as follows: After substituting the values, it becomes .
[0051] S220. Calculate the matching coefficient between the ratio value and the preset horizontal straightness index, and filter the target rectangle outline according to the matching coefficient.
[0052] Compare the ratio value with the lateral straightness index, the lateral straightness index Defined as the ratio of the width of the smallest bounding rectangle of the contour to the maximum horizontal span of the contour itself. For the current contour, its leftmost coordinate in the horizontal direction is... The rightmost coordinate is The maximum span is 150, and the minimum width of its bounding rectangle is also 150, therefore the horizontal straightness index... Finally, the ratio value With lateral straightness index Matching coefficient The matching coefficient is calculated as follows: ,in The ratio of the area to the perimeter of a standard rectangle is theoretically close to 1; here we take 0.95. The rectangular detection range is set to This range is determined by analyzing 5000 labeled rectangular vehicle outlines in the dataset. The value is calculated based on the distribution of 98% of the samples, determined by the calculated matching coefficient. Since it falls within this range, the contour is filtered out and retained.
[0053] S230. Within the chromaticity range of the main color blocks within the target rectangular outline, calculate the chromaticity value of each main color block and determine the chromaticity difference between any two color blocks. Color blocks whose chromaticity difference is within the chromaticity clustering threshold are marked as belonging to the same class, generating feature-concentrated blocks, such as... Figure 2 As shown;
[0054] Perform statistical analysis of the pixel distribution range of the main color block. As an example, this step uses the K-Means clustering algorithm to cluster the pixels within the region by color, setting the number of clusters. This yields three main color blocks, which are labeled as follows: And calculate the pixel distribution range covered by each main color block, for example... Primarily located in the upper half of the area, representing car windows, they are darker in color and have 3800 pixels. Primarily located in the lower middle part of the area, representing the car body, it is silver-gray in color and has 7250 pixels. For the headlight area, the color is yellowish, and the number of pixels is 500. Next, the chromaticity value of each main color block is calculated. In the CIELAB color space, the average color of all pixels within each color block is calculated as the chromaticity value of that color block. chromaticity value , chromaticity value ,as well as chromaticity value Then, the chromaticity difference between any two color patches is calculated. This difference is calculated using the CIEDE2000 color difference formula and denoted as . Calculations yielded and Color difference , and Color difference , and Color difference The chromaticity clustering threshold was set to 25.0, which was determined with reference to industrial color quality control standards. It is generally considered that... This refers to significant differences visible to the naked eye. To ensure that different components such as the car body, windows, and lights can be effectively distinguished, while allowing for a certain range of color gradation, color difference statistics were performed on different functional areas of 1000 sets of vehicle images. It was found that the color difference value within the main body color of the car body is usually less than 20, while the color difference value between different components is usually greater than 30. Therefore, 25.0 was taken as a threshold that balances discriminability and robustness. The calculated color difference was compared with this threshold. Since all the calculated color difference values 54.2, 68.5, and 45.1 are greater than the color clustering threshold of 25.0, these three color blocks are not labeled as the same category and are treated as independent categories. Finally, three color blocks with category labels and distribution range information were obtained, generating feature set blocks.
[0055] S300. Based on the edge variation and path density in the feature set block, the target area value is obtained based on the filtering results.
[0056] S310. Calculate the edge variation and path density of the feature set block. The edge variation is the number of vehicle edge gradient intervals it contains. The path density is obtained by dividing the total length of all contours in the feature set block by the coverage area of the feature set block.
[0057] Assuming a block group contains 3 vehicle edge gradient intervals, its edge variation count is 3. For a block group with a coverage area of 11550 pixels and an internal outline with a total length of 420 pixels, its density coefficient is... ;
[0058] S320. By comparing the edge change amount with the edge change threshold and the path density with the path density threshold, the target feature concentration block is obtained through screening.
[0059] The system identifies regions where both the number of edge variations exceeds the edge variation threshold and the contour path density coefficient exceeds the density threshold, thus targeting concentrated feature blocks. For example, the edge variation threshold is set to 2, and the contour path density threshold is set to 0.03. These thresholds are determined based on the analysis of features from 2000 vehicle samples and 2000 non-vehicle samples (such as buildings and billboards). Vehicle samples typically have at least three clear edges (left, right, top, or bottom), and their contours are relatively concentrated, with density coefficients ranging from 0.03 to 0.1. Non-vehicle samples, on the other hand, have more dispersed values for these two indicators. Selecting these thresholds effectively filters out over 90% of non-vehicle samples. Since the current block group has an edge variation number of 3 greater than threshold 2, and a density coefficient of 0.036 greater than threshold 0.03, the region is successfully located.
[0060] S330. Calculate the area of the target feature concentration block to obtain the target area value.
[0061] Extract the layer fragments corresponding to the blocks in the target feature set, and record their coverage area value in pixels. In this example, the value is 11550, thus obtaining the target area value.
[0062] S400. Based on the ratio of the target area value and the area value of the nearest vehicle frame region given by the YOLOv11 model, the overlapping segments are selected.
[0063] After obtaining the coverage area value of 11550, the area value of the vehicle body bounding box region that is spatially closest to this region, predicted by the initial detection model (YOLOv11), is called. Assuming that for the current segment, the closest vehicle body bounding box is a 160x80 pixel rectangle, its area value is... Pixels, then calculate the area ratio of each segment, that is, the ratio of the target area value to the area value of the vehicle frame region. , calculated as The area of the vehicle body frame is compared with the size similarity coefficient, which is a desired ratio range derived from the statistical analysis of the vehicle's image size at different distances. This coefficient is set as a function that varies with distance, but in the current fixed scene and distance, its value is a constant, set to 0.95. The process of obtaining this coefficient is as follows: In a specific monitoring scene, videos of 100 different models of cars passing through a standard driving lane are collected. The actual outline of the vehicles and the smallest rectangle that can surround the vehicle body are manually and accurately marked. The ratio of the areas of the two is calculated, and the average value of 0.95 is taken as the size similarity coefficient for the scene. Then, the absolute value of the difference between the area ratio and the size similarity coefficient is calculated. The overlap determination threshold is set to 0.10. This threshold is obtained by statistically analyzing the difference between the area ratio value and the similarity coefficient of the above 100 vehicles and taking the 95th percentile of its distribution. Since the calculated difference of 0.048 is less than the overlap determination threshold of 0.10, the segment is marked as an overlap segment. After performing this operation on all layer segments, the total number of all marked segments is counted.
[0064] S500: By analyzing the continuous pixel lines in overlapping segments, response segments are obtained through filtering, such as... Figure 3 As shown, the details are as follows:
[0065] S510. Extract the minimum segment length value of the horizontal continuous pixel line in each overlapping segment, and determine whether the length value is greater than the continuous length threshold. If so, the length filtering result is obtained.
[0066] Within the overlapping segment region, the system scans line by line to identify pixel segments with continuous color and brightness (color component difference less than 5, brightness difference less than 10). The length of each segment is recorded, and the shortest segment is identified. For example, if an overlapping segment contains multiple horizontally continuous pixel lines, the shortest one is located in the highlight area of the roof, with a length of 45 pixels (45 pixels). This minimum segment length is then determined to be greater than the continuity length threshold. This threshold is based on the typical minimum visible width of a vehicle in an image. For an image with a width of 1920 pixels, the minimum width of a vehicle is usually no less than 40 pixels, so the threshold is set to 40. This value is determined by statistically analyzing the pixel widths of 10,000 vehicle samples at the furthest shooting distance, taking the minimum value, and multiplying it by a correction factor of 0.9. Segments with a minimum segment length greater than the continuity length threshold are then selected.
[0067] S520. For the length filtering results, calculate the number of vertical endpoints and the number of continuous trajectories within the overlapping segments. The number of vertical endpoints is the number of horizontally continuous pixel lines terminating on the vertical edge of the segment, and the number of continuous trajectories is the number of independent and continuous pixel lines within the segment.
[0068] The number of vertical endpoints refers to the number of horizontally continuous pixel lines terminating at the vertical edge of a segment. Assuming the left edge has 30 endpoints and the right edge has 32 endpoints, the total is 62. The number of endpoints on the left edge is expressed as... The number of right edge endpoints is represented as ;
[0069] The number of continuous trajectories refers to the number of independent, uninterrupted pixel connections within a segment, running from left to right or right to left. Assuming there are 58, the number of continuous trajectories is expressed as... ;
[0070] S530. Calculate the matching coefficient between the number of continuous trajectories and the number of longitudinal endpoints, and filter out overlapping segments with matching coefficients higher than the preset trajectory integrity threshold to obtain response segments.
[0071] Calculate the matching coefficient between the number of continuous trajectories and the number of longitudinal endpoints. The calculation method is as follows Substitute the value as The trajectory integrity threshold was set to 0.8. This threshold was derived from a comparative experiment on the matching coefficients of complete vehicle images and occluded vehicle images. The coefficient for complete vehicles is usually greater than 0.8, while that for occluded or incomplete vehicles is usually less than this value. Since the calculated matching coefficient of 1.87 is higher than the trajectory integrity threshold of 0.8, the overlapping segment is marked as a response segment.
[0072] S600: Analyze the vehicle spacing in the response segment and generate a clustered region index based on the analysis results, such as... Figure 4 As shown;
[0073] S610. Divide the response segment into equal intervals according to the pixel coordinate values in the horizontal direction of the image frame, and detect the vertical coordinate range of the vehicle front marker point in each divided area.
[0074] The response segment is divided into equidistant regions based on the pixel coordinates in the horizontal direction of the original image frame. For example, if the horizontal width of the image frame is 1920 pixels, it is divided into 10 regions, each 192 pixels wide, denoted as... Next, it detects whether there are front-end markers within each segmented region. These markers are obtained by identifying small patches of image within the region using a lightweight classifier specifically trained to recognize features such as headlights and grilles. Two vehicle front markers were detected in the area. and ,exist A vehicle front marker was detected in the area. Then obtain the vertical coordinate range of these marker points, for example... The longitudinal range is , The longitudinal range is , The longitudinal range is ;
[0075] S620. Calculate the overlap ratio of the longitudinal coordinate range of the vehicle front marker points between adjacent areas, and compare the overlap ratio with the area width difference coefficient to filter out the overlapping block set.
[0076] Calculate adjacent regions, i.e. and Between the two regions, the overlap ratio of the longitudinal positions of the marker points on the front of the vehicle is defined as the maximum value of the ratio of the overlap length between all pairs of marker points in the two regions to the length of the shortest marker point interval. and Its longitudinal overlap length is The length is 20, and the overlap ratio is This overlap ratio value was compared with the upper limit coefficient of the area width difference. This coefficient, designed to quantify the normal variation in vehicle size between adjacent areas due to perspective effects, was set to 0.7. This coefficient was based on a statistical analysis of the vertical size changes of vehicles traveling in a straight line across equally divided areas in urban road surveillance videos, using the 90th percentile of the rate of change. Since the calculated overlap ratio value of 0.8 exceeded the comparison coefficient of 0.7, it was... and These two regions are filtered out to generate an overlapping block set.
[0077] S630. Calculate the average lateral spacing between the front ends of each vehicle in the overlapping block set. By comparing the range of the ratio of the average lateral spacing to the average width of the region, the spacing filtering blocks are obtained.
[0078] For containing and The overlapping block set is used to count the number of vehicles within each block. This vehicle count is determined based on the number of response region segments identified within the block. For example, in... There are two such segments inside. If there is 1, then The number of vehicles is 2. The number of vehicles is 1, forming a block containing multiple vehicles. The total number of vehicles in the block is 3. Then, the average lateral spacing between the front of each vehicle in the block is calculated. The position of the front of the vehicle is determined by the position of the front marker point.
[0079] The horizontal coordinate is , The horizontal coordinate is , The horizontal coordinate is The horizontal spacing includes Pixels, and and Distance between (across regions) pixels, with a mean of Pixels, then compare the average horizontal spacing distance with the ratio range of the average width of the region. The average width of the region is the width of the divided region, 192 pixels, and the ratio range is set to... The range is set based on the following: the lower limit of 0.2 aims to exclude situations where a single large vehicle (such as a bus) is mistakenly identified as multiple adjacent smaller vehicles, where the spacing between its internal components (such as windows) is much less than 0.2 times the vehicle width; the upper limit of 2.5 aims to exclude vehicles that are too far apart and do not belong to the same traffic cluster. This range was derived through statistical analysis of the ratio of vehicle spacing to lane width under 1000 different traffic congestion conditions, calculating the ratio of the current average spacing to the average width of the area. Since 0.547 is within the ratio range Within this range, but for the purpose of demonstrating the filtering operation, we assume here that the calculated result of another block is 25 pixels, and its ratio is... If the ratio is lower than the lower limit of 0.2, the block will be filtered out, while the block with the current value of 0.547 will be filtered and retained, generating interval filtered blocks.
[0080] S640. Record the position index of each interval filtering block in the original image frame, establish a position index table according to the sequence order of horizontal equidistant division, and generate a clustered region index.
[0081] Based on the generated interval-filtered block set, this set contains, for example, The system constructs blocks that meet certain conditions, and records the position index of each such block in the original image frame. The position index is defined by its start and end horizontal coordinates, for example, by... and The constructed blocks cover horizontally from starting coordinates arrive End coordinates The range, that is Simultaneously, its vertical coverage area is recorded, determined by the boundaries of all vehicles within the block, assuming it is... The location index of this block is formed. Then, according to the horizontally divided sequence order, that is... In the order of detection, a location index table is established, which records the location information of all the clustered areas that pass the filtering. This index table is used as the clustered area location result of the detection output, as shown in Table 1 below.
[0082] Table 1: Index of Cluster Locations in the Detection Area
[0083]
[0084] As shown in Table 1, the table lists the location index information of the two finally determined vehicle cluster areas. The area with index number 1 is the example area calculated in detail in the previous steps, and the area with index number 2 is another vehicle cluster area in the image that meets the conditions. The generation of this location index table is the process of generating the detection area cluster location index.
[0085] S700: Based on the clustering region index, extract the center point of the vehicle's front and obtain the offset information between adjacent frames. Based on the offset information, filter trajectory coherence groups and generate continuous vehicle trajectory segments, such as... Figure 5 As shown;
[0086] S710. Based on the region corresponding to the aggregation region index, extract the vehicle bounding box region in the continuous frame image, obtain the center point coordinates of the vehicle bounding box region in the image, and calculate the horizontal offset length of the center point coordinates between adjacent frames.
[0087] For example, based on the region with index number 1, extract three consecutive frames of images (denoted as...). For all vehicle front bounding boxes within the region, for a specific vehicle identified within the region, obtain the spatial center coordinates of the vehicle front bounding box region in the image for three consecutive frames;
[0088] Assume the center point coordinates of the vehicle in the three frames are as follows: , , Then, according to time frames The center points of the vehicle are sorted in this order, and then the horizontal offset length of the center points between adjacent time frames is calculated from the frame. to frame The horizontal offset length is Pixels, from frames to frame The horizontal offset length is For each pixel, this calculation is performed on all vehicles within the area, generating a set of vehicle horizontal offset length values;
[0089] S720. Compare each offset length with the upper and lower limit coefficients of the lateral change reference range to obtain the initial vehicle trajectory.
[0090] Based on the generated vehicle horizontal offset length values, for example, the offset length sequence of a certain vehicle is... Each offset length is compared with the upper and lower limit coefficients of the lateral variation reference range, which is designed to define the inter-frame displacement of a normally moving vehicle. The upper limit prevents non-vehicle objects moving in the background or vehicles that suddenly cut in from being misjudged as continuous trajectories, while the lower limit excludes almost stationary objects.
[0091] The upper and lower limits of this reference range were set by statistical analysis of inter-frame displacement data from 10,000 normally driving vehicles. Pixels / frame, i.e., the upper limit coefficient is 30 and the lower limit coefficient is 3. Since the offset lengths of 10 and 9 are both within this range, the vehicle trajectory is initially screened and retained.
[0092] S730. Extract the area value sequence of the vehicle bounding box region in the corresponding continuous frame of the initially screened vehicle trajectory, calculate the trend stability coefficient of the area value sequence in one direction, filter the trajectory coherence group based on the trend stability coefficient, record the spatial distribution data of all vehicle trajectories in the group, and generate continuous vehicle trajectory segments.
[0093] As an example, the sequence of region area values for the initially screened vehicle trajectories within three frames is extracted. Let the corresponding vehicle bounding area areas be... , , The pixel is then used to calculate the trend stability coefficient of that area value in a single direction. The area change is calculated by dividing the number of changes with the same sign (all positive or all negative) in the area change sequence by the total number of changes minus one. and Since both changes were positive, the trend stability coefficient was [value missing]. A coefficient of 1.0 indicates that the area change is monotonic (continuously increasing or decreasing). If the area first increases and then decreases, the coefficient is 0.
[0094] Based on the generated trend stability coefficient, for example, if the trend stability coefficient of a vehicle trajectory is 1.0, this coefficient is compared with the trajectory coherence determination threshold, which is set to 0.9. This threshold is determined experimentally based on 1000 real vehicle trajectories and 1000 false trajectories caused by target loss and mismatch. After calculation, it was found that over 95% of the actual trajectories were... The value is equal to 1.0 (because vehicles typically approach or leave continuously, with the area changing unidirectionally), while over 90% of false trajectories... Since the value is 0, 0.9 is chosen as the judgment threshold. Because the calculated stability coefficient of 1.0 is higher than the trajectory continuity judgment threshold of 0.9, the vehicle trajectory is assigned to the corresponding target group, such as "Target Group 1". The spatial distribution data set of all vehicle trajectories assigned to this group is recorded. This data set includes the center point coordinate sequence and bounding box size sequence of each trajectory in three consecutive frames. For example, Group 1 contains the data for trajectory A. Including data from trajectory B, etc., to generate continuous trajectory segments of the vehicle.
[0095] S800, based on continuous vehicle trajectory segments, performs merging and boundary adjustment by analyzing the ratio of lateral offset to longitudinal overlap to generate vehicle detection results, such as... Figure 6 As shown;
[0096] S810. Based on the set of trajectory coordinates in the continuous trajectory segments of the vehicle, calculate the total offset length of each trajectory in the horizontal direction, and calculate the boundary overlap ratio of the trajectory in the vertical direction in the continuous frames. Generate trajectory stability results by performing threshold judgment.
[0097] Based on the set of trajectory coordinates in continuous vehicle trajectory segments, such as trajectory A in "Target Group 1", whose center point coordinate sequence is 545,632,555,632,564,633, calculate the total horizontal offset of this trajectory, which is the absolute value of the horizontal coordinate difference from the first frame to the last frame. Pixel;
[0098] To calculate the vertical overlap ratio, first obtain the vertical boundary range of the vehicle frame in the three frames. Assume that the vertical ranges of the three frames can be calculated from the center point and dimensions as follows: Then the vertical intersection of the three frames is The length is 76, and the vertical union of the three frames is... The length is 79, and the overlap ratio is... The calculation is the intersection length divided by the union length. Then, a joint comparison operation is performed on the total offset length value of 19 and the vertical overlap ratio value of 0.962. This operation is defined as a logical judgment: ,in Set to 50 pixels. The thresholds were set to 0.85. These two thresholds were obtained based on statistical analysis of the trajectory characteristics of stable-moving vehicles, because... and Therefore, the result of the joint comparison is true, indicating that the region has preliminary stability, and the trajectory stability result is generated;
[0099] S820. Based on the trajectory stability results, select the target areas in continuous frames where the lateral change amplitude is lower than the average span difference coefficient and the longitudinal boundary difference fluctuation range is smaller than the structural extension coefficient.
[0100] For trajectories with a trajectory stability result of "true", target regions are selected where the lateral variation amplitude in consecutive frames is lower than the lower limit coefficient of the average span difference and the fluctuation range of the vertical boundary difference is less than the structural extension requirement coefficient. The lateral variation amplitude is the amount of change in the frame width between adjacent frames. Assuming the frame widths of the three frames are 150, 151, and 152 respectively, with variations of 1 and 1, the average span (average width) is 151, and the lower limit coefficient of the average span difference is set to 0.05, meaning the difference cannot exceed [a certain value]. For pixels, the current change of 1 satisfies this condition. The fluctuation range of the vertical boundary difference is measured by calculating the standard deviation of the upper and lower boundary coordinates over three frames. Assuming the upper boundary coordinates are... The standard deviation is 0.47, and the lower boundary coordinates are... The standard deviation is 0.94, and the structural extension requirement coefficient is set to 2.0 pixels. This coefficient is intended to limit the "breathing effect" or jitter of the vehicle frame. The standard deviation of the boundary jitter of the stable detection frame is statistically analyzed, and its 95th percentile is used. Since 0.47 and 0.94 are both less than 2.0, the trajectory meets all the conditions and becomes a stable target area.
[0101] S830. Perform a position merge operation on the target area to merge the coordinate sets of adjacent areas and generate a merged area coordinate set.
[0102] Perform position merging operation on all stable target regions. If the intersection-over-union (IoU) ratio of the bounding boxes of two stable target regions in the last frame is greater than 0.9, then merge their trajectory coordinate sets. For example, calculate the new center point and bounding box by weighted averaging to generate the merged region coordinate set.
[0103] S840: Adjust the upper and lower boundary lines of the merged region based on the coordinate set of the merged region, output the data set of the adjusted region, and generate vehicle detection results.
[0104] Based on the merged region coordinate set, the positions of the upper and lower boundary lines of the merged region are adjusted. Specifically, the upper and lower boundary y-coordinates of the merged trajectory are extracted across all time frames. The minimum value is taken as the final unified upper boundary, and the maximum value is taken as the final unified lower boundary. This ensures that the adjusted boundary lines maintain a fixed span throughout the time series. For example, for a merged trajectory, if the minimum upper boundary y-coordinate across all frames is 593 and the maximum lower boundary y-coordinate is 672, then the adjusted unified boundary is... It outputs the data set of the corresponding detection target combination to obtain the vehicle detection result.
[0105] Optionally, a refinement step can be added before the output: calculate the time series span consistency coefficient for each combination of detected targets within the set. This coefficient is defined as the ratio of the standard deviation to the mean of the bounding box width and height of the target in consecutive frames (i.e., the coefficient of variation). For example, the width sequence of a target is... The mean is 151, the standard deviation is 0.816, and the width consistency coefficient is... The span consistency judgment threshold is set to 0.03. This threshold is set by statistically analyzing the span consistency coefficients of 1000 final correct detection results and taking the 98th percentile. Since the calculated coefficient of 0.0054 is lower than the threshold of 0.03, the detection target combination is retained. Conversely, if the calculated coefficient of a target is 0.04, the target will be removed from the final output results. After this operation, the detection target combination that meets the time span stability requirements is output, generating a set of vehicle stability detection results.
[0106] Example 2
[0107] This embodiment provides a vehicle detection system based on YOLOv11, including:
[0108] The first module is used to acquire the pixel matrix of urban road image frames and identify the gradient range of vehicle body edges by analyzing gray-level gradient changes.
[0109] The second module is used to construct a closed contour based on the gradient interval of the vehicle body edge, and to obtain the target rectangular contour by filtering based on geometric conditions; the color intensity of the color blocks within the target rectangular contour is analyzed to generate feature concentration blocks;
[0110] The third module is used to filter based on the edge variation and path density in the feature set blocks, and to obtain the target area value based on the filtering results.
[0111] The fourth module is used to filter out overlapping segments based on the ratio of the target area value to the area value of the nearest vehicle frame region given by the YOLOv11 model.
[0112] The fifth module is used to filter out response segments by analyzing continuous pixel lines in overlapping segments;
[0113] The sixth module is used to analyze the vehicle spacing in the response fragment and generate a clustering region index based on the analysis results;
[0114] The seventh module is used to extract the center point of the vehicle head and obtain the offset information between adjacent frames based on the clustering region index, filter the trajectory coherence groups based on the offset information, and generate continuous trajectory segments of the vehicle.
[0115] The eighth module is used to generate vehicle detection results by analyzing the ratio of lateral offset to longitudinal overlap based on continuous vehicle trajectory segments, performing merging processing and boundary adjustment.
[0116] As an optional implementation, the first module includes:
[0117] The first unit is used to extract the grayscale value of each pixel and perform a horizontal difference operation to obtain the gradient change value matrix of the pixel.
[0118] The second unit is used to determine whether the mean value of each row in the gradient change value matrix is greater than the preset gradient activation value. If so, a continuous difference interval is obtained.
[0119] The third unit is used to determine whether the gray-level gradient change trend in the continuous difference interval conforms to the preset vehicle body edge change pattern, and to obtain the pattern filtering result.
[0120] The fourth unit is used to filter out noise regions in the results based on the pixel grayscale removal mode to obtain the gradient interval of the vehicle edge.
[0121] Example 3
[0122] Corresponding to the above method embodiments, this embodiment also provides a vehicle detection device based on YOLOv11. The vehicle detection device based on YOLOv11 described below can be referred to in correspondence with the vehicle detection method based on YOLOv11 described above.
[0123] The YOLOv11-based vehicle detection device includes a processor and a memory. The device may also include one or more of the following: multimedia components, input / output (I / O) interfaces, and communication components. The processor controls the overall operation of the YOLOv11-based vehicle detection device to complete all or part of the steps in the aforementioned YOLOv11-based vehicle detection method. The memory stores various types of data to support the operation of the device, including, for example, commands for any application or method operating on the device, and application-related data such as contact data, sent and received messages, images, audio, video, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0124] Multimedia components may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals.
[0125] The received audio signals can be further stored in memory or transmitted via a communication component. The audio component also includes at least one speaker for outputting audio signals. The I / O interface provides an interface between the processor and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons can be virtual or physical. The communication component is used for wired or wireless communication between the YOLOv11-based vehicle detection device and other devices. Wireless communication methods include Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination thereof; therefore, the corresponding communication component may include a Wi-Fi module, a Bluetooth module, and an NFC module.
[0126] Example 4
[0127] Corresponding to the above embodiment of the vehicle detection method based on YOLOv11, this embodiment also provides a readable storage medium. The readable storage medium described below can be referred to in conjunction with the vehicle detection method based on YOLOv11 described above.
[0128] A readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described embodiment of the vehicle detection method based on YOLOv11.
[0129] Specifically, the readable storage medium can be a USB flash drive, external hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk, or any other readable storage medium capable of storing program code.
[0130] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0131] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A vehicle detection method based on YOLOv11, characterized in that, include: Obtain the pixel matrix of urban road image frames, and identify the gradient range of vehicle body edges by analyzing gray-level gradient changes; A closed contour is constructed based on the gradient interval of the vehicle body edge, and a target rectangular contour is obtained by filtering based on geometric conditions; the chromaticity of the color blocks within the target rectangular contour is analyzed to generate feature concentration blocks; The target area value is obtained based on the edge variation and path density in the feature set block. Based on the ratio of the target area value and the area value of the nearest vehicle frame region given by the YOLOv11 model, overlapping segments are selected. Response segments are obtained by analyzing continuous pixel lines in overlapping segments; Analyze the vehicle spacing in the response segment and generate a clustering region index based on the analysis results; Based on the clustering region index, the center point of the vehicle head is extracted and the offset information between adjacent frames is obtained. Based on the offset information, the trajectory coherence group is filtered to generate continuous trajectory segments of the vehicle. Based on continuous vehicle trajectory segments, vehicle detection results are generated by merging and boundary adjustment through analysis of the ratio of lateral offset to longitudinal overlap.
2. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, The method of identifying gradient ranges at the vehicle body edges by analyzing grayscale gradient changes includes: For each pixel, extract the grayscale value and perform a horizontal difference operation to obtain the gradient change matrix of the pixel. For each row in the gradient change value matrix, determine whether the mean of that row is greater than the preset gradient activation value. If so, obtain the continuous difference interval. Determine whether the gray-level gradient change trend within the continuous difference interval conforms to the preset vehicle body edge change pattern to obtain the pattern selection result; Based on the noise regions in the pixel grayscale removal results, the gradient range of the vehicle edge is obtained.
3. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, A closed contour is constructed based on the gradient interval of the vehicle body edge, and the target rectangular contour is obtained by filtering based on geometric conditions; Analyze the chromaticity of color blocks within the target rectangular outline to generate feature-concentrated blocks, including: By connecting the gradient intervals of the vehicle body edge, a closed contour is generated, and the ratio of the area to the perimeter of the closed contour is calculated. Calculate the matching coefficient between the ratio value and the preset horizontal straightness index, and filter the target rectangle outline based on the matching coefficient; Within the chromaticity of the color blocks in the target rectangular outline, the pixel distribution range of the main color blocks is statistically analyzed. The chromaticity value of each main color block is calculated, and the chromaticity difference between any two color blocks is obtained. Color blocks whose chromaticity difference is within the chromaticity clustering threshold are marked as the same class, and feature set blocks are generated.
4. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, The selection process is based on edge variation and path density within the feature set blocks. The target area value is then obtained based on the selection results, including: The edge variation and path density of the feature set block are calculated. The edge variation is the number of vehicle edge gradient intervals contained therein. The path density is obtained by dividing the total length of all contours in the feature set block by the coverage area of the feature set block. By comparing edge change with edge change threshold and path density with path density threshold, the target feature concentration block is obtained through screening. Calculate the area of the target feature set to obtain the target area value.
5. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, By analyzing continuous pixel lines in overlapping segments, response segments are selected, including: Extract the minimum segment length value of the horizontally continuous pixel line in each overlapping segment, and determine whether the length value is greater than the continuous length threshold. If so, the length filtering result is obtained. For the length filtering results, calculate the number of vertical endpoints and the number of continuous trajectories within the overlapping segments. The number of vertical endpoints is the number of horizontally continuous pixel lines terminating on the vertical edge of the segment, and the number of continuous trajectories is the number of independent and continuous pixel lines within the segment. Calculate the matching coefficient between the number of continuous trajectories and the number of longitudinal endpoints, and filter out overlapping segments with matching coefficients higher than the preset trajectory integrity threshold to obtain the response segments.
6. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, The vehicle spacing in the response fragment is analyzed, and a clustering region index is generated based on the analysis results, including: The response segment is divided into equal intervals according to the pixel coordinate values in the horizontal direction of the image frame, and the vertical coordinate range of the vehicle front marker point in each segmented area is detected. Calculate the overlap ratio of the longitudinal coordinate range of the vehicle front marker points between adjacent areas, and compare the overlap ratio with the area width difference coefficient to filter out the overlapping block set; Calculate the average lateral spacing between the front ends of each vehicle within the overlapping block set, and obtain the spacing filtering blocks by comparing the range of the ratio of the average lateral spacing to the average width of the region. Record the position index of each interval filtering block in the original image frame, build a position index table according to the sequence order of horizontal equidistant division, and generate a clustered region index.
7. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, Based on the clustering region index, the center point of the vehicle's front is extracted, and the offset information between adjacent frames is obtained. Based on the offset information, trajectory coherence groups are filtered to generate continuous vehicle trajectory segments, including: Based on the region corresponding to the clustered region index, extract the vehicle bounding area in consecutive frame images, obtain the center point coordinates of the vehicle bounding area in the image, and calculate the horizontal offset length of the center point coordinates between adjacent frames. Each offset length is compared with the upper and lower limit coefficients of the lateral change reference range to obtain the initial vehicle trajectory; Extract the area value sequence of the vehicle bounding box region in the corresponding consecutive frames of the initially screened vehicle trajectory, calculate the trend stability coefficient of the area value sequence in one direction, filter out the trajectory coherence group based on the trend stability coefficient, record the spatial distribution data of all vehicle trajectories in the group, and generate continuous vehicle trajectory segments.
8. The vehicle detection method based on YOLOv11 according to claim 1, characterized in that, Based on continuous vehicle trajectory segments, the vehicle detection results are aggregated and adjusted by analyzing the ratio of lateral offset to longitudinal overlap, including: Based on the set of trajectory coordinates in the continuous trajectory segments of the vehicle, the total offset length of each trajectory in the horizontal direction is calculated, and the boundary overlap ratio of the trajectory in the vertical direction in the continuous frames is calculated. The trajectory stability result is generated by threshold judgment. Based on the trajectory stability results, target regions in consecutive frames with lateral variation amplitude lower than the average span difference coefficient and longitudinal boundary difference fluctuation range smaller than the structural extension coefficient are selected. Perform a location merge operation on the target area to merge the coordinate sets of adjacent areas and generate a merged area coordinate set; Based on the coordinate set of the merged region, adjust the positions of the upper and lower boundary lines of the merged region, output the data set of the adjusted region, and generate vehicle detection results.
9. A vehicle detection system based on YOLOv11, characterized in that, include: The first module is used to acquire the pixel matrix of urban road image frames and identify the gradient range of vehicle body edges by analyzing gray-level gradient changes. The second module is used to construct a closed contour based on the gradient interval of the vehicle body edge, and to obtain the target rectangular contour by filtering based on geometric conditions; the color intensity of the color blocks within the target rectangular contour is analyzed to generate feature concentration blocks; The third module is used to filter based on the edge variation and path density in the feature set blocks, and to obtain the target area value based on the filtering results. The fourth module is used to filter out overlapping segments based on the ratio of the target area value to the area value of the nearest vehicle frame region given by the YOLOv11 model. The fifth module is used to filter out response segments by analyzing continuous pixel lines in overlapping segments; The sixth module is used to analyze the vehicle spacing in the response fragment and generate a clustering region index based on the analysis results; The seventh module is used to extract the center point of the vehicle head and obtain the offset information between adjacent frames based on the clustering region index, filter the trajectory coherence groups based on the offset information, and generate continuous trajectory segments of the vehicle. The eighth module is used to generate vehicle detection results by analyzing the ratio of lateral offset to longitudinal overlap based on continuous vehicle trajectory segments, performing merging processing and boundary adjustment.
10. The vehicle detection system based on YOLOv11 according to claim 9, characterized in that, The first module includes: The first unit is used to extract the grayscale value of each pixel and perform a horizontal difference operation to obtain the gradient change value matrix of the pixel. The second unit is used to determine whether the mean value of each row in the gradient change value matrix is greater than the preset gradient activation value. If so, a continuous difference interval is obtained. The third unit is used to determine whether the gray-level gradient change trend in the continuous difference interval conforms to the preset vehicle body edge change pattern, and to obtain the pattern filtering result. The fourth unit is used to filter out noise regions in the results based on the pixel grayscale removal mode to obtain the gradient interval of the vehicle edge.