← All articles

segmentationautonomous drivingefficient networks

A street-scene segmenter with about 600,000 parameters instead of tens of millions

Driver-assistance software needs to know what is in front of the car: road, pavement, pedestrian, vehicle. The best models for that job are big, and big models need expensive hardware. In this paper we built a much smaller one, SegFast-V2, and tested it against well-known networks on five street-scene datasets.

The problem

The task is called semantic segmentation. The computer looks at a photo and gives every single pixel a label, so the output is a colour-coded map of the scene. Networks that do this well, such as SegNet, UNet and PSPNet, hold tens of millions of numbers (the parameters, the adjustable settings a network learns during training). More parameters mean more memory and more arithmetic for every image.

Our concern was cheaper cars. Autonomous modules are mostly found in expensive vehicles, and we would like such facilities to reach the lower end of the price range too. Traffic in many countries is crowded and varied, so cheap driver assistance could have a large effect there. It has to run on modest hardware without a big drop in reliability.

The idea

SegFast-V2 extends SegFast, our earlier model. It follows the usual encoder-decoder shape: the first half squeezes the image down into compact features, and the second half grows them back into a full-size label map. Copies of early features are passed across to the second half so edges stay sharp. UNet works the same way.

The savings come from three tricks.

  • Spark modules. SqueezeNet has a building block called a fire module, which first squeezes the channels and then expands them. Our spark module is a smaller version of it, with depth-wise separable convolutions in place of the 3×3 filters of the expand step.
  • Depth-wise separable convolutions. An ordinary filter looks at all channels at once. Here one small spatial filter works on each channel alone, and a cheap 1×1 filter then mixes the channels. The weight count drops from Kh × Kw × C to Kh × Kw + C, so the saving grows in deep layers with many channels. We also apply this trick to the upsampling layers of the decoder.
  • Kernel factorization, new in V2. A filter is replaced by a chain of smaller ones. This cuts a 3×3 filter from 9 weights to 6 and a 5×5 filter from 25 to 12, so we could try bigger 5×5 filters without adding many parameters.
Block diagram of the SegFast-V2 network. A street photo enters at the top left, passes through a convolution, average pooling and spark modules that shrink it step by step, then through depth-wise separable transposed convolutions that grow it back into a segmentation map. Dotted arrows copy encoder features to the decoder.
The encoder (top row) uses spark modules. The decoder (bottom row) grows the features back, and the dotted arrows copy encoder features across.Source: Fig. 1 of the paper.

We also built SegFast-Mobile, which swaps our encoder for MobileNet, another model designed to be small. It lets us compare our encoder with that alternative. SegFast-Basic is an ablation (a version with one ingredient removed): the same network with ordinary convolutions in place of the separable ones.

What we found

We trained on BDD, CamVid, Cityscapes, Synthia and Mapillary, with images resized to 360 × 480 and no data augmentation. We measured pixel accuracy and mean intersection over union (mean IoU, the overlap between predicted and true regions, averaged over classes). We also timed a single image on a 16-thread Intel Xeon E5-2623 V4 CPU.

The SegFast family has about 600,000 parameters. SegFast has 603,288, SegFast-V2_3 has 599,380 and SegFast-V2_5 has 606,676. SegNet has 29,455,702, UNet 31,033,110, PSPNet 65,606,764 and FCN 134,507,010 (Table 2).

SegFast-V2_3 needs 0.360 s for a forward pass on a CPU, against 1.98 s for SegNet, 2.27 s for UNet, 2.06 s for PSPNet and 3.39 s for FCN (Table 3).

On accuracy, the paper says the SegFast family performs better than the fully convolutional network (FCN) and competes quite closely with SegNet, UNet and PSPNet. Averaged over the five datasets, pixel accuracy is 85.42% for SegFast-V2_3 and 85.56% for SegFast-V2_5. FCN reaches 81.05%, SegNet 86.42%, UNet 87.28% and PSPNet 88.68% (Table 4). On mean IoU, SegFast-V2_5 scores 0.4002, close to SegNet at 0.4003 and below PSPNet at 0.4540 (Table 5). The ablation shows a drop: SegFast-Basic, with ordinary convolutions, reaches 84.64% mean pixel accuracy (Table 4).

