Home

Awesome

FasterSeg: Searching for Faster Real-time Semantic Segmentation [PDF]

Language grade: Python License: MIT

Wuyang Chen, Xinyu Gong, Xianming Liu, Qian Zhang, Yuan Li, Zhangyang Wang

In ICLR 2020.

Overview

<p align="center"> <img src="images/cityscapes_128x256.gif" alt="Cityscapes" width="300"/></br> <span align="center">Our predictions on Cityscapes Stuttgart demo video #0</span> </p>

We present FasterSeg, an automatically designed semantic segmentation network with not only state-of-the-art performance but also faster speed than current methods.

Highlights:

<p align="center"> <img src="images/table4.png" alt="Cityscapes" width="550"/></br> </p>

Methods

<p align="center"> <img src="images/figure1.png" alt="supernet" width="800"/></br> </p> <p align="center"> <img src="images/figure6.png" alt="fasterseg" width="500"/></br> </p>

Prerequisites

This repository has been tested on GTX 1080Ti. Configurations (e.g batch size, image patch size) may need to be changed on different platforms.

Installation

git clone https://github.com/chenwydj/FasterSeg.git
cd FasterSeg
pip install -r requirements.txt

Usage

0. Prepare the dataset

1. Search

cd search

1.1 Pretrain the supernet

We first pretrain the supernet without updating the architecture parameter for 20 epochs.

CUDA_VISIBLE_DEVICES=0 python train_search.py

1.2 Search the architecture

We start the architecture searching for 30 epochs.

CUDA_VISIBLE_DEVICES=0 python train_search.py

2. Train from scratch

2.1 Train the teacher network

<!-- * uncomment the `## train teacher model only ##` section in `config_train.py` and comment the `## train student with KL distillation from teacher ##` section. -->
CUDA_VISIBLE_DEVICES=0 python train.py

2.2 Train the student network (FasterSeg)

<!-- * uncomment the `## train student with KL distillation from teacher ##` section in `config_train.py` and comment the `## train teacher model only ##` section. -->
CUDA_VISIBLE_DEVICES=0 python train.py

3. Evaluation

Here we use our pretrained FasterSeg as an example for the evaluation.

cd train
<!-- * set the name of pretrained directory as `C.eval_path = "/path/to/pretrained/models/"` in `config_train.py`. -->
CUDA_VISIBLE_DEVICES=0 python train.py
<!-- * you will see the results like (will be also saved in the log file): -->

4. Test

We support generating prediction files (masks as images) during training.

5. Latency

5.0 Latency measurement tools

5.1 Measure the latency of the FasterSeg

CUDA_VISIBLE_DEVICES=0 python run_latency.py

5.2 Generate the latency lookup table:

CUDA_VISIBLE_DEVICES=0 python latency_lookup_table.py

which will generate an .npy file. Be careful not to overwrite the provided latency_lookup_table.npy in this repo.

Citation

@inproceedings{chen2020fasterseg,
  title={FasterSeg: Searching for Faster Real-time Semantic Segmentation},
  author={Chen, Wuyang and Gong, Xinyu and Liu, Xianming and Zhang, Qian and Li, Yuan and Wang, Zhangyang},
  booktitle={International Conference on Learning Representations},
  year={2020}
}

Acknowledgement