YOLOv4‐dense: A smaller and faster YOLOv4 for real‐time edge‐device based object detection in traffic scene

IET Image ProcessingVolume 17, Issue 2 p. 570-580 ORIGINAL RESEARCHOpen Access YOLOv4-dense: A smaller and faster YOLOv4 for real-time edge-device based object detection in traffic scene Yue Jiang, Yue Jiang orcid.org/0000-0002-3323-6111 High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China High Magnetic Field Laboratory of Anhui Province, Hefei, China Contribution: Conceptualization, Data curation, Formal analysis, Methodology, Project administration, Resources, Software, Validation, Visualization, Writing - original draft, Writing - review & editingSearch for more papers by this authorWenjing Li, Wenjing Li High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Contribution: Data curation, Formal analysis, Funding acquisition, Project administration, Resources, Supervision, Writing - review & editingSearch for more papers by this authorJun Zhang, Corresponding Author Jun Zhang [email protected] High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Correspondence Jun Zhang, High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei 230031, China. Email: [email protected] Contribution: Conceptualization, Data curation, Funding acquisition, Project administration, Supervision, Writing - review & editingSearch for more papers by this authorFang Li, Fang Li High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Contribution: Data curation, Formal analysis, Funding acquisition, Project administration, Resources, Supervision, Writing - review & editingSearch for more papers by this authorZhongcheng Wu, Zhongcheng Wu High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Contribution: Conceptualization, Data curation, Funding acquisition, Project administration, Supervision, Writing - review & editingSearch for more papers by this author Yue Jiang, Yue Jiang orcid.org/0000-0002-3323-6111 High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China High Magnetic Field Laboratory of Anhui Province, Hefei, China Contribution: Conceptualization, Data curation, Formal analysis, Methodology, Project administration, Resources, Software, Validation, Visualization, Writing - original draft, Writing - review & editingSearch for more papers by this authorWenjing Li, Wenjing Li High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Contribution: Data curation, Formal analysis, Funding acquisition, Project administration, Resources, Supervision, Writing - review & editingSearch for more papers by this authorJun Zhang, Corresponding Author Jun Zhang [email protected] High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Correspondence Jun Zhang, High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei 230031, China. Email: [email protected] Contribution: Conceptualization, Data curation, Funding acquisition, Project administration, Supervision, Writing - review & editingSearch for more papers by this authorFang Li, Fang Li High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Contribution: Data curation, Formal analysis, Funding acquisition, Project administration, Resources, Supervision, Writing - review & editingSearch for more papers by this authorZhongcheng Wu, Zhongcheng Wu High Magnetic Field Laboratory, HFIPS, Chinese Academy of Sciences, Hefei, China University of Science and Technology of China, Hefei, China Contribution: Conceptualization, Data curation, Funding acquisition, Project administration, Supervision, Writing - review & editingSearch for more papers by this author First published: 08 November 2022 https://doi.org/10.1049/ipr2.12656AboutSectionsPDF ToolsRequest permissionExport citationAdd to favoritesTrack citation ShareShare Give accessShare full text accessShare full-text accessPlease review our Terms and Conditions of Use and check box below to share full-text version of article.I have read and accept the Wiley Online Library Terms and Conditions of UseShareable LinkUse the link below to share a full-text version of this article with your friends and colleagues. Learn more.Copy URL Share a linkShare onFacebookTwitterLinkedInRedditWechat Abstract Edge-device-based object detection is crucial in many real-world applications, such as self-driving cars, ADAS, driver behavior analysis. Although deep learning (DL) has become the de-facto approach for object detection, the limited computing resources of embedded devices and the large model size of current DL-based methods increase the difficulty of real-time object detection on edge devices. To overcome these difficulties, in this work a novel YOLOv4-dense model is proposed to detect objects in an accurate, fast manner, which is built on top of the YOLOv4 framework but with substantial improvements. More specifically, lots of CSP layers are pruned since it will decrease inference speed. And to address the losing small objects problem, a dense block is introduced. In addition, a lightweight two-stream YOLO head is also designed to further reduce the computational complexity of the model. Experimental results on NVIDIA JETSON TX2 embedded platform demonstrate that YOLOv4-dense can achieve a higher accuracy, faster speed with smaller model size. For instance, on the KITTI dataset, YOLOv4-dense obtains 84.3% mAP and 22.6 FPS with only 20.3 M parameters, surpassing the state-of-the-art models with comparable parameter budget such as YOLOv3-tiny, YOLOv4-tiny, PP-YOLO-tiny by a large margin. 1 INTRODUCTION Object detection [1] aims to locate the semantic objects of interest and recognize the categories of located objects in an image. Over the last decade, the act detection [2-6] approaches have achieved remarkable improvements along with the rapid development of deep convolutional neural networks (CNN) [7]. However, existing methods still struggle with the tradeoff between accuracy and efficiency. Generally, detection approaches are divided into two lines, one-stage detectors [2] and two-stage detectors [5]. The former enjoys fast inference with less computation cost but produces lower accuracy. The latter can achieve higher accuracy at the cost of expensive computation resources but generally is slower. In practice, one can choose the types (one-stage or two-stage) of detectors according to the application requirements. However, in many edge-device applications, both accuracy and efficiency are important. For example, in autonomous driving, to guarantee, safety, the advanced driving-assistance systems (ADAS) should be able to accurately detect the objects on the roads in real-time. However, the equipped edge devices generally have limited memory and computing power, limiting the application of existing detectors. Therefore, detecting objects accurately and speedily with limited resources is an important yet under-explored problem [8]. In this paper, we focus on achieving accurate and fast object detection on the edge device in the context of autonomous driving. Given the resource constraints of edge devices, existing companies [9] usually tend to build systems based on cloud computing. In this manner, the edge device is used to upload the real-time data to the cloud servers, which have powerful resources to achieve fast and accurate detection; the detection results are then returned to the edge device. This strategy, however, has two main drawbacks that make it less favorable to edge-device-based applications. First, the efficiency is largely dependent on the speed of data transmission. However, the speed of the transmission can not be continuously guaranteed, due to the high-speed moving scenes, heavy traffic, and exponentially growing users. Second, uploading the data to the cloud server will lead to a data privacy issue, which is feared by many users. Taking the above considerations into account, it is necessary to design an accurate and fast object detector that can be directly applied on the edge device for driving applications. To achieve this goal, one proper way is to construct lightweight networks based on one-stage object detectors, such as YOLOv3-tiny and YOLOv4-tiny [10, 11]. This is because the one-stage object detectors have a good balance between accuracy and efficiency, which achieve acceptably lower results than two-stage ones but are faster. The lightweight versions aim to reduce the number of parameters and the computational complexity of the network so that the object detectors can be well adapted to edge devices. Although they obtain smaller and faster detectors, the accuracy is decreased seriously. For example, compared to YOLOv4, YOLOv4-tiny is 5 times faster in inference but is 15% lower in mAP when evaluating on the COCO dataset. Recall that, autonomous driving strictly requires both accuracy and speed. Thus existing lightweight networks still have largely limited applications in such a context. In this work, we propose a new lightweight object detector based on YOLOv4 for autonomous driving, which designs the model jointly in terms of speed, size, and accuracy. Specifically, our model has a detection speed of 22.6 Frames/s on TX2 and only a parameter size of 20.3M. To summarize, the contributions of this paper are as follows: To achieve real-time edge-device-based object detection, a new YOLOv4-dense model is presented where a more lightweight backbone and a new two-stream light-weight YOLO neck and head structure are introduced to dramatically compress the model size from 162 M to 20.3 M and greatly improve the inference speed from 3.1 FPS to 22.6 FPS compared to YOLOv4. To improve the performance in terms of small-size objects detection, a dense-block structure is designed to improve the connection between layers. The experimental results show that the introduction of dense-block will enforce the model to notice more small objects. The experimental results on two public datasets, KITTI and BDD-100k, show the superiority of the proposed YOLOv4-dense in model size, accuracy, and inference speed. 2 RELATED WORK Generic object detection models 2.1.1 Two-stage detectors In the two-stage object detection algorithm, the representative algorithms are RCNN [12], spatial pyramid potential(SPPNet [13]), Fast RCNN [3], Faster RCNN [4], Mask RCNN [14] and so on. There are two steps in the two-stage detectors, that is, region-proposal generation and subsequent perdition. This multi-stage nature makes most of the two-stage detectors less efficient in terms of inference time. 2.1.2 One-stage detectors Different from two-stage models, one-stage detectors follows a totally different philosophy: to apply a single neural network to the full image by predicting bounding boxes and probabilities for each region simultaneously. The representative One-stage detectors include YOLOv1 [5], YOLOv2 [15], YOLOv3 [16], YOLOv4 [6], SSD [17], Retina-Net [18][19] etc. One-stage object detector is trained by optimizing the classification loss and positioning loss at the same time, resulting in a fast speed. This motivates us to choose YOLOv4 as our backbone model to meet the requirement of real-time inference. However, we find that the model size of YOLOv4 is still too large for the resource-constrained platforms. Although there exist some lightweight versions of YOLOv4, such as YOLOv4-tiny, their performance is not good enough, especially in detecting small-size objects. Thus, in this paper, we design a lightweight YOLOv4 considering the accuracy and speed simultaneously, targeting real-time edge-device-based object detection. Multi-scale object detection models Since scales of objects in natural images are not consistent, single-level feature representation is largely limited. Thus, several methods have tried multi-scale object detection using the multi-scale feature. Liu et al. propose SSD using multi-scale features from different layers to detect objects [20]. FPN fuses multi-scale features via the top-down pathway and lateral connection to produce more semantic information [21]. Inspired by FPN, Libra-RCNN [22] uses a balanced feature to enhance original features by combining each resolution in the pyramid. However, these FPN-based detectors often select a single level from the feature pyramid to pool features, which cannot satisfy the detection task in traffic science images due to the scale of objects being much diverse caused of the complex transportation scenario. On the other hand, FPN based RoI extraction may cause the loss of some important scale information[23]. Therefore, in our model, we concatenate the features from the upper layers to the current layer to enhance the feature representation. Edge-device based object detection methods Recently, edge-device based objects detection has been raised more attention form the community boosted by the huge demand from the hundreds of millions edge devices, such as, vehicles, smart phones etc. The typical edge-device based object detectors are PP-YOLO [24], YOLOX [25], YOLOv5s [26], YOLOv4-tiny [27]. PP-YOLO replaced part of the convolution layer with deformable convolution, deleted the dropout of the backbone part then changed it to the detection head part And use a matrix NMS that runs faster than traditional NMS. YOLOX modified and redesigned the YOLO detection head,use anchor free and set decoupled head to achieve faster speed and more accurate. Scaled-YOLOv4 optimized the CSP structure, reduced the amount of network calculation and redesigned the loss function, which is reduce the weight of the model. YOLOV5 added attention mechanism in front of the backbone and introduced slicing operation. At the same time, they introduced two CSP structures, one for backbone and the other for detection neck. Although a significant leap is made in efficiency for edge-device based object detection, the tradeoff between efficiency and accuracy is not well explored. To narrow this gap, in this paper, we present a novel YOLOv4-dense network to detect object in an accurate and fast manner. Specifically, We prune lots of the heavy-weight CSP layers to realize the slimming of the model. At the same time, a novel dense-block structure is designed to compensate the weakness of losing small object. 3 YOLOV4-DENSE MODEL Overview The overview of the proposed YOLOv4-dense is illustrated in Figure 1. First, we develop a lightweight YOLOv4-dense backbone that is with two CBL layers, two CSP layers, and two convolutional layers, along with a Dense-block layer. Second, a new YOLO head that contains two-stream classifiers to predict different sizes of objects. To improve the performance of the YOLO head, we introduce an anchor frame design strategy to obtain prior anchor scales of the dataset. Coupling these two designs enables us to train lightweight models efficiently and effectively. FIGURE 1Open in figure viewerPowerPoint The overview of the proposed YOLOv4-dense network. The YOLOv4-dense contains two parts: YOLO-dense Backbone and YOLOv4-dense head. YOLOv4-dense backbone that is with two CBL layers, two CSP layers and two convolutional layers, along with a Dense-block layer. CBL: Conv + Batch Normalization + Leaky; CSP: Cross-stage Partial Connections; SPP: Spatial Pyramid Pooling. CBR: Conv + Batch Normalization + ReLU. Transition: 1× 1, 2× 2 AvgPooling To be specific, the first two CBL modules can not only obtain the shallow features effectively but also relieve the gradient vanishing problem caused by leaky ReLU when using learning rate decay. And lots of the CSP structures are pruned in order to improve the inference speed. Then there are two convolution layers and three residual layers inside the two CSP layers. Through a concat operation, the characteristic diagram of the residual layer is directly connected with the convolution layer of the upper layer, so as to reduce the computing cost and memory consumption. Finally, a dense module that includes four CBR modules is introduced. For each CBR layer, the feature maps of all preceding layers are used as inputs, and their own feature maps are used as inputs into all subsequent layers. In this way, we can alleviate the vanishing-gradient the problem, encouraging feature reuse and substantially reduce the number of parameters. YOLOv4-dense backbone architecture 3.2.1 Pruning CSP The parameter size of CSPdarknet-53 used in Yolov4 is about 116.8 M and requires about 49.144 BFLOPS during inference, which is unacceptable for the edge platforms. The parameters of the YOLOv4-dense backbone are reduced to 20.3 M. As shown in Figure 1a, the input of the CSP structure is divided into two streams, one stream is calculated by Resblock, the other is directly passed by an AVG-Pool layer, and finally, concatenate the two parts. Obviously, the CSP structure is a fragmented structure, which has been proved to help reduce computing bottlenecks and memory consumption, but it will reduce efficiency because fragmentation will reduce parallelism[28]. There are two main reasons for us to prune the CSP structure. First, deleting the CSP structure can effectively reduce the volume of the network, which not only optimizes the overall network structure but also speeds up the video frame processing by reducing the computational complexity. Second, the CSP structure plays a relatively small role in feature acquisition in the object detection task. Based on these observations, lots of Cross-Stage-Partial-connections (CSP) layers are pruned compared to the original YOLOv4. Specifically, the YOLOv4-dense backbone is equipped with two CBL (Convolutional + Batch Normalization + Leaky ReLU) layers, two CSP layers, and two CONV (Convolutional) layers. Unfortunately, we find that the pruned backbone may cause the model insensitive to small objects. The objects far in the distance are undetectable in YOLOv4-tiny and our pruned backbone. This is because small objects can not be well represented by the current feature representation module. Therefore, to further improve the information flow between layers, we introduce direct connections from any layer to all subsequent layers, which is called Dense-block. 3.2.2 Adding dense-block A dense-block module is designed in the backbone to compensate for the weakness of pruned backbone in losing the tiny objects. In a dense-block structure, each layer is connected in pairs, so that the last layer can obtain all the shallow features. In contrast to a relatively loose structure such as CSP, the dense module can effectively enhance the connection between layers and the tightness of the network, so as to compensate for the CSP layer without introducing too many parameters as well as complexity. On the other hand, it is proved that the dense connection is able to strengthen feature propagation, encourage feature reuse, which enables the proposed model easier to train [29]. Since each layer can directly reach the final error signal, implicit depth supervision is realized. Therefore, the deleted CSP module can be compensated with dense-block. At the same time, due to the reduction of a large number of CSP structures, the acquisition of image features is not sufficient. However, this is not obvious in the data set with less data volume and types. Therefore, the use of a dense module can not only compensate for the lack of a CSP module but also obtain better results on relatively few kinds of data sets. For the dense structure, as shown in Figure 1b, a single image denoted as x0 is passed through a convolutional network. The network comprises L layers, each of which implements a non-linear transformation H l ( · ) $H_{l}(\cdot )$ , where l indicates the layer. H l ( · ) $H_{l}(\cdot )$ can be a composite function of operations. This paper denote the output of the l t h $l_{th}$ layer as x l $x_{l}$ . The dense structure has strong connectivity and can be expressed as: x l = H l ( [ x 0 , x 1 , … . , x l − 1 ] ) , $$\begin{equation} x_{l} = H_{l}([x_{0},x_{1},\ldots.,x_{l-1}]), \end{equation}$$ (1)where [ x 0 , x 1 , … . , x l − 1 ] $[x_{0},x_{1},\ldots.,x_{l-1}]$ refers to the concatenation of the feature maps produced in layers [ 0 , 1 , . . , l − 1 ] $[0,1,..,l-1]$ . YOLOv4-dense Neck & Head architecture To further reduce the number of the parameters, and improve the detection speed, the proposed YOLOv4-dense has a two-stream Neck & Head architecture instead of three streams. For the YOLOv4-dense neck, we apply a two-layer Spatial Pyramid Pooling (SPP) structure. And all the CBL layers that appeared in the YOLOv4 neck are pruned to further reduce the number of the parameters. To fine-tuning, the designed YOLOv4-dense Neck & Head, the anchor frame design method is utilized. Starting from YOLOv2 [15] ,the idea of a prior box is introduced into the series of YOLO algorithms to obtain more accurate bounding boxes. The prior frame can be obtained by performing k-means clustering, as shown in Figure 1c. The process of prior anchor frame design can be described as follows: Step 1: Randomly select k centers, denoted as μ 1 , … , μ k $\mu _{1},\ldots,\mu _{k}$ , where μ i ∈ R 2 $\mu _{i} \in R^{2}$ . Step 2: For each bounding box x i $x_{i}$ , calculate the distance from each μ i $\mu _{i}$ : J C k = ∑ x i ∈ C k x i − μ k 2 , $$\begin{equation} J_{C_{k}}=\sum _{x_{i} \in C_{k} }{\left\Vert x_{i}-\mu _{k} \right\Vert} ^2, \end{equation}$$ (2)where x i = [ h e i g h t , w i d t h ] $x_{i}=[height, width]$ , C k $C_{k}$ represents the cluster of class k, and each class C k $C_{k}$ has a category center μ i $\mu _{i}$ . The objective is to minimize the distance of each sample x i $x_{i}$ to its corresponding cluster C k $C_{k}$ , which can be formulated as: J ( C ) = ∑ k = 1 K J C k = ∑ k = 1 K ∑ i = 1 n d k i x i − μ k 2 . $$\begin{equation} J(C)=\sum _{k=1}^{K}J_{C_{k}} =\sum _{k=1}^{K}\sum _{i=1}^{n} d_{ki}{\left\Vert x_{i}-\mu _{k} \right\Vert} ^2. \end{equation}$$ (3)Then the obtained C = { C 1 , … , C k } $C=\lbrace C_{1},\ldots,C_{k}\rbrace$ can be utilized as the prior anchor frame. 4 EXPERIMENT To verify the effectiveness of our proposed YOLOv4-dense model, we conduct experiments on the three public datasets, KITTI ,BDD-100k and VOC (Table 1). TABLE 1. Description of the three datasets Dataset Training set Testing set Total BDD 90,000 10,000 100,000 KITTI 7000 481 7481 VOC 16,551 4952 21,493 Datasets KITTI dataset [30] contains 7,481 images in the training set. 7000 samples are for training and 481 samples are for testing. Kitti dataset has 8 types of objects, including car, van, truck, pedestrain-sit, cycle, tram, and misc, in which car and cycle occupy a large number of labels. BDD100K [31] consists of 100k images, with 90k training images and 10k validation images annotated with bounding boxes. BDD100K dataset has 10 types of objects, including car, bus, person, bike, train,truck, motor, rider, traffic sign, and traffic light, of which car, traffic sign, and traffic light occupy a large number of labels. Compared with the Kitti dataset, the BDD100k dataset is more challenging since it is collected from a more complex environment. VOC [32] The Pascal VOC dataset consists of 21,493 images from different angles. There are 16551 images in the training set and 4952 images in the test set. The VOC dataset contains 20 predefined classes (i.e. people, birds, cats, cows, dogs, horses, sheep, airplanes, bicycles, boats, buses, cars, motorcycles, trains, bottles, chairs, dining tables, potted plants, plants , sofas and TVs/monitors), where vehicles and pedestrians occupy a large number of tags. Experimental setting YOLO-dense use Stochastic Gradient Descent (SGD) optimizer with a learning rate of 0.0009, weight decay of 0.0005 and momentum of 0.9. We set the batch size to 64. The total iterations are 100000, and the learning weight decay at 70000th, 90000th iterations. While increasing the learning rate, we also increased the batch size and decreased the subdivisions size to improve the learning efficiency and generalization ability of the model. The proposed method is implemented with Tensorflow and the models are trained with two GTX 1080Ti GPUs with 11GB memory. In the experiment, three metrics are used, that is, Parameters (#params), mean average precision (mAP), frame per second (FPS). Note that the FPS of all models is calculated based on the Nvidia Jeston TX2 [33-35]. Jetson TX2 is a 7.5-watt single-mode group supercomputer, which can provide real AI computing functions for terminals. This computer is based on NVIDIA Pascal TM $^{\text{TM}}$ GPU architecture, with 8 GB memory, memory bandwidth of 59.7 GB/s, and 256 NVIDIA CUDA cores. 4.2.1 Baselines To show the effectiveness of our model, we also evaluated the following methods on the two datasets: SSD: it predicts the type of object through the score of the object on each belonging category and uses a small convolution kernel on the feature map to predict the offset of the bounding box. RefineDet and RFBNet: RefineDet is an improvement based on SSD algorithm. It improves the method of single-stage design and uses two connected modules, the anchor refinement module and the object detection module. RFBnet is constructed by SSD with VGG as the backbone network. It mainly adds dilated convolution on the basis of inception, thus effectively increasing the receptive field. Faster-RCNN: it removes the selective search to generate the region proposal instead of using RPN (region proposal network) to generate the region candidate box. YOLO series: we re-implement the models including YOLOv3 [27], YOLOv4 [6],Scaled-YOLOv4-large-p5 [27], PP-YOLO-r18vd [24], YOLOX-s [25], YOLOv5s [26], YOLOX-tiny [25], YOLOv3-tiny [27], YOLOv4-tiny [27] and PP-YOLO-tiny [24] using the same data splits and experimental setting. 4.2.2 Evaluation metric To evaluate the performance of the model, we leverage the number of parameters (#Params) to compare model size, floating-point multiplication-adds (FLOPs) to obtain the model complexity, Frames Per Second (FPS) to calculate the inference speed, and Mean Average Precision (mAP), Precision and Recall to evaluate the performance in accuracy, where FPS, mAP are calculated by: F P S = f r a m e N u m e l a p s e d T i m e , m A P = ∑ i A i i , $$\begin{equation} FPS = \frac{frameNum}{elapsedTime}, mAP = \frac{\sum _{i}{} A_{i}}{i}, \end{equation}$$ (4) where i is the number of identification categories. Parameter analysis There are two parameters, that is, the number of CSP layers n and the parameter k in anchor frame design. This paper choose KITTI dataset to analyze these two parameters. And this paper also investigate the effort of quantization. 4.3.1 The effort of pruning and quantization To investigate the effort of quantization, we quantize of original YOLOv4, parameters to 16 and 8 bits, represented as YOLOv4 (↓16) and YOLOv4 (↓8), respectively, using ONNX 1. Note that the FPS of YOLOv4 (↓8) is not reported since Jetson TX2 does not support it. It can be observed from Table 3 (the first block), that direct quantization can not meet the requirement of real-time application. TABLE 2. The influence of k in anchor frame design k mAP #Params (M) FPS 9 84.4 20.43 22.3 8 83.9 20.40 22.6 7 83.6 20.38 22.6 6 84.3 20.37 22.6 5 79.3 20.34 22.7 TABLE 3. Experimental results of pruned and quantize networks. The ↓16 and ↓8 indicate the 16 and 8 bits quantization. The number followed with YOLOv4 means how many CSP layer retained, that is, n. The methods with "-D" are added with dense-block Model Input size #Params (M) GFLOPS FPS mAP PR RC YOLOv4(original) 416× 416 162 90.3 3.1 91.5 0.92 0.93 YOLOv4 (↓16) 416× 416 75.4 26.3 7.3 90.1 0.90 0.89 YOLOv4 (↓8) 416× 416 37.9 10.8 – 86.2 0.89 0.82 YOLOv4-20 416× 416 112.2 53.9 5.7 88.81 0.90 0.88 YOLOv4-20-D 416× 416 113.6 57.6 5.7 88.7 0.91 0.88 YOLOv4-10 416× 416 43.2 16.9 8.9 88.7 0.88 0.89 YOLOv4-10-D 416× 416 47.5 20.6 8.9 88.9 0.88 0.89 YOLOv4-7 416× 416 33.9 13.7 11.2 85.1 0.82 0.80 YOLOv4-7-D 416× 416 37.8 16.7 10.9 87.1 0.85 0.79 YOLOv4-4 416× 416 17.1 4.9 23.2 81.9 0.93 0.81 YOLOv4-4-D(ours) 416× 416 20.3 7.3 22.6 84.3 0.89 0.86 YOLOv4-3 416× 416 15.7 3.85 23.9 80.8 0.91 0.80 YOLOv4-3-D 416× 416 19.9 6.72 22.8 82.2 0.93 0.82 YOLOv4-2 416× 416 15.3 3.27 24.8 69.3 0.69 0.77 YOLOv4-2-D 416× 416 18.5 6.03 23.0 72.3 0.83 0.74 To investigate the effort of pruning, this paper vary the number of CSP layers to show the influence of n in terms of #Params, GFLOPS, FPS, mAP, Precison, and Recall. Intuitively, a too-large n will leads to a slow but accurate model while a too-small n will produce a fast but inaccurate model. Additionally, we report the pruned network with and without dense-block. The results are listed in Table 3 (see the second block). It can be seen that: (1) The inference speed will become fast but the mAP will be decreased when pruning CSP layers. The YOLOv4-dense can a