A grid of street photos from five datasets, each followed by the ground-truth label map and the outputs of FCN, SegNet, UNet, PSPNet and the SegFast models, shown as colour-coded regions.
Each column is one scene. Compare the SegFast rows with the labels row and with the larger networks above them.Source: Fig. 4 of the paper.

The paper suggests a different variant for each need. SegFast uses the least memory, 703 MB (Table 2). SegFast-V2_3 is the network of choice where speed matters most. When accuracy matters most, SegFast-Mobile seems the strongest: it reaches 87.63% mean pixel accuracy with 4,637,526 parameters (Table 2 and Table 4), still far fewer than the large networks.

Results in more detail

The five datasets differ a lot in size. CamVid is the smallest, with 12 classes and 367 training and 101 test images. Mapillary is the largest, with 66 classes and 18,000 training and 2000 test images. BDD has 20 classes (7000 training and 1000 test images), Cityscapes has 30 (2975 and 500) and Synthia has 13 (10,786 and 2621) (Table 1). Every network was trained and tested on each dataset, so the tables below have one column per dataset.

Table 2 puts the size of each network next to its memory use, measured for a single input image. SegFast-Basic is the ablation, the same network with ordinary convolutions. It has 2,965,976 parameters and needs 1232 MB, while SegFast needs 703 MB (Table 2).

Number of parameters and memory use of each network
ArchitectureParametersMemory (MB)
FCN134,507,0103447
SegNet29,455,7021515
UNet31,033,1101471
PSPNet65,606,7642357
SegFast-Mobile4,637,526829
SegFast-Basic2,965,9761232
SegFast603,288703
SegFast-V2_3599,3801101
SegFast-V2_5606,6761199
Lower is smaller. The paper reports the memory footprint for a single input image. Source: Table 2 of the paper.

Speed tells a similar story. The paper reports the time for one forward pass (labelling one image) and one backward pass (one learning step) on the CPU. SegFast-Mobile needs 0.66 s for the forward pass, SegFast-Basic 0.419 s, SegFast 0.389 s and SegFast-V2_5 0.409 s. For the backward pass SegFast-V2_3 needs 0.858 s, against 3.25 s for SegNet and 5.23 s for FCN (Table 3). The total training time is the backward-pass time multiplied by the number of samples and epochs. The fastest times came from the versions with kernel factorization, which the paper puts down to fewer floating-point operations. On strong GPUs the differences in time are much smaller, because a GPU runs so much in parallel, but that defeats the purpose of a network meant for low-end hardware.

Table 4 gives pixel accuracy on each dataset. The last column is the mean over the five datasets, with its standard deviation. Every network scores highest on Synthia.

Pixel-level accuracy on each dataset (%)
ArchitectureBDDCamVidCityScapeSynthiaMapillaryMean (± SD)
FCN75.3174.2284.2891.8179.6281.05 (± 7.21)
SegNet82.7988.7086.0892.0582.4686.42 (± 4.06)
UNet81.7787.7087.3995.4384.1187.28 (± 5.17)
PSPNet85.1790.7987.8493.6485.9888.68 (± 3.51)
SegFast-Mobile85.1289.2486.5193.4883.8187.63 (± 3.84)
SegFast-Basic80.4586.3182.6991.6582.1084.64 (± 4.46)
SegFast83.4885.0883.7193.5881.6385.50 (± 4.68)
SegFast-V2_381.4685.9584.1393.4882.1085.42 (± 4.84)
SegFast-V2_580.9286.7083.8693.6382.7085.56 (± 4.97)
Higher is better. SD is the standard deviation across the five datasets. Source: Table 4 of the paper.

The SegFast models are not behind everywhere. On BDD, SegFast-Mobile reaches 85.12% and PSPNet 85.17%. On Synthia, SegFast-V2_5 reaches 93.63% and SegNet 92.05%. On Mapillary, the dataset with the most classes, the five SegFast models score between 81.63% and 83.81%, while the four large networks range from 79.62% to 85.98% (Table 4).

