SqueezeDet: Unified, Small, Low Power Fully Convolutional Neural Networks for Real-Time Object Detection for Autonomous Driving
Bichen Wu, Alvin Wan, Forrest Iandola, Peter H. Jin, Kurt Keutzer
SSqueezeDet: Unified, Small, Low Power Fully Convolutional Neural Networksfor Real-Time Object Detection for Autonomous Driving
Bichen Wu , Alvin Wan , Forrest Iandola , , Peter H. Jin , Kurt Keutzer , UC Berkeley, DeepScale { bichen, alvinwan, phj, keutzer } @berkeley.edu, [email protected] Abstract
Object detection is a crucial task for autonomous driv-ing. In addition to requiring high accuracy to ensure safety,object detection for autonomous driving also requires real-time inference speed to guarantee prompt vehicle control,as well as small model size and energy efficiency to enableembedded system deployment.In this work, we propose SqueezeDet, a fully convolu-tional neural network for object detection that aims to si-multaneously satisfy all of the above constraints. In ournetwork we use convolutional layers not only to extract fea-ture maps, but also as the output layer to compute bound-ing boxes and class probabilities. The detection pipelineof our model only contains a single forward pass of a neu-ral network, thus it is extremely fast. Our model is fully-convolutional, which leads to small model size and bet-ter energy efficiency. Finally, our experiments show thatour model is very accurate, achieving state-of-the-art ac-curacy on the KITTI [9] benchmark. The source code ofSqueezeDet is open-source released .
1. Introduction
A safe and robust autonomous driving system relies onaccurate perception of the environment. To be more spe-cific, an autonomous vehicle needs to accurately detect cars,pedestrians, cyclists, road signs, and other objects in real-time in order to make the right control decisions that ensuresafety. Moreover, to be economical and widely deployable,this object detector must operate on embedded processorsthat dissipate far less power than powerful GPUs used forbenchmarking in typical computer vision experiments.Object detection is a crucial task for autonomous driv-ing. Different autonomous vehicle solutions may have dif-ferent combinations of perception sensors, but image basedobject detection is almost irreplaceable. Image sensors arecheap compared with others such as LIDAR. Image data(including video) are much more abundant than, for exam-ple, LIDAR cloud points, and are much easier to collect andannotate. Recent progress in deep learning shows a promis-ing trend that with more and more data that cover all kinds https://github.com/BichenWuUCB/squeezeDet of long-tail scenarios, we can always design more powerfulneural networks with more parameters to digest the data andbecome more accurate and robust.While recent research has been primarily focused on im-proving accuracy, for actual deployment in an autonomousvehicle, there are other issues of image object detection thatare equally critical. For autonomous driving some basic re-quirements for image object detectors include the follow-ing: a) Accuracy. More specifically, the detector ideallyshould achieve recall with high precision on objectsof interest. b) Speed. The detector should have real-time orfaster inference speed to reduce the latency of the vehiclecontrol loop. c) Small model size. As discussed in [16],smaller model size brings benefits of more efficient dis-tributed training, less communication overhead to exportnew models to clients through wireless update, less energyconsumption and more feasible embedded system deploy-ment. d) Energy efficiency. Desktop and rack systemsmay have the luxury of burning 250W of power for neu-ral network computation, but embedded processors target-ing automotive market must fit within a much smaller powerand energy envelope. While precise figures vary, the newXavier processor from Nvidia, for example, is targeting a20W thermal design point. Processors targeting mobile ap-plications have an even smaller power budget and must fitin the 3W–10W range. Without addressing the problems ofa) accuracy, b) speed, c) small model size, and d) energyefficiency, we won’t be able to truly leverage the power ofdeep neural networks for autonomous driving.In this paper, we address the above issues by presenting SqueezeDet , a fully convolutional neural network for objectdetection. The detection pipeline of SqueezeDet is inspiredby [21]: first, we use stacked convolution filters to extract ahigh dimensional, low resolution feature map for the inputimage. Then, we use
ConvDet , a convolutional layer to takethe feature map as input and compute a large amount of ob-ject bounding boxes and predict their categories. Finally, wefilter these bounding boxes to obtain final detections. The“backbone” convolutional neural net (CNN) architecture ofour network is SqueezeNet [16], which achieves AlexNetlevel imageNet accuracy with a model size of < MB that https://blogs.nvidia.com/blog/2016/09/28/xavier/ a r X i v : . [ c s . C V ] N ov an be further compressed to . MB. After strengtheningthe SqueezeNet model with additional layers followed by
ConvDet , the total model size is still less than MB. The in-ference speed of our model can reach . FPS with inputimage resolution of 1242x375. Benefiting from the smallmodel size and activation size, SqueezeDet has a muchsmaller memory footprint and requires fewer DRAM ac-cesses, thus it consumes only . J of energy per image ona TITAN X GPU, which is about 84X less than a Faster R-CNN model described in [2]. SqueezeDet is also very ac-curate. One of our trained SqueezeDet models achieved thebest average precision in all three difficulty levels of cyclistdetection in the KITTI object detection challenge [9].The rest of the paper is organized as follows. We firstreview related work in section 2. Then, we introduce ourdetection pipeline, the
ConvDet layer, the training protocoland network design of SqueezeDet in section 3. In section 4,we report our experiments on the KITTI dataset, and dis-cuss accuracy, speed, parameter size of our model. Due tolimited page length, we put energy efficiency discussion inthe supplementary material to this paper. We conclude thepaper in section 5.
2. Related Work
From 2005 to 2013, various techniques were appliedto advance the accuracy of object detection on datasetssuch as PASCAL [7]. In most of these years, versionsof HOG+SVM [5] or DPM [8] led the state-of-art accu-racy on these datasets. However, in 2013, Girshick et al .proposed Region-based Convolutional Neural Networks (R-CNN) [11], which led to substantial gains in object detec-tion accuracy. The R-CNN approach begins by identify-ing region proposals (i.e. regions of interest that are likelyto contain objects) and then classifying these regions usinga CNN. One disadvantage of R-CNN is that it computesthe CNN independently on each region proposal, leadingto time-consuming ( ≤ ≥ et al . ex-perimented with a number of strategies to amortize com-putation across the region proposals [13, 17, 10], culminat-ing in Faster R-CNN [22].An other model, R-FCN, is fully-convolutional and delivers accuracy that is competitive withR-CNN, but R-FCN is fully-convolutional which allows itto amortize more computation across the region proposals.There have been a number of works that have adaptedthe R-CNN approach to address object detection for au-tonomous driving. Almost all the top-ranked publishedmethods on the KITTI leader board are based on Faster R-CNN. [2] modified the CNN architecture to use shallowernetworks to improve accuracy. [3, 26] on the other hand Standard camera frame rate is 30 FPS, which is regarded as the bench-mark of the real-time speed. focused on generating better region proposals. Most ofthese methods focused on better accuracy, but to our knowl-edge, no previous methods have reported real-time infer-ence speeds on KITTI dataset.
Region proposals are a cornerstone in all of the objectdetection methods that we have discussed so far. How-ever, in YOLO (You Only Look Once) [21], region propo-sition and classification are integrated into one single stage.Compared with R-CNN and Faster R-CNN based methods,YOLO’s single stage detection pipeline is extremely fast,making YOLO the first CNN based general-purpose objectdetection model that achieved real-time speed.
For any particular accuracy level on a computer visionbenchmark, it is usually feasible to develop multiple CNNarchitectures that are able to achieve that level of accuracy.Given the same level of accuracy, it is often beneficial to de-velop smaller CNNs (i.e. CNNs with fewer model parame-ters), as discussed in [16]. AlexNet [18] and VGG-19 [23]are CNN model architectures that were designed for im-age classification and have since been modified to addressother computer vision tasks. The AlexNet model contains240MB of parameters, and it delivers approximately 80%top-5 accuracy on ImageNet [6] image classification. TheVGG-19 model contains 575MB of parameters and deliv-ers ∼
87% top-5 accuracy on ImageNet. However, modelswith fewer parameters can deliver similar levels of accuracy.The SqueezeNet [16] model has only 4.8MB of parame-ters (50x smaller than AlexNet), and it matches or exceedsAlexNet-level accuracy on ImageNet. The GoogLeNet-v1 [25] model only has 53MB of parameters, and it matchesVGG-19-level accuracy on ImageNet.
Fully-convolutional networks (FCN) were popularizedby Long et al ., who applied them to the semantic segmen-tation domain [20]. FCN defines a broad class of CNNs,where the output of the final parameterized layer is a gridrather than a vector. This is useful in semantic segmen-tation, where each location in the grid corresponds to thepredicted class of a pixel.FCN models have been applied in other areas as well.To address the image classification problem, a CNN needsto output a 1-dimensional vector of class probabilities.One common approach is to have one or more fully-connected layers , which by definition output a 1D vector– 1 × × Channels (e.g. [18, 23]). However, an alterna-tive approach is to have the final parameterized layer be aconvolutional layer that outputs a grid (H × W × Channels), By “parameterized layer,” we are referring to layers (e.g. convolu-tion or fully-connected) that have parameters that are learned from data.Pooling or ReLU layers are not parameterized layers because they have nolearned parameters. nd to then use average-pooling to downsample the grid to1 × × Channels to a vector of produce class probabilities(e.g. [16, 19]). Finally, the R-FCN method that we men-tioned earlier in this section is a fully-convolutional net-work.
3. Method Description
Inspired by YOLO [21], we also adopt a single-stage de-tection pipeline: region proposition and classification is per-formed by one single network simultaneously. As shown inFig.1, a convolutional neural network first takes an image asinput and extract a low-resolution, high dimensional featuremap from the image. Then, the feature map is fed it into the
ConvDet layer to compute bounding boxes centered around W × H uniformly distributed spatial grids. Here, W and H are number of grid centers along horizontal and verticalaxes. Filtering ConvDet feature map Bounding boxes Final detec9ons Input image
Figure 1. SqueezeDet detection pipeline. A convolutional neuralnetwork extracts a feature map from the input image and feeds itinto the
ConvDet layer. The
ConvDet layer then computes bound-ing boxes centered around W × H uniformly distributed grid cen-ters. Each bounding box is associated with confidence score and C conditional class probabilities. Then, we keep the top N boud-ing boxes with highest confidence and use NMS to filter them toget the final detections. Each bounding box is associated with C + 1 values,where C is the number of classes to distinguish, and theextra is for the confidence score, which indicates howlikely does the bounding box actually contain an object.Similarly to YOLO [21], we define the confidence score as P r ( Object ) ∗ IOU predtruth . A high confidence score impliesa high probability that an object of interest does exist andthat the overlap between the predicted bounding box andthe ground truth is high. The other C scalars represents theconditional class probability distribution given that the ob-ject exists within the bounding box. More formally, we de-note the conditional probabilities as P r ( class c | Object ) , c ∈ [1 , C ] . We assign the label with the highest conditionalprobability to this bounding box and we use max c P r ( class c | Object ) ∗ P r ( Object ) ∗ IOU predtruth as the metric to estimate the confidence of the bounding boxprediction.Finally, we keep the top N bounding boxes with thehighest confidence and use Non-Maximum Suppression(NMS) to filter redundant bounding boxes to obtain the finaldetections. During inference, the entire detection pipelineconsists of only one forward pass of one neural networkwith minimal post-processing. The
SqueezeDet detection pipeline is inspired byYOLO [21]. But as we will describe in this section, thedesign of the
ConvDet layer enables SqueezeDet to gener-ate tens-of-thousands of region proposals with much fewermodel parameters compared to YOLO.
ConvDet is essentially a convolutional layer that istrained to output bounding box coordinates and class prob-abilities. It works as a sliding window that moves througheach spatial position on the feature map. At each position,it computes K × (4 + 1 + C ) values that encode the bound-ing box predictions. Here, K is the number of referencebounding boxes with pre-selected shapes. Using the nota-tion from [22], we call these reference bounding boxes asanchor. Each position on the feature map corresponds toa grid center in the original image, so each anchor can bedescribed by 4 scalars as (ˆ x i , ˆ y j , ˆ w k , ˆ h k ) , i ∈ [1 , W ] , j ∈ [1 , H ] , k ∈ [1 , K ] . Here ˆ x i , ˆ y i are spatial coordinates of thereference grid center ( i, j ) . ˆ w k , ˆ h k are the width and heightof the k -th reference bounding box. We used the methoddescribed by [2] to select reference bounding box shapes tomatch the data distribution.For each anchor ( i, j, k ) , we compute relative coor-dinates ( δx ijk , δy ijk , δw ijk , δh ijk ) to transform the anchorinto a predicted bounding box, as shown in Fig. 2. Follow-ing [12], the transformation is described by x pi = ˆ x i + ˆ w k δx ijk ,y pj = ˆ y j + ˆ h k δy ijk ,w pk = ˆ w k exp( δw ijk ) ,h pk = ˆ h k exp( δh ijk ) , (1)where x pi , y pj , w pk , h pk are predicted bounding box coordi-nates. As explained in the previous section, the other C + 1 outputs for each anchor encode the confidence score for thisprediction and conditional class probabilities. ConvDet is similar to the last layer of RPN in Faster R-CNN [22]. The major difference is that, RPN is regardedas a “weak” detector that is only responsible for detecting onf: 0.75 Car: 0.8 Bike: 0..1 Person:0.1 anchors Bounding box transforma9on Detec9ons
Figure 2. Bounding box transformation. Each grid center has K anchors with pre-selected shapes. Each anchor is transformed toits new position and shape using the relative coordinates computedby the ConvDet layer. Each anchor is associated with a confidencescore and class probabilities to predict the category of the objectwithin the bounding box. whether an object exists and generating bounding box pro-posals for the object. The classification is handed over tofully connected layers, which are regarded as a “strong”classifier. But in fact, convolutional layers are “strong”enough to detect, localize, and classify objects at the sametime.For simplicity, we denote the detection layers ofYOLO [21] as
FcDet (only counting the last two fully con-nected layers). Compared with
FcDet , the
ConvDet layerhas orders of magnitude fewer parameters and is still ableto generate more region proposals with higher spatial res-olution. The comparison between
ConvDet and
FcDet isillustrated in Fig. 3.Assume that the input feature map is of size ( W f , H f , Ch f ) , W f is the width of the feature map, H f is the height, and Ch f is the number of input channels tothe detection layer. Denote ConvDet ’s filter width as F w and height as F h . With proper padding/striding strategy,the output of ConvDet keeps the same spatial dimension asthe feature map. To compute K × (4 + 1 + C ) outputs foreach reference grid, the number of parameters required bythe ConvDet layer is F w F h Ch f K (5 + C ) .The FcDet layer described in [21] is comprised of twofully connected layers. Using the same notation for the in-put feature map and assuming the number of outputs of the f c layer is F fc , then the number of parameters in the f c layer is W f H f Ch f F fc . The second fully connected layerin [21] generates C class probabilities as well as K × (4+1) bounding box coordinates and confidence scores for eachof the W o × H o grids. Thus, the number of parametersin the f c layer is F fc W o H o (5 K + C ) . The total num-ber of parameters in these two fully connected layers is RP cls X Ch f K (5 + C ) ConvDet
X X F w F h Ch f K (5 + C ) FcDet
X X F fc ( W f H f Ch f + W o H o (5 K + C )) Table 1. Comparison between RPN,
ConvDet and
FcDet . RPstands for region proposition. cls stands for classification. F fc ( W f H f Ch f + W o H o (5 K + C )) .In [21], the input feature map is of size 7x7x1024. F fc = 4096 , K = 2 , C = 20 , W o = H o = 7 , thus thetotal number of parameters required by the two fully con-nected layers is approximately × . If we keep thefeature map sizes, number of output grid centers, classes,and anchors the same, and use 3x3 ConvDet , it would onlyrequire × × × × ≈ . × parameters, whichis 460X smaller than FcDet . The comparison of RPN,
Con-vDet and
FcDet is illustrated in Fig. 3 and summarized inTable 1.
Unlike Faster R-CNN [22], which deploys a (4-step) al-ternating training strategy to train RPN and detector net-work, our SqueezeDet detection network can be trainedend-to-end, similarly to YOLO [21].To train the
ConvDet layer to learn detection, localizationand classification, we define a multi-task loss function: λ bbox N obj W X i =1 H X j =1 K X k =1 I ijk [( δx ijk − δx Gijk ) + ( δy ijk − δy Gijk ) +( δw ijk − δw Gijk ) + ( δh ijk − δh Gijk ) ]+ W X i =1 H X j =1 K X k =1 λ + conf N obj I ijk ( γ ijk − γ Gijk ) + λ − conf W HK − N obj ¯ I ijk γ ijk + 1 N obj W X i =1 H X j =1 K X k =1 C X c =1 I ijk l Gc log( p c ) . (2)The first part of the loss function is the bounding boxregression. ( δx ijk , δy ijk , δw ijk , δh ijk ) corresponds to therelative coordinates of anchor- k located at grid center- ( i, j ) .They are outputs of the ConvDet layer. The ground truthbounding box δ Gijk , or ( δx Gijk , δy
Gijk , δw
Gijk , δh
Gijk ) , is com-puted as: δx Gijk = ( x G − ˆ x i ) / ˆ w k ,δy Gijk = ( y G − ˆ y j ) / ˆ h k ,δw Gijk = log( w G / ˆ w k ) ,δh Gijk = log( h G / ˆ h k ) . (3)Note that Equation 3 is essentially the inverse transforma-tion of Equation 1. ( x G , y G , w G , h G ) are coordinates of f H f Ch f H f W f K ⇥ (4 + 1) Feature map 1x1 conv Region proposals K ⇥ (4 + 1) (a) Last layer of Region Proposal Network (RPN) is a 1x1 convolution with K × (4 + 1) outputs. is the number of relative coordinates, and is theconfidence score. It’s only responsible for generating region proposals. Theparameter size for this layer is Ch f × K × . W f H f Ch f H f W f K ⇥ (4 + 1 + C ) Feature map convolu9on Detec9on output K ⇥ (4 + 1 + C ) F w ⇥ F h (b) The ConvDet layer is a F w × F h convolution with output size of K × (5 + C ) . It’s responsible for both computing bounding boxesand classifying the object within. The parameter size for this layer is F w F h Ch f K (5 + C ) . W f H f Ch f Feature map FC1 FC2 K ⇥ (4+1)+ C Detec9on output H f W f FC1 output F fc F fc F fc H o W o W o H o ( K (4 + 1) + C ) (c) The detection layer of YOLO [21] contains 2 fully connected lay-ers. The first one is of size W f H f Ch f F fc . The second one is of size F fc W o H o K (5 + C ) . Figure 3. Comparing RPN,
ConvDet and the detection layer ofYOLO [21]. Activations are represented as blue cubes and layers(and their parameters) are represented as orange ones. Activationand parameter dimensions are also annotated. a ground truth bounding box. During training, we com-pare ground truth bounding boxes with all anchors and as-sign them to the anchors that have the largest overlap (IOU)with each of them. The reason is that we want to select the“closest” anchor to match the ground truth box such that thetransformation needed is reduced to minimum. I ijk evalu-ates to 1 if the k -th anchor at position- ( i, j ) has the largest overlap with a ground truth box, and to 0 if no ground truthis assigned to it. This way, we only include the loss gener-ated by the “responsible” anchors. As there can be multipleobjects per image, we normalize the loss by dividing it bythe number of objects.The second part of the loss function is confidence scoreregression. γ ijk is the output from the ConvDet layer, rep-resenting the predicted confidence score for anchor- k atposition- ( i, j ) . γ Gijk is obtained by computing the IOU ofthe predicted bounding box with the ground truth boundingbox. Same as above, we only include the loss generatedby the anchor box with the largest overlap with the groundtruth. For anchors that are not “responsible” for the detec-tion, we penalize their confidence scores with the ¯ I ijk γ ijk term, where ¯ I ijk = 1 − I ijk . Usually, there are much moreanchors that are not assigned to any object. In order to bal-ance their influence, we use λ + conf and λ − conf to adjust theweight of these two loss components. By definition, theconfidence score’s range is [0, 1]. To guarantee that γ ijk falls into that range, we feed the corresponding ConvDet output into a sigmoid function to normalize it.The last part of the loss function is just cross-entropyloss for classification. l Gc ∈ { , } is the ground truth labeland p c ∈ [0 , , c ∈ [1 , C ] is the probability distributionpredicted by the neural net. We used softmax to normalizethe corresponding ConvDet output to make sure that p c isranged between [0 , .The hyper-parameters in Equation 2 are selected empir-ically. In our experiments, we set λ bbox = 5 , λ + conf =75 , λ − conf = 100 . This loss function can be optimized di-rectly using back-propagation. So far in this section, we described the single-stage de-tection pipeline, the
ConvDet layer, and the end-to-endtraining protocol. These parts are universal and can workwith various CNN architectures, including VGG16[24],ResNet[15], etc. When choosing the “backbone” CNNstructure, our focus is mainly on model size and energy ef-ficiency, and SqueezeNet[16] is our top candidate.
Model size.
SqueezeNet is built upon
Fire Module ,which is comprised of a squeeze layer as input, and twoparallel expand layers as output. The squeeze layer is a 1x1convolutional layer that compresses an input tensor withlarge channel size to one with the same batch and spatialdimension, but smaller channel size. The expand layer isa mixture of 1x1 and 3x3 convolution filters that takes thecompressed tensor as input, retrieve the rich features andoutput an activation tensor with large channel size. The al-ternating squeeze and expand layers effectively reduces pa-rameter size without losing too much accuracy.
Energy efficiency.
Different operations involved in neu-ral network inference have varying energy needs. The mostxpensive operation is DRAM access, which uses 100 timesmore energy than SRAM access and floating point opera-tions [14]. Thus, we want to reduce DRAM access as muchas possible.The most straightforward strategy to reduce DRAM ac-cess is to use small models which reduces memory accessfor parameters. An effective way to reduce parameter sizeis to use convolutional layers instead of fully connectedlayers when possible. Convolution parameters can be ac-cessed once and reused across all neighborhoods of all dataitems (if batch >
1) of the input data. However, the FC layeronly exposes parameter reuse opportunities in the “batch”dimension, and each parameter is only used on one neigh-borhood of the input data. Besides model size, another im-portant aspect is to control the size of intermediate activa-tions. Assume the SRAM size of the computing hardware is16MB, the SqueezeNet model size is 5MB. If the total sizeof activation output of any two consecutive layers is lessthan 11MB, then all the memory accesses can be completedin SRAM, no DRAM accesses are needed. A detailed en-ergy efficiency discussion will be provided as supplemen-tary material to this paper.In this paper, we adopted two versions of the SqueezeNetarchitecture. The first one is the SqueezeNet v1.1 model with . MB of model size and > . ImageNet top-5accuracy. The second one is a more powerful SqueezeNetvariation with squeeze ratio of . , . of ImageNetaccuracy and MB of model size [16]. In this paper, wedenote the first model as SqueezeDet and the second one asSqueezeDet+. We pre-train these two models for ImageNetclassification, then we add two fire modules with randomlyinitialized weight on top of the pretrained model, and con-nect to the
ConvDet layer.
4. Experiments
We evaluated our model on the KITTI [9] object detec-tion dataset, which is designed with autonomous driving inmind. We analyzed our model’s accuracy measured by av-erage precision (AP), recall, speed and model size, and thencompare with other top ranked methods on the KITTI leaderboard. Next, we analyzed the trade-off between accuracyand cost in terms of model size, FLOPS and activation sizeby tuning several key hyperparameters. We implementedour model’s training, evaluation, error analysis and visu-alization pipeline using Tensorflow [1], compiled with thecuDNN [4] computational kernels. The energy efficiencyexperiments of our model will be reported in the supple-mentary material.
Experimental setup.
In our experiments, unless speci-fied otherwise, we scaled all the input images to 1242x375. https://github.com/DeepScale/SqueezeNet/ We randomly split the training images in half intoa training set and a validation set. Our average precision(AP) results are on the validation set. We used Stochas-tic Gradient Descent with momentum to optimize the lossfunction. We set the initial learning rate to . , learn-ing rate decay factor to . and decay step size to .Instead of using a fixed number of steps, we trained ourmodel all the way until the mean average precision (mAP) on the training set converges, and then evaluate the modelon the validation set. Unless specifically specified, we usedbatch size of 20. We adopted data augmentation techniquessuch as random cropping and flipping to reduce overfitting.We trained our model to detect 3 categories of object, car,cyclist, pedestrian and used 9 anchors for each grid in ourmodel. At the inference stage, we only kept the top 64 de-tections with highest confidence, and use NMS to filter thebounding boxes. We used NVIDIA TITAN X GPUs for ourexperiments. Average Precision.
The detection accuracy, measuredby average precision is shown in Table 2. Our proposedSqueezeDet+ model achieved the best AP in all three diffi-culty levels of cyclist detection on the KITTI leader board.Its mean average precision of all 3 difficulty levels in 3 cat-egories outperforms the top published methods [26, 3]. Toevaluate whether
ConvDet can be applied to other backboneCNN architectures, we appended
ConvDet to the convolu-tion layers of the VGG16 and ResNet50 models. In Table 2,observe that both of these models achieved competitive APespecially on car and cyclist detection. Example of errordetections in different types are visualized in Fig. 4.
Recall.
Recall is essential for the safety of autonomousvehicles, so we now analyze the recall of our proposedmodels. For each image with resolution of 1242x375,SqueezeDet generates in total 15048 bounding box predic-tions. It’s intractable to perform non-maximum suppressionon this many bounding boxes because of the quadratic timecomplexity of NMS with respect to number of boundingboxes. Thus we only kept the top 64 predictions to feed intoNMS. An interesting question to ask is, how does the num-ber of bounding boxes kept affect recall? We tested this withthe following experiment: First, we collect all the boundingbox predictions and sort them by their confidence. Next, foreach image, we choose the top N box bounding box predic-tions, and sweep N box from 8 to 15048. Then, we evaluatethe overall recall for all difficulty levels of all categories.The Recall- N box curve is plotted in Fig. 5. As we couldsee, for SqueezeDet and its strengthened model, the top 64bounding boxes’ overall recall is already larger than 80%.If using all the bounding boxes, the SqueezeDet models canachieve and overall recall. Increasing the imagesize by 1.5X, the total number of bounding boxes increased Mean of average precision in 3 difficulty levels (easy, medium, hard)of 3 categories (car, cyclist, pedestrian).ar cyclist pedestrian mAP model size speedmethod E M H E M H E M H (MB) (FPS)SubCNN [26] 90.8 ? ? SqueezeDet+ (ours) 90.4 87.1 78.9
ConvDet (ours) 93.5 88.1 79.2 85.2 78.4 75.2 77.9 69.1 65.1 79.1 57.4 16.6ResNet50 +
ConvDet (ours) 92.9 87.9
Table 2. Summary of detection accuracy, model size and inference speed of different models on KITTI object detection challenge. ? denotes that it is from an anonymous submissions, thus citation is not available. (a) Example of a background error. The detector is confusedby a car mirrored in the window. (b) Classification error. The detector predict a cyclist to be apedestrian.(c) Localization error. The predicted bounding box doesn’thave an IOU > . with the ground truth. (d) Missed object. The missed car is highly truncated and over-lapped with other cars. Figure 4. Example of detection errors. to , and the maximum recall using all bounding boxesincreases to 95%. Figure 5. Overall recall vs N obj for SqueezeDet and SqueezeDet+models. We also tried to re-scale the input image by 1.5X and0.75X. SqueezeDet and SqueezeDet+ model achieved the best re-call of 0.91 and 0.92 with all bounding boxes. SqueezeDet with1.5X image resolution achieved 0.95. SqueezeDet with 0.75X im-age resolution achieved 0.90. Speed.
Our models are the first to achieve real-time in-ference speed on KITTI dataset. To better understand the landscape, we collected statistics of 40 submissions of cy-clist detection on the KITTI dataset, plotted their inferencespeed vs mean average precision of three difficulty levels ofthe cyclist category in Fig.6(a). At the time when this pa-per is written, the fastest model on the KITTI leader boardis an anonymous submission named PNET with 10FPS ofinference speed. Our proposed SqueezeDet model achieved57.2 FPS with much better accuracy compared with PNET.With the stronger SqueezeDet+ model, we still obtained aspeed of 32.1 FPS. With VGG16 and ResNet50 model, theinference speed is slightly slower, but still faster than all theexisting KITTI submissions, as can be seen in Table 2 andFig.6(a).
Model size.
Since model size is not reported on theKITTI leader board, We compare our proposed models withFaster-RCNN based models from [2]. We plotted the modelsize and their mean average precision for 3 difficulty levelsof the car category in Fig. 6(b) and summarized them in Ta-ble 2. As can be seen in Table 2, the SqueezeDet model is61X smaller than the
Faster R-CNN + VGG16 model, andit is 30X smaller than the
Faster R-CNN + AlexNet model.n fact, almost of the parameters of the VGG16 modelare from the fully connected layers. Thus, after we replacethe fully connected layers and RPN layer with
ConvDet , themodel size is only . MB. Compared with YOLO [21]which is comprised of 24 convolutional layers, two fullyconnected layers with a model size of 753MB, SqueezeDet,without any compression, is 95X smaller. I n f e r e n c e s p ee d ( f p s ) mAP (%) SqueezeDet SqueezeDet+ ResNet50+ConvDet VGG16+ConvDet (a) Inference speed vs mean average precision for cyclist detection. Eachpoint represents one method’s speed-vs-accuracy tradeoff. M o d e l S i z e ( M B ) mAP (%) SqueezeDet SqueezeDet+ VGG16+ ConvDet Faster R-CNN + AlexNet Faster R-CNN + VGG16 ResNet50+ ConvDet (b) Model size vs. mean average precision for car detection. Each point onthis plane represents a method’s model size and accuracy tradeoff.
Figure 6. Comparison of different methods’ model size, inferencespeed, and accuracy on the KITTI dataset.
We conducted design space exploration to evaluate somekey hyper-parameters’ influence on our model’s overalldetection accuracy (measured in mAP). Meanwhile, wealso investigated the “cost” of these variations in terms ofFLOPs, inference speed, model size and memory footprint.The results are summarized in Table 3, where the first rowis our SqueezeDet architecture, subsequent rows are modi-fications to SqueezeDet, and the final row is SqueezeDet+.
Image resolution.
For object detection, increasing im-age resolution is often an effective approach to improve de-tection accuracy [2]. But, larger images lead to larger ac-tivations, more FLOPs, longer training time, etc. We nowevaluate some of these tradeoffs. In our experiments, wescaled the image resolution by . X and . X receptively.
ActivationModel MemorymAP Speed FLOPs Size FootprintDSE (%) (FPS) × (MB) (MB)SqueezeDet 76.7 57.2 9.7 7.9 117.0scale-up 72.4 31.3 22.5 7.9 263.3scale-down 73.2 92.5 5.3 7.9 65.816 anchors 66.9 51.4 11.0 9.4 117.4SqueezeDet+ 80.4 32.1 77.2 26.8 252.7 Table 3. Design space exploration for SqueezeDet. Different ap-proaches with their accuracy, FLOPs per image, inference speed,model size and activation memory footprint. The speed, FLOPSand activation memory footprint are measured for batch size of1. We used mean average precision (mAP) to evaluate the overallaccuracy on the KITTI object detection task.
With larger input image, the training becomes much slower,so we reduced the batch size to 10. As we can see in Table 3,scaling up the input image actually decreases the mAP andalso leads to more FLOPs, lower speed, and larger mem-ory footprint. We also do an experiment with decreasingthe image size. Scaling down the image leads to an aston-ishing 92.5 FPS of inference speed and a smaller memoryfootprint, though it suffers from a 3 percentage point dropin mean-average precision.
Number of anchors.
Another hyper-parameter to tuneis the number of anchors. Intuitively, the more anchors touse, the more bounding box proposals are to be generated,thus should result in a better accuracy. However, in our ex-periment in Table 3, using more anchors actually leads tolower accuracy. But, it also shows that for models that use
ConvDet , increasing the number of anchors only modestlyincreases the model size, FLOPs, and memory footprint.
Model architecture.
As we discussed before, by using amore powerful backbone model with more parameters sig-nificantly improved accuracy (See Table 3). But, this mod-ification also costs substantially more in terms of FLOPs,model size and memory footprint.
5. Conclusion
We proposed SqueezeDet, a fully convolutional neuralnetwork for real-time object detection. We integrated theregion proposition and classification into
ConvDet , which isorders of magnitude smaller than its fully-connected coun-terpart. With the constraints of autonomous driving in mind,our proposed SqueezeDet and SqueezeDet+ models are de-signed to be small, fast, energy efficient, and accurate. Onall of these metrics, our models advance the state-of-the-art.
Acknowledgments
Research partially funded by the Berkeley Deep Drive(BDD) Industry Consortium, Samsung Global ResearchOutreach (GRO) and BMW. eferences [1] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen,C. Citro, G. S. Corrado, A. Davis, J. Dean, M. Devin, S. Ghe-mawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia,R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Man´e,R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster,J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker,V. Vanhoucke, V. Vasudevan, F. Vi´egas, O. Vinyals, P. War-den, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. Tensor-Flow: Large-scale machine learning on heterogeneous sys-tems.
Google Technical Report , 2015. 6[2] K. Ashraf, B. Wu, F. N. Iandola, M. W. Moskewicz, andK. Keutzer. Shallow networks for high-accuracy road object-detection. arXiv:1606.01561 , 2016. 2, 3, 7, 8[3] Z. Cai, Q. Fan, R. Feris, and N. Vasconcelos. A unifiedmulti-scale deep convolutional neural network for fast objectdetection. In
ECCV , 2016. 2, 6, 7[4] S. Chetlur, C. Woolley, P. Vandermersch, J. Cohen, J. Tran,B. Catanzaro, and E. Shelhamer. cuDNN: efficient primitivesfor deep learning. arXiv:1410.0759 , 2014. 6[5] N. Dalal and B. Triggs. Histograms of oriented gradients forhuman detection. In
CVPR , 2005. 2[6] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A large-scale hierarchical image database.In
CVPR , 2009. 2[7] M. Everingham, L. V. Gool, C. K. I. Williams, J. Winn, andA. Zisserman. The pascal visual object classes (voc) chal-lenge.
IJCV , 2010. 2[8] P. F. Felzenszwalb, R. B. Girshick, D. McAllester, and D. Ra-manan. Object detection with discriminatively trained part-based models.
PAMI , 2010. 2[9] A. Geiger, P. Lenz, and R. Urtasun. Are we ready for au-tonomous driving? the kitti vision benchmark suite. In
CVPR , 2012. 1, 2, 6[10] R. Girshick. Fast r-cnn. In
ICCV , 2015. 2[11] R. B. Girshick, J. Donahue, T. Darrell, and J. Malik. Richfeature hierarchies for accurate object detection and semanticsegmentation. In
CVPR , 2014. 2[12] R. B. Girshick, J. Donahue, T. Darrell, and J. Malik. Sup-plementary material: Rich feature hierarchies for accurateobject detection and semantic segmentation. In
CVPR , 2014.3[13] R. B. Girshick, F. N. Iandola, T. Darrell, and J. Malik. De-formable part models are convolutional neural networks. In
CVPR , 2015. 2[14] S. Han, X. Liu, H. Mao, J. Pu, A. Pedram, M. A. Horowitz,and W. J. Dally. EIE: efficient inference engine on com-pressed deep neural network. arXiv:1602.01528 , 2016. 5[15] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learningfor image recognition. arXiv:1512.03385 , 2015. 5[16] F. N. Iandola, S. Han, M. W. Moskewicz, K. Ashraf, W. J.Dally, and K. Keutzer. SqueezeNet: Alexnet-level accu-racy with 50x fewer parameters and < arXiv:1602.07360 , 2016. 1, 2, 3, 5, 6[17] F. N. Iandola, M. W. Moskewicz, S. Karayev, R. B. Girshick,T. Darrell, and K. Keutzer. DenseNet: implementing efficientconvnet descriptor pyramids. arXiv:1404.1869 , 2014. 2 [18] A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNetClassification with Deep Convolutional Neural Networks. In NIPS , 2012. 2[19] M. Lin, Q. Chen, and S. Yan. Network in network. In
ICLR ,2014. 3[20] J. Long, E. Shelhamer, and T. Darrell. Fully convolutionalnetworks for semantic segmentation. In
CVPR , 2015. 2[21] J. Redmon, S. K. Divvala, R. B. Girshick, and A. Farhadi.You only look once: Unified, real-time object detection. In
CVPR , 2016. 1, 2, 3, 4, 5, 8[22] S. Ren, K. He, R. Girshick, and J. Sun. Faster r-cnn: Towardsreal-time object detection with region proposal networks. In
NIPS , 2015. 2, 3, 4[23] K. Simonyan and A. Zisserman. Very deep con-volutional networks for large-scale image recognition. arXiv:1409.1556 , 2014. 2[24] K. Simonyan and A. Zisserman. Very deep con-volutional networks for large-scale image recognition. arXiv:1409.1556 , 2014. 5[25] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed,D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich.Going deeper with convolutions. arXiv:1409.4842 , 2014. 2[26] Y. Xiang, W. Choi, Y. Lin, and S. Savarese. Subcategory-aware convolutional neural networks for object proposalsand detection. arXiv:1604.04693 , 2016. 2, 6, 7 upplementary Material: Designing Low Power Neural Network Architectures
Bichen Wu , Alvin Wan , Forrest Iandola , , Peter H. Jin , Kurt Keutzer , UC Berkeley , DeepScale { bichen, alvinwan, phj, keutzer } @berkeley.edu, [email protected]
1. Low Power Neural Net Design Guideline
Different operations involved in the computation of aneural network consume different amounts of energy. Ac-cording to [5], a DRAM access consumes two orders ofmagnitude more energy than a SRAM access or a floatingpoint arithmetic operation. In this work, our main focus ison reducing memory accesses.On-chip SRAM (Static Random Access Memory) andoff-chip DRAM (Dynamic Random Access Memory) arethe two major types of memory in computer hardware.Compared to off-chip DRAM, on-chip SRAM consumesabout two orders of magnitude less energy, and SRAM readand write operations have lower latency and higher band-width than accessing off-chip DRAM. However, SRAM re-quires more transistors to store the same amount of datacompared to DRAM. Thus modern processors typicallyhave a large off-chip DRAM-based main memory and asmall ( e.g. MB) SRAM-based cache. During computa-tion, processors prioritize SRAM for faster speed and lowerenergy consumption. But if the data size required for com-putation exceeds the on-chip SRAM capacity, processorswill have to use off-chip DRAM.The degree to which programmers can control the uti-lization of on-chip SRAM versus off-chip DRAM dependsconsiderably on the hardware. For example, GPU program-ming typically involves manual management of SRAM-based register files and shared memory [3]. On ther otherhand modern CPU processors are the results of decades ofarchitecture research aimed at simplifying programming ingeneral, and memory access in particular. As a result theprogrammer can typically only generally encourage cachelocality by the structure of data access in the program, leav-ing the processor hardware to improve data locality throughcache protocols and pre-fetching. Thus, a simple and gen-eral rule to reduce energy consumed by memory accessesis to reduce the total memory footprint of the computations.In neural net computations this includes reducing the modelparameters and intermediate layer activations. For hardwaredevelopers who aim to deploy the neural network on cus-tom hardware ( e.g. on an FPGA), more granular memoryscheduling becomes possible. With a neural net model with fewer model parameters and a perfect scheduling strategy,the hardware can cache all model parameters and activa-tions of any two consecutive layers within on-chip SRAM,and no accesses to off-chip DRAM are necessary. This canlead to significant energy savings.
2. Memory Footprint
In what follows we analyze the memory footprint ofSqueezeDet layer by layer. Details of the SqueezeDetmodel are shown in Table 1. The parameter size ofSqueezeDet is just . MB without compression, so it’s pos-sible for many processors to fit the entire model in on-chipSRAM and reuse the parameters in evaluations. The largestintermediate activation is the output of the conv1 layer with . MB. conv1 is immediately followed by a max poolinglayer. Potentially, we can fuse the implementation of maxpooling and convolution layers such that the output of conv1 can be immediately down-sampled by 4X and we only needto store about MB of activation to on-chip SRAM. Next,the maxpool1 output is fed into fire2 . The “squeeze” layerof the fire module compresses the input tensor and generatesan activation with smaller channel size, and the two parallel“expand” layers of the fire module retrieve the compressedchannel information and generate a larger output activation.The alternating “squeeze” and “expand” layers of the firemodule effectively reduce the total size of activations oftwo consecutive layers. The following fire modules haveincreasingly larger channel size, but max pooling layers areused to reduce spatial resolution to control the activationsize. Finally, even though the output of the final
ConvDet layer encodes thousands of bounding box proposals, its ac-tivation size is negligible.We counted the activation memory footprint for severalmodels, including SqueezeDet, variations thereof, and oth-ers. Our results are summarized in Table 2. As we can see,SqueezeDet has a much lower memory footprint and per-forms fewer FLOPs compared to other models, leading tobetter energy efficiency for SqueezeDet.1 a r X i v : . [ c s . C V ] N ov ctivationModel Memory Average Inference EnergySize FLOPs Footprint GPU Power Speed Efficiency mAP ? model (MB) × (MB) (W) (FPS) (J/frame) (%)SqueezeDet 7.9 9.7 117.0 80.9 57.2 1.4 76.7SqueezeDet: scale-up 7.9 22.5 263.3 89.9 31.3 2.9 72.4SqueezeDet: scale-down 7.9 5.3 65.8 77.8 92.5 0.84 73.2SqueezeDet: 16 anchors 9.4 11.0 117.4 82.9 51.4 1.6 66.9SqueezeDet+ 26.8 77.2 252.7 128.3 32.1 4.0 80.4VGG16+ConvDet 57.4 288.4 540.4 153.9 16.6 9.3 79.1ResNet50+ConvDet 35.1 61.3 369.0 95.4 22.5 4.2 76.1Faster-RCNN + VGG16 [1] 485 - - 200.1 1.7 117.7 -Faster-RCNN + AlexNet [1] 240 - - 143.1 2.9 49.3 -YOLO ??
753 - - 187.3 25.8 7.3 -
Table 2. Comparing SqueezeDet and other models in terms of Energy efficiency and other aspects. The default image resolution is1242x375, but the “SqueezeDet: scale-up” variation up-sampled input image’s height and width by 1.5X. The “scale-down” variationscaled image resolution by 0.75X. The default SqueezeDet model contains 9 anchors. But the 16-anchor variation contains 16 anchors foreach grid. ? The mAP denotes the mean average precision of 3 difficulty levels of 3 categories on KITTI dataset. It represents each model’sdetection accuracy on KITTI dataset. ?? We launched YOLO to detect , VOC 2007 test images and it took 192 seconds to finish. Wethen compute the inference speed as , / ≈ . FPS, which is slower than the speed reported in [6]. The input image to YOLO isscaled to 448x448. layer name/type ac Table 1. Layer specification of SqueezeDet. s x represents thenumber of 1x1 output filters in the squeeze layer, e x is numberof 1x1 filters in the expand layer and e x is number of 3x3 filtersin the expand layer. 3. Experiments We measured the energy consumption of SqueezeDetand the other models during the object detection evaluationof images from the KITTI dataset [4]. The default in-put image resolution is 1242x375, and the batch size is setto 1. Meanwhile, we measured the GPU power usage withNvidia’s system monitor interface ( nvidia-smi ). Wesampled the power reading with a fixed interval of 0.1 sec-ond. Then, we obtained the power-vs-time curve as shown in Fig 1. When the GPU is idle, it consumes about Wof power. Through the evaluation process, the GPU wentthrough several stages from idle to working and then toidle again. We denote the period with power measurement ≥ W as working period. Then, we divide the workingperiod evenly into 3 parts, and we take the measurementsfrom the middle part to compute the average GPU power.The energy consumption per image is then computed asAverage Power [Joule/Second]Inference Speed [Frame/Second] . We measured energy consumption of SqueezeDet andseveral other models using the above approach, and our ex-perimental results are listed in Table 2. SqueezeDet con-sumes only . J per image, which is 84 × less than theFaster R-CNN + VGG16 model. Scaling the image resolu-tion down by 0.75 × , the mAP drops by 3 percentage points,but the inference speed is 1.6 × faster and the energy con-sumption is less than J per image. With much better ac-curacy, SqueezeDet+ only consumes J per image, whichis > 10X more efficient than Faster R-CNN based meth-ods. We combined the convolutional layers of VGG16 andResNet50 with ConvDet, both models achieved much bet-ter energy efficiency compared with Faster R-CNN basedmodels.We also compared our models with YOLO. We useYOLO to detect , images from the VOC 2007 [2] testset. The input images are scaled to 448x448, batch size is 1.It took YOLO seconds to finish the evaluation. Usingthe same approach to measure the GPU power of YOLO,we compute the energy per frame of YOLO as 7.3J. Usingthe frame rate of 45FPS which is reported in [6], YOLO’senergy consumption per frame is 4.2J, which is comparable RCN+VGG16 SqueezeDet+ SqueezeDet Time (normalized) Power (W) Measurement period Figure 1. GPU power measured by nvidia-smi . Herewe plot power measurement curve of 3 models, SqueezeDet,SqueezeDet+, and Faster R-CNN + VGG16 model. We normal-ize the working period of 3 models to the same range of [0, 1]. Wedivide the working period evenly into 3 parts and use the middlepart to compute the average GPU power for each model. with SqueezeDet+. But note that input image (with size of1242x375) to SqueezeDet+ in our experiment contains 2Xmore pixels than the input image (448x448) to YOLO.Our experiments show that SqueezeDet and its variationsare very energy efficient compared with previous neural net-work based object detectors. References [1] K. Ashraf, B. Wu, F. N. Iandola, M. W. Moskewicz, andK. Keutzer. Shallow networks for high-accuracy road object-detection. arXiv:1606.01561 Proceedings ofthe 2012 45th Annual IEEE/ACM International Symposium onMicroarchitecture , pages 96–106, 2012. 1[4] A. Geiger, P. Lenz, and R. Urtasun. Are we ready for au-tonomous driving? the kitti vision benchmark suite. In CVPR ,2012. 2[5] S. Han, X. Liu, H. Mao, J. Pu, A. Pedram, M. A. Horowitz,and W. J. Dally. EIE: efficient inference engine on compresseddeep neural network. arXiv:1602.01528 , 2016. 1[6] J. Redmon, S. K. Divvala, R. B. Girshick, and A. Farhadi. Youonly look once: Unified, real-time object detection. In