Lightweight anchor frame self-adaptive zooming single image vehicle detection method
Through the lightweight anchor frame adaptive zoom single-picture vehicle detection method, the accuracy and efficiency problems of vehicle positioning and tracking in the mining environment are solved, and high accuracy and high efficiency vehicle detection are achieved.
Patent Information
- Application Number
- CN202411544436.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-18
AI Technical Summary
The prior art is difficult to achieve high accuracy and efficient vehicle positioning and tracking when monitoring and identifying vehicles in mining environments in real time.
The lightweight anchor box adaptive scaling single-graph vehicle detection method is adopted, and the anchor box is constructed and clustered and sized to adjust it based on the clustering algorithm to generate prediction boxes to improve the efficiency and accuracy of model training.
It improves the accuracy and detection speed of vehicle positioning, reduces the amount of calculation, improves the real-time and adaptability of the model, and can better match the marking boxes in the dataset.
Smart Images

Figure CN119478853A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle detection, and in particular to a lightweight anchor frame adaptively scaling single-image vehicle detection method. Background Art
[0002] As the process of social modernization continues to accelerate, the number of cars has increased dramatically, and the traffic pressure on the road has also increased, which has also led to the frequent occurrence of road traffic accidents. In order to protect the lives and property of citizens, the problem of vehicle target detection and identification and tracking is particularly important, which includes the detection, identification and tracking of stationary and moving vehicles in images, videos, and real-time monitoring data. Due to different roads and different driving conditions, it is very important and challenging to monitor vehicles in real time for various complex situations in traffic monitoring. The difficulty of this task lies in the accurate positioning, identification and tracking of all vehicles in the mining environment. Summary of the invention
[0003] The purpose of the present invention is to provide a lightweight anchor frame adaptively zooming single-image vehicle detection method in order to improve the accuracy of vehicle positioning.
[0004] The purpose of the present invention can be achieved by the following technical solutions:
[0005] A lightweight anchor frame adaptively scaled single image vehicle detection method, the method comprising:
[0006] Obtain the image to be detected, input the image to be detected into the single-image vehicle detection model, and obtain the detection result;
[0007] Among them, the training process of the single-image vehicle detection model is as follows:
[0008] The ABAZOLD network structure is obtained, and the training set is input into the ABAZOLD network structure. The ABAZOLD network outputs the prediction box. The parameters of the ABAZOLD network are updated and iterated based on the error between the prediction box and the real box in the training set. During the update and iteration process, the ABAZOLD network first constructs the anchor box, clusters the anchor box based on the clustering algorithm, adjusts the size of the clustered anchor box, generates a bounding box on the image based on the adjusted anchor box, and generates the prediction box after the backbone network structure is adjusted.
[0009] Furthermore, the ABAZOLD network structure includes an input module, a backbone network and a detection module.
[0010] Furthermore, the detection module includes a bottleneck layer and a prediction layer.
[0011] Furthermore, the input of the backbone network is the output of the input module, and the output of the input module passes through the focus layer, the first CBL layer, the first CSP layer, the second CBL layer, the second CSP layer, the third CBL layer, the third CSP layer, the fourth CBL layer and the SPP layer of the backbone network in sequence.
[0012] Furthermore, the input of the bottleneck layer is the output of the backbone network, and the input of the bottleneck layer passes through the fourth CSP layer, the fifth CBL layer, the first upsampling layer, the first connection layer, the fifth CSP layer, the sixth CBL layer, the second upsampling layer, the second connection layer, the sixth CSP layer, the sixth CBL layer, the third connection layer, the seventh CSP layer, the seventh CBL layer, the fourth connection layer, and the eighth CSP layer of the bottleneck layer in sequence, and the outputs of the seventh CSP layer and the eighth CSP layer are respectively connected to the prediction layer.
[0013] Furthermore, when the ABAZOLD network first constructs the anchor box, the parameters of the anchor box are:
[0014] b x =σ(t x )+c x
[0015] b y =σ(t y )+c y
[0016]
[0017] The image is divided into fixed regions, b x Indicates the distance from the upper border of the anchor box to the left vertex, t x Indicates the scale size, b y represents the distance from the left vertex to the left line of the anchor box, where σ is the scaling factor, c x is the distance between the anchor box and the upper left vertex of the image, c y is the distance between the anchor box and the vertex on the image. w is the width of the anchor box, b h is the height of the anchor box, P w represents the width of the original anchor box, P h represents the height of the original anchor box, t w Indicates the width of the actual object, t h Indicates the height of the actual object.
[0018] Furthermore, the anchor frames are clustered in the bottleneck layer to obtain 6 groups of clustered anchor frames.
[0019] Furthermore, the specific steps for adjusting the size of the clustered anchor boxes are as follows:
[0020] First, the six groups of anchor frames are arranged from small to large in size, and the first and sixth groups of anchor frames are adjusted to obtain the adjusted widths x1' and x'6 of the first and sixth groups of anchor frames, and then the adjusted anchor frame widths of all groups and the adjusted anchor frame heights of all groups are calculated.
[0021] Furthermore, the adjusted anchor box widths of all groups are:
[0022]
[0023] Among them, x i represents the width of the i-th group of anchor boxes arranged from small to large, where the value of i ranges from 1 to 6; x i 'Represents the width of the anchor box after scaling.
[0024] Furthermore, the adjusted anchor frame height is:
[0025]
[0026] Among them, y i ' is the height of the anchor box after scaling.
[0027] Compared with the prior art, the present invention has the following beneficial effects:
[0028] Compared with YOLOv5, the Neck stage in the model of the present invention deletes the feature map branch for predicting small targets, reduces the number of anchor boxes obtained by clustering, reduces the amount of calculation, and improves the speed. The present invention also adjusts the size of the anchor boxes after clustering to ensure that the size of the anchor boxes can completely cover all the marked boxes in the data set. In this way, the size of the anchor boxes obtained by clustering can be better adjusted to better match the marked boxes in the data set, thereby improving the efficiency and accuracy of model training. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 This is a model structure diagram of the present invention.
[0030] Figure 2 The operational process of vehicle detection in a mining environment for Mosaic data enhancement;
[0031] Figure 3 A set of bounding boxes generated for anchor boxes and a schematic diagram of automatically learned anchor box locations, where Figure 3 (a) is the border set of the feature map, Figure 3 (b) is a schematic diagram of the automatically learned anchor box position;
[0032] Figure 4 Flowchart for dragging and dropping images for the experiment;
[0033] Figure 5 It is the experimental data graph;
[0034] Figure 6 Comparison of the differences between the detection of yellow engineering vehicles by YOLOv5 and the anchor box adaptive scaling single image vehicle detection algorithm (ABAZOLD);
[0035] Figure 7 It is the relationship curve between precision and recall rate;
[0036] Figure 8 Data curves related to the visualization results of the single-image vehicle detection algorithm experiment for anchor box adaptive scaling. DETAILED DESCRIPTION
[0037] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. This embodiment is implemented based on the technical solution of the present invention, and provides a detailed implementation method and specific operation process, but the protection scope of the present invention is not limited to the following embodiments.
[0038] Through research, it was found that there are three problems in target detection that need to be solved urgently: A challenge often encountered in the target detection process is the imbalance in the number of object and background samples in the labeled data set; when target detection is dealing with large-scale changes, occlusion or cropping problems, traditional convolutional neural networks (CNN) often cannot achieve ideal results, especially in scenarios for two-dimensional target detection. For real-time mining environments, target detection and tracking often require very high frame rates and accuracy. In response to the above problems, the present invention proposes an anchor box adaptive zoom one look detection (Anchor Box Adaptive Zoom One Look Detection, ABAZOLD) method. The following is an introduction to the ABAZOLD algorithm proposed in the present invention, including an introduction to the backbone network selection, anchor box selection and anchor box adaptive scaling modules.
[0039] The model structure of the lightweight anchor frame adaptive scaling single image vehicle detection method proposed in this invention is as follows: Figure 1 As shown, the present invention comprises the following steps:
[0040] Obtain the image to be detected, input the image to be detected into the single-image vehicle detection model, and obtain the detection result;
[0041] Among them, the training process of the single-image vehicle detection model is as follows:
[0042] The ABAZOLD network structure is obtained, and the training set is input into the ABAZOLD network structure. The ABAZOLD network outputs the prediction box. The parameters of the ABAZOLD network are updated and iterated based on the error between the prediction box and the real box in the training set. During the update and iteration process, the ABAZOLD network first constructs the anchor box, clusters the anchor box based on the clustering algorithm, adjusts the size of the clustered anchor box, generates a bounding box on the image based on the adjusted anchor box, and generates the prediction box after the backbone network structure is adjusted.
[0043] In order to determine the backbone network of the ABAZOLD algorithm, the network of the latest algorithm YOLOv5 and the network of mobilenetv3 are used for comparison on the COCO data set. The characteristics of these two networks are that the speed and accuracy are basically the same. Considering the network depth and feature map width of YOLOv5, YOLOv5s is the network with the smallest network depth and width. According to the actual hardware conditions, the present invention adopts YOLOv5s as the backbone network.
[0044] The backbone network structure of the ABAZOLD algorithm mainly consists of three parts: input module, backbone network (Backbone), and detection module. The input module uses Mosaic data enhancement. The backbone network (Backbone) structure is used to enhance the feature extraction capability of the convolutional network and reduce the computational cost. It mainly includes the Focus structure and the CSP structure. The detection network module mainly includes two parts: the bottleneck layer (Neck) and the prediction layer (Prediction), which will be introduced in detail later. The core structure of the Neck layer covers the feature pyramid network (FPN) and the path aggregation network (Path Aggregation Network, PAN), which mainly helps to increase or decrease the number of layers for transmitting shallow features and reduce the risk of data loss. Prediction uses CIOU_Loss, and can also be set to use other IOU_Loss as needed. The reason for using neural networks for function approximation is that they are universal approximators. In theory, they can be used to approximate any function.
[0045] Before the training set is input into the model, Mosaic data enhancement can be used. Mosaic data enhancement can enrich the data set and process four images at the same time by random scaling, adding many small objects and improving the robustness of the network. In addition, the mini-batch can be very small, and good results can usually be achieved on a single GPU. The operation process of Mosaic data enhancement in vehicle detection in a mining environment is as follows Figure 2 shown.
[0046] In the model, according to different data sets, the network will set the initial anchor boxes (Anchors) of corresponding length and width. During the network training process, the predicted box is output, and the error between the predicted box and the true box (ground-truth) is back-propagated to update the iterative network parameters.
[0047] At the beginning, the backbone network has predefined a set of bounding boxes. During the training of the network, the difference between the position of the real bounding box and the position of the preset bounding box is used to generate training data. An anchor box can be defined by the aspect ratio of the bounding box and the area of the bounding box. With these two parameters, the anchor box can generate some bounding boxes anywhere in the image. The anchor box is usually generated based on the points of the feature map extracted by CNN, so there is no need to specify the center position. According to the scale and area of the predefined anchor box, 9 types of bounding boxes can be generated on the original image by calculating at any point on the feature map. The principle is as follows: Figure 3 (a) shown.
[0048] A point on the feature map corresponds to a 16×16 square area in the original image. If only the border of this area is used to locate the target, the accuracy will be very poor. After adding the anchor frame, 9 types of frames are generated for a point on the feature map, and the probability of "framing" the target is very high. Then, these borders are adjusted through subsequent network layers, and the accuracy can be greatly improved. For example, Figure 3 (b) As shown in the figure. The formula for automatically calculating the anchor box is as follows:
[0049] b x =σ(t x )+c x
[0050] b y =σ(t y )+c y
[0051]
[0052] The image is divided into fixed regions, where σ is the scaling factor, c x is the distance between the anchor box and the upper left vertex of the image, c y is the distance between the anchor box and the vertex on the image. w is the width of the anchor box, b h is the height of the anchor box.
[0053] In the reference model YOLOv5, it generates a set of anchor boxes by clustering all target bounding boxes. However, in the ABAZOLD network, the 76×76 feature map branch for predicting small targets is deleted in the Neck stage, and the number of anchor boxes obtained by clustering is reduced from 9 groups to 6 groups. The amount of calculation is reduced and the speed is improved at the same time. The reduction in the number of anchor boxes leads to a more concentrated size of the anchor boxes obtained by the clustering method, which is significantly different from the actual annotation box size of some objects. Therefore, the anchor box group formed by relying solely on the K-means algorithm for anchor box clustering often cannot fully cover the size range of all real annotation boxes in the data set, which may cause the model to converge slowly during training and make it difficult to achieve optimal performance. In order to solve this problem, the ABAZOLD network adopts a method of linearly scaling the 6 groups of anchor boxes in the clustering results of the K-means algorithm. The adjustment formula is as follows:
[0054] x'1=Ax1
[0055] x'6=Bx6
[0056]
[0057] In this formula, x i represents the width of the i-th group of anchor boxes arranged from small to large, where the value of i ranges from 1 to 6; x' i Represents the width of the scaled anchor box. A is the ratio of anchor box reduction. After a series of experiments, the most ideal value is A = 0.5; B is the ratio of anchor box expansion. Based on the experimental results, it is determined to be B = 1.5. For different data sets, the values of scaling factors A and B need to be adjusted to ensure that the adjusted anchor box size can match the size of all annotation boxes in the data set. At the same time, y' i In this formula, i represents the number of anchor boxes, which are arranged in order of their width, and there are six groups in total; y i ' represents the width of the scaled anchor box, which is determined by the reduction factor A = 0.5 and the magnification factor B = 1.5 to ensure that the anchor box size can completely cover all the marker boxes in the dataset. In this way, the size of the anchor box obtained by clustering can be better adjusted to better match the marker boxes in the dataset, thereby improving the efficiency and accuracy of model training.
[0058] The following is a specific experimental verification:
[0059] The network structure and network performance of the anchor box adaptive scaling single image detection algorithm (ABAZOLD) were trained and tested through two training data sets, namely the COCO2017 data set and the self-built Truck_Detection_Dataset data set. The use of the COCO2017 data set for pre-training is to determine the final result that can be obtained by training the anchor box adaptive scaling single image detection algorithm (ABAZOLD) network model on the self-built training set, so the network parameters and training scale are fine-tuned on a small data set to achieve ideal experimental results on the self-built data set. Experiments on the COCO2017 data set and the Truck_Detection_Dataset data set are used to verify the accuracy of the test results, so as to achieve high-precision detection of vehicles in actual application scenarios.
[0060] The samples of the COCO2017 dataset in the experiment are all from the official website of the COCO dataset. COCO stands for Common Objects in Context, developed by the Microsoft team, and is a dataset widely used in the field of image recognition. The COCO dataset uses the Amazon Mechanical Turk platform to accumulate a large amount of relevant data. Currently, COCO contains three types of annotations: target entity, target key points, and image title. All this information is stored in the form of a JSON file. The training set COCO2017 dataset used in the test of the present invention is divided into three parts: training, verification, and testing, each part containing 118287, 5000, and 40670 pictures, respectively, with a total storage size of about 25G. Among them, the test dataset has no annotation information, and the training and verification datasets have annotations. The dataset currently contains 80 categories, and the categories mainly include various target detection data. Self-built Truck_Detection_Dataset dataset, including 4456 images of the front of the vehicle, 8914 images of the roof, 1108 images of the rear of the vehicle, and 20880 images of miscellaneous (strong light, night, multiple front and rear of the vehicle, etc.), totaling 35358 images. The experimental dataset is divided as shown in Table 1.
[0061] Table 1 Experimental dataset details
[0062]
[0063] The designed anchor box adaptive scaling single image detection algorithm (ABAZOLD) is implemented based on the YOLOv5s network backbone structure. When performing model inference, both the speed of loading the model and the speed of inference on the test image are extremely fast. At the same time, it also has higher version requirements for the computer and related network model training configuration. The specific parameter settings are shown in Table 2.
[0064] Table 2. Vehicle detection network training network parameters
[0065]
[0066] In the commonly used target vehicle detection algorithm, since different images and video frames have different length and width sizes, in order to solve this problem, the previous method is to scale the image to a suitable size and then input it into the detection module. The present invention often uses sizes such as 416x416 and 608x608. The 800x600 truck image under the self-built dataset Truck_Detection_Dataset can be processed by scaling it to the 416x416 size format.
[0067] Although geometric scaling has been performed, it can still be found that the black edges filled in the image are different due to different image sizes. Too many black edges not only affect the speed but also the recognition effect. Therefore, the ABAZOLD algorithm of the present invention uses the letterbox function to optimize when dealing with this problem, and adaptively scales the input image, which minimizes the black edges added. This improvement significantly improves the reasoning speed, and the actual program running effect becomes better.
[0068] The first step is to determine the scaling factor. For example, the original image is 800×600 in length and width, and the input image size is 416×416. Dividing the original image length and width, we get two scaling factors of 0.52 and 0.69 respectively. Therefore, according to the letterbox function principle, we need to choose a smaller factor.
[0069] In the second step, the length and width of the original image are multiplied by smaller scaling factors (8000.52=416, 6000.52=312) respectively, thereby obtaining the adjusted image size (416*312).
[0070] The third step is to calculate the black border filling value. First, subtract 312 from 416 to get 104, which is the height that needs to be filled. Then use the mod function to get the remainder, which can get 8 pixels. Then divide this value by 2, and fill it evenly on both sides. In this way, you get a new picture of 416*320, where 320 is 312+8.
[0071] The above scaling and the corresponding three steps are shown in the figure Figure 4 shown.
[0072] The fill color is gray. During training, a traditional image processing method was used. However, during the model testing phase, the black edge removal method was used to improve the efficiency of object detection and reasoning. Since the constructed network has been downsampled 5 times, 2 to the fifth power is 32, so the modulus must be at least a multiple of 32.
[0073] Experimental data is shown in Figure Figure 5 As shown. In order to make the experimental results more intuitive, cluster analysis can be performed on the samples in the data set. The data set is divided into different categories or clusters according to certain standards, aiming to ensure that the data objects in the same group are similar in type, while the data objects between different groups show large differences. In order to achieve this goal, the data features need to be standardized and dimensionally reduced. First, the data features are standardized and dimensionally reduced, and the most effective features are selected from the obtained features and stored in a vector. Then, similarity is measured based on different types of data. Finally, the distribution of data samples can be intuitively seen through the obtained clustering results, making it easier to analyze classification errors.
[0074] Figure 5 In the figure, the first one on the left shows the amount of data in the training set. The horizontal axis shows the number of categories, and the vertical axis shows the number of data frames detected in each category, which represents the sum of different vehicle detection results. The second one on the left shows the approximate location of the vehicles in the data set from the center point and the distribution density. The dense points generated according to the location obtained by vehicle detection are integrated into this table for observation. The third one on the left is the distribution of vehicle sizes in the data set. The larger the vehicle, the larger the width and height values will be, and the more the dense points will be biased towards this direction. The right picture is a detailed statistical chart of the marking box, the same as the left one. Figure 1 Similarly, the macro results obtained in the left figure are integrated into small points to generate the same image, making the experimental data clearer and more identifiable. It can also show the approximate width and height of the vehicles in the data set, as well as the location where they appear, the size of the picture, etc.
[0075] In order to make the experimental results more intuitive, cluster analysis can be performed on the samples in the data set. The data set is divided into different categories or clusters according to certain standards, aiming to ensure that the data objects in the same group are similar in type, while the data objects between different groups show large differences. In order to achieve this goal, the data features need to be standardized and dimensionally reduced. First, the data features are standardized and dimensionally reduced, and the most effective features are selected from the obtained features and stored in a vector. Then, similarity is measured based on different types of data. Finally, the distribution of data samples can be intuitively seen through the obtained clustering results, making it easier to analyze classification errors.
[0076] The performance indicators of the model include:
[0077] (a) precision (single class accuracy)
[0078] The meaning of the evaluation indicator "Precision". Precision reflects the accuracy of a binary classifier from the perspective of prediction results, that is, how many of the positive examples it predicts are true positive examples. Specifically, the general explanation of precision is "the proportion of the part that the classifier considers to be positive examples and is indeed positive examples to all the positive examples that the classifier considers to be positive examples". In other words, precision measures how many of the positive examples classified by a classifier are true positive examples. When the precision is 100%, it means that among all the samples predicted by the classifier, none of them are falsely positive examples, and all true positive examples are correctly predicted.
[0079] (b) Recall
[0080] The two performance metrics Precision and Recall play a role in evaluating the performance of a binary classifier. Precision refers to the accuracy of a classifier predicting the positive class as the positive class, and Recall refers to the ability of a classifier to identify true positive examples. When a classifier has a high Precision, most of the samples it predicts as positive are indeed positive, but some true positive examples may be missed, so the Recall is low. Conversely, when a classifier has a high Recall, it can capture more true positive examples, but it also appears to be more relaxed, and some false positive examples are also classified as positive, resulting in a lower Precision. Therefore, to improve Precision, you need to increase the threshold of the classifier, and to improve Recall, you need to lower the threshold of the classifier, so as to achieve the purpose of predicting true positive examples as accurately as possible.
[0081] (c) Accurate result memory curve
[0082] Box is the loss of the bounding box used by the single-image vehicle detection algorithm with adaptive scaling of the anchor box. Box is inferred to be the mean of the GIOU loss function. The smaller the box, the more accurate the target detection is. From the visualized data in the figure, it can be seen that with the deduction of the x-axis, time_seconds, the mean of the loss function is also decreasing and tending to a balance point; some common indicators and evaluation methods for target detection are explained. Among them, Objectness and Classification are two commonly used loss functions, which are used to measure the performance of the model in target detection and classification respectively; Precision and Recall are two commonly used metrics, which are used to measure the accuracy and recall rate of the model in finding true positive examples in the prediction results; val BOX, val Objectness and val classification are loss functions on the validation set; mAP is a comprehensive evaluation indicator used to measure the detection effect of the model under different IoU thresholds. Among them, mAP@0.5:0.95 means that the average accuracy of all categories is calculated within the IoU threshold range of 0.5 to 0.95. This means that it considers different detection thresholds from loose to tight to evaluate the performance of the model at different difficulty levels. This evaluation method is more comprehensive than considering only a fixed threshold because it can reflect the performance changes of the model when dealing with tasks of different complexity. mAP@0.5 represents the average accuracy when the iou threshold is 0.5.
[0083] It is used to measure the performance of the model in target detection and classification; Precision and Recall are two commonly used metrics, which are used to measure the accuracy and recall of the model in finding true positive examples in the prediction results; val BOX, val Objectness and val classification are loss functions on the validation set; mAP is a comprehensive evaluation indicator used to measure the detection effect of the model under different iou thresholds. Among them, mAP@0.5:0.95 means that the average accuracy of all categories is calculated within the IoU threshold range of 0.5 to 0.95. This means that it considers different detection thresholds from loose to tight to evaluate the performance of the model at different difficulty levels. This evaluation method is more comprehensive than considering only a fixed threshold because it can reflect the performance changes of the model when dealing with tasks of different complexity. And mAP@0.5 means the average accuracy with an iou threshold of 0.5.
[0084] Comparison of the difference between YOLOv5 and anchor box adaptive scaling single image vehicle detection algorithm (ABAZOLD) in detecting yellow engineering vehicle recognition Figure 6As shown in the figure, after using the anchor frame adaptive scaling single image vehicle detection algorithm (ABAZOLD), the part pointed by the middle arrow at the bottom can also detect the engineering vehicle that was originally partially obscured.
[0085] Table 3 lists the detection accuracy values of the target detection algorithms on the MS COCO 2017 dataset. From the average accuracy in this table, the ABAZOLD algorithm achieved an accuracy of 53.3, which is not the highest value but is not much different from the current best algorithm. Compared with YOLOv5, the accuracy of ABAZOLD is 0.2 percentage points lower at a threshold of 0.5. This shows that the lightweight design of the algorithm sacrifices part of the accuracy of the model. The feature branch of the small model is abandoned, resulting in a lower recognition rate on the MS COCO2017 dataset than the baseline model YOLOv5. However, the frame rate of the ABAZOLD algorithm is quite high, reaching 105 frames per second, which is much higher than YOLOv5, mainly due to the lightweight design of the algorithm.
[0086] Each algorithm is trained and fine-tuned on the Truck_Detection_Dataset dataset, and then the test results are listed in Table 4. In terms of the average accuracy of the detection accuracy of the target detection algorithm on the Truck_Detection_Dataset dataset, the ABAZOLD algorithm obtains an accuracy of 83.6. Although it is not the highest value, it is not much different from the current best algorithm. Compared with YOLOv5, the accuracy of ABAZOLD is slightly higher by 0.9 percentage points at a threshold of 0.5. This shows that the algorithm is effective for this dataset. The frame rate of the ABAZOLD algorithm is quite high, reaching 102 frames per second, mainly due to the lightweight design of the algorithm. The frame rate is slightly lower than that of MS COCO2017, mainly because the images of the self-built dataset are different from it. It takes some time to preprocess. The average accuracy and the accuracy of the threshold of 50 are greatly improved compared with the MS COCO2017 dataset, mainly because the self-built dataset is relatively simple and all vehicle data.
[0087] Table 3 Detection results of different detection algorithms on the MS COCO2017 dataset
[0088]
[0089] Table 4 Detection results of different detection algorithms on Truck_Detection_Dataset dataset
[0090]
[0091]
[0092] The following ablation experiment is performed. As shown in Table 5, before the detection frame is reduced, the average number of images detected per second is 95.2, and the average time per frame is 10.5 milliseconds. After reducing one anchor frame branch, the average number of images detected per second is 102.3, and the average time per frame is 9.8 milliseconds. The time is improved by 6.7 percentage points. This shows that the ABAZOLD algorithm can meet the real-time requirements.
[0093] Table 5. Comparison of detection speed in ablation experiments
[0094]
[0095] The relationship curve between precision and recall in the above experiment is as follows: Figure 7 The relevant data curves of the anchor box adaptive scaling single image vehicle detection algorithm experimental visualization results are shown in Figure 2. Figure 8 shown.
[0096] The preferred specific embodiments of the present invention are described in detail above. It should be understood that a person skilled in the art can make many modifications and changes based on the concept of the present invention without creative work. Therefore, any technical solution that can be obtained by a person skilled in the art through logical analysis, reasoning or limited experiments based on the concept of the present invention on the basis of the prior art should be within the scope of protection determined by the claims.
Claims
1. A lightweight anchor frame adaptive scaling single image vehicle detection method, characterized in that: Methods include: Obtain the image to be detected, input the image to be detected into the single-image vehicle detection model, and obtain the detection result; Among them, the training process of the single-image vehicle detection model is as follows: The ABAZOLD network structure is obtained, and the training set is input into the ABAZOLD network structure. The ABAZOLD network outputs the prediction box. The parameters of the ABAZOLD network are updated and iterated based on the error between the prediction box and the real box in the training set. During the update and iteration process, the ABAZOLD network first constructs the anchor box, clusters the anchor box based on the clustering algorithm, adjusts the size of the clustered anchor box, generates a bounding box on the image based on the adjusted anchor box, and generates the prediction box after the backbone network structure is adjusted.
2. According to claim 1, a lightweight anchor frame adaptive scaling single image vehicle detection method is characterized in that: The ABAZOLD network structure includes an input module, a backbone network and a detection module.
3. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 2, characterized in that: The detection module includes a bottleneck layer and a prediction layer.
4. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 3, characterized in that: The input of the backbone network is the output of the input module, and the output of the input module passes through the focus layer, the first CBL layer, the first CSP layer, the second CBL layer, the second CSP layer, the third CBL layer, the third CSP layer, the fourth CBL layer and the SPP layer of the backbone network in sequence.
5. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 4, characterized in that: The input of the bottleneck layer is the output of the backbone network. The input of the bottleneck layer passes through the fourth CSP layer, the fifth CBL layer, the first upsampling layer, the first connection layer, the fifth CSP layer, the sixth CBL layer, the second upsampling layer, the second connection layer, the sixth CSP layer, the sixth CBL layer, the third connection layer, the seventh CSP layer, the seventh CBL layer, the fourth connection layer, and the eighth CSP layer of the bottleneck layer in sequence. The outputs of the seventh CSP layer and the eighth CSP layer are respectively connected to the prediction layer.
6. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 3, characterized in that: The parameters of the anchor box when the ABAZOLD network first constructs the anchor box are: b x =σ(t x )+c x b y =σ(t y )+c y The image is divided into fixed regions, b x Indicates the distance from the upper border of the anchor box to the left vertex, t x Indicates the scale size, b y represents the distance from the left vertex to the left line of the anchor box, where σ is the scaling factor, c x is the distance between the anchor box and the upper left vertex of the image, c y is the distance between the anchor box and the vertex on the image. w is the width of the anchor box, b h is the height of the anchor box, P w represents the width of the original anchor box, P h represents the height of the original anchor box, t w Indicates the width of the actual object, t h Indicates the height of the actual object.
7. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 6, characterized in that: The anchor frames are clustered in the bottleneck layer to obtain 6 groups of clustered anchor frames.
8. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 7, characterized in that: The specific steps to adjust the size of the clustered anchor box are: First, the six groups of anchor frames are arranged from small to large in size, and the first and sixth groups of anchor frames are adjusted to obtain the adjusted widths x1' and x'6 of the first and sixth groups of anchor frames. Then, the adjusted anchor frame widths of all groups and the adjusted anchor frame heights of all groups are calculated.
9. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 8, characterized in that: The adjusted anchor box widths of all groups are: Among them, x i represents the width of the i-th group of anchor boxes arranged from small to large, where the value of i ranges from 1 to 6; x i 'Represents the width of the anchor box after scaling.
10. The method for detecting vehicles in a single image by adaptively scaling a lightweight anchor frame according to claim 9, characterized in that: The adjusted anchor frame height is: Among them, y i ' is the height of the anchor box after scaling.