Skip to content

Latest commit

 

History

History
139 lines (100 loc) · 5.33 KB

README.md

File metadata and controls

139 lines (100 loc) · 5.33 KB

SemSegPaddle: A Paddle-based Framework for Deep Learning in Semantic Segmentation

This is a Paddle implementation of semantic segmentation models on multiple datasets, including Cityscapes, Pascal Context, and ADE20K.

Updates

  • [2020/01/08] We release PSPNet-ResNet101 and GloRe-ResNet101 models on Pascal Context and Cityscapes datasets.

Highlights

Synchronized Batch Normlization is important for segmenation.

  • The implementation is easy to use as it is pure-python, no any C++ extra extension libs.

  • Paddle provides sync_batch_norm.

Support models

We split our models into backbone and decoder network, where backbone network are transfered from classification networks.

Backbone:

  • ResNet
  • ResNeXt
  • HRNet
  • EfficientNet

Decoder:

Peformance

  • Performance of Cityscapes validation set.
Method Backbone lr BatchSize epoch mean IoU (Single-scale) Trained weights
PSPNet resnet101 0.01 8 80 78.1 pspnet_resnet_cityscapes_epoch_80.pdparams
GloRe resnet101 0.01 8 80 78.4 pspnet_resnet_pascalcontext_epoch_80.pdparams
  • Performance of Pascal-context validation set.
Method Backbone lr BatchSize epoch mean IoU (Single-scale) Trained weights
PSPNet resnet101 0.005 16 80 48.9 glore_resnet_cityscapes_epoch_80.pdparams
GloRe resnet101 0.005 16 80 48.4 glore_resnet_pascalcontext_epoch_80.pdparams

Environment

This repo is developed under the following configurations:

  • Hardware: 4 GPUs for training, 1 GPU for testing
  • Software: Centos 6.10, CUDA>=9.2 Python>=3.6, Paddle>=1.6

Quick start: training and testing models

1. Preparing data

Download the Cityscapes dataset. It should have this basic structure:

  cityscapes/
  ├── cityscapes_list
  │   ├── test.lst
  │   ├── train.lst
  │   ├── train+.lst
  │   ├── train++.lst
  │   ├── trainval.lst
  │   └── val.lst
  ├── gtFine
  │   ├── test
  │   ├── train
  │   └── val
  ├── leftImg8bit
  │   ├── test
  │   ├── train
  │   └── val
  ├── license.txt
  └── README

Download Pascal-Context dataset. It should have this basic structure:

  pascalContext/
  ├── GroundTruth_trainval_mat
  ├── GroundTruth_trainval_png
  ├── JPEGImages
  ├── pascal_context_train.txt
  ├── pascal_context_val.txt
  ├── README.md
  └── VOCdevkit

Then, create symlinks for the Cityscapes and Pascal-Context datasets

cd SemSegPaddle/data
ln -s $cityscapes ./
ln -s $pascalContext ./

2. Download pretrained weights

Downlaod pretrained resnet-101 weights file, and put it into the directory: ./pretrained_model

Then, run the following command:

  tar -zxvf  ./repretrained/resnet101_v2.tgz -C pretrained_model 

3. Training

select confiure file for training according to the DECODER_NAME, BACKBONE_NAME and DATASET_NAME.

CUDA_VISIBLE_DEVICES=0,1,2,3 python -m paddle.distributed.launch train.py  --use_gpu --use_mpio \
                                  --cfg ./configs/pspnet_res101_cityscapes.yaml 

4. Testing

select confiure file for testing according to the DECODER_NAME, BACKBONE_NAME and DATASET_NAME.

Single-scale testing:

CUDA_VISIBLE_DEVICES=0 python  eval.py --use_gpu \
                                       --use_mpio \
                                       --cfg ./configs/pspnet_res101_cityscapes.yaml 

Multi-scale testing:

CUDA_VISIBLE_DEVICES=0 python  eval.py --use_gpu \
                                       --use_mpio \
                                       --multi_scales \
                                       --cfg ./configs/pspnet_res101_cityscapes.yaml 

Contact

If you have any questions regarding the repo, please create an issue.