Table 5 repeats the comparison with mean intersection over union, which averages over the classes so that small classes count as much as large ones. Mapillary gives the lowest value for every network and Synthia the highest.

Mean intersection over union on each dataset
ArchitectureBDDCamVidCityScapeSynthiaMapillaryMean (± SD)
FCN0.30760.33420.35030.53460.19100.3435 (± 0.1237)
SegNet0.34750.51740.37020.54300.22340.4003 (± 0.1314)
UNet0.34730.50030.39700.67670.25270.4348 (± 0.1621)
PSPNet0.40990.56320.41900.60400.27390.4540 (± 0.1323)
SegFast-Mobile0.37730.50300.38100.58100.24200.4169 (± 0.1302)
SegFast-Basic0.34340.44310.32100.53170.22060.3720 (± 0.1193)
SegFast0.35760.50000.34000.59100.21080.3999 (± 0.1481)
SegFast-V2_30.33600.42360.35000.57300.21600.3797 (± 0.1312)
SegFast-V2_50.33900.50120.34710.59190.22180.4002 (± 0.1461)
Higher is better. Source: Table 5 of the paper.

Averaged over the datasets, SegFast scores 0.3999 and SegFast-V2_3 scores 0.3797, SegFast-Mobile 0.4169, UNet 0.4348 and FCN 0.3435 (Table 5).

Discussion

Our conclusion is that a compact network can come close to the big ones. In the paper's words, the SegFast family performs better than FCN and competes quite closely with SegNet, UNet and PSPNet, while using far fewer parameters, less memory and less time per image. We also say plainly that the proposed network may not beat most of the larger networks on accuracy, and we argue that the trade-off may be acceptable in certain low-risk scenarios.

Each variant answers a different need. SegFast suits cases where memory matters most, SegFast-V2_3 cases where speed matters most, and SegFast-Mobile cases where performance cannot be compromised, since it seems the strongest while still being much smaller than the large networks. Kernel factorization cuts the parameter count but raises the memory footprint, because more activation maps have to be stored. The larger factorized 5 × 5 kernels did not improve the results significantly. We read this as a sign that the smallest kernels already work well enough for their size.

The comparison has limits. We left DeepLab out because its large field of view and conditional random fields add heavy overhead. Images were resized to 360 × 480 and no augmentation was used. The paper reports timings on a CPU only. We expect that even low-end GPUs could reach real-time performance, since the smallest model has a footprint of only about 700 MB. As a next step we suggest applying the same compression idea to SegNet, UNet and PSPNet.

Sources

The figures and tables listed here are taken from the paper cited at the top of this page; the numbers quoted in the text come from it too.

  • Figures: Fig. 1, Fig. 4
  • Tables: Table 1: classes and number of training and test images in each dataset; Table 2: parameters and memory use of each network; Table 3: forward-pass and backward-pass time of each network on a CPU; Table 4: pixel accuracy of each network on the five datasets; Table 5: mean intersection over union of each network on the five datasets

Acknowledgements

This work is sponsored by SERB (Government of India, order no. SB/S3/EECE/054/2016, dated 25/11/2016), and was carried out at the Centre for Microprocessor Application for Training Education and Research, CSE Department, Jadavpur University.

Cite the paper

Swarnendu Ghosh, A Pal, S Jaiswal, KC Santosh, N Das, M Nasipuri (2019). SegFast-V2: Semantic image segmentation with less parameters in deep learning for autonomous driving. International Journal of Machine Learning and Cybernetics, Vol. 10, No. 11, pp. 3145–3154 · Springer.

BibTeX
@article{ghosh2019segfast,
  author    = {Ghosh, Swarnendu and Pal, A and Jaiswal, S and Santosh, KC and Das, N and Nasipuri, M},
  title     = {{SegFast-V2:} Semantic image segmentation with less parameters in deep learning for autonomous driving},
  journal   = {International Journal of Machine Learning and Cybernetics},
  volume    = {10},
  pages     = {3145--3154},
  publisher = {Springer},
  year      = {2019},
  doi       = {10.1007/s13042-019-01005-5}
}