Home

Awesome

TorchSeg

This project aims at providing a fast, modular reference implementation for semantic segmentation models using PyTorch.

demo image

Highlights

Prerequisites

Updates

v0.1.1 (05/14/2019)

Model Zoo

Pretrained Model

Supported Model

Performance and Benchmarks

SS:Single Scale MSF:Multi-scale + Flip

PASCAL VOC 2012

MethodsBackboneTrainSetEvalSetMean IoU(ss)Mean IoU(msf)Model
FCN-32sR101_v1ctrain_augval71.26-
DFN(paper)R101_v1ctrain_augval79.6780.6<sup>*</sup>
DFN(ours)R101_v1ctrain_augval79.4081.40GoogleDrive

80.6<sup>*</sup>: this result reported in paper is further finetuned on train dataset.

Cityscapes

Non-real-time Methods

MethodsBackboneOHEMTrainSetEvalSetMean IoU(ss)Mean IoU(msf)Model
DFN(paper)R101_v1ctrain_fineval78.579.3
DFN(ours)R101_v1ctrain_fineval79.0980.41GoogleDrive
DFN(ours)R101_v1ctrain_fineval79.1680.53GoogleDrive
BiSeNet(paper)R101_v1ctrain_fineval-80.3
BiSeNet(ours)R101_v1ctrain_fineval79.0980.39GoogleDrive
BiSeNet(paper)R18train_fineval76.2178.57
BiSeNet(ours)R18train_fineval76.2878.00GoogleDrive
BiSeNet(paper)X39train_fineval70.172
BiSeNet(ours)<sup>*</sup>X39train_fineval70.3272.06GoogleDrive

Real-time Methods

MethodsBackboneOHEMTrainSetEvalSetMean IoUModel
BiSeNet(paper)R18train_fineval74.8
BiSeNet(ours)R18train_fineval74.83GoogleDrive
BiSeNet(paper)X39train_fineval69
BiSeNet(ours)<sup>*</sup>X39train_fineval68.51GoogleDrive

BiSeNet(ours)<sup>*</sup>: because we didn't pre-train the Xception39 model on ImageNet in PyTorch, we train this experiment from scratch. We will release the pre-trained Xception39 model in PyTorch and the corresponding experiment.

ADE

MethodsBackboneTrainSetEvalSetMean IoU(ss)Accuracy(ss)Model
PSPNet(paper)R50_v1ctrainval41.6880.04
PSPNet(ours)R50_v1ctrainval41.6579.74GoogleDrive
PSPNet(paper)R101_v1ctrainval41.9680.64
PSPNet(ours)R101_v1ctrainval42.8980.55GoogleDrive
PSANet(paper)R50_v1ctrainval41.9280.17
PSANet(ours)<sup>*</sup>R50_v1ctrainval41.6780.09GoogleDrive
PSANet(paper)R101_v1ctrainval42.7580.71
PSANet(ours)R101_v1ctrainval43.0480.56GoogleDrive

PSANet(ours)<sup>*</sup>: The original PSANet in the paper constructs the attention map with over-parameters, while we only predict the attention map with the same size of the feature map. The performance is almost similar to the original one.

To Do

Training

  1. create the config file of dataset:train.txt, val.txt, test.txt
    file structure:(split with tab)
    path-of-the-image   path-of-the-groundtruth
    
  2. modify the config.py according to your requirements
  3. train a network:

Distributed Training

We use the official torch.distributed.launch in order to launch multi-gpu training. This utility function from PyTorch spawns as many Python processes as the number of GPUs we want to use, and each Python process will only use a single GPU.

For each experiment, you can just run this script:

export NGPUS=8
python -m torch.distributed.launch --nproc_per_node=$NGPUS train.py

Inference

In the evaluator, we have implemented the multi-gpu inference base on the multi-process. In the inference phase, the function will spawns as many Python processes as the number of GPUs we want to use, and each Python process will handle a subset of the whole evaluation dataset on a single GPU.

  1. evaluate a trained network on the validation set:
    python3 eval.py
    
  2. input arguments:
    usage: -e epoch_idx -d device_idx [--verbose ] 
    [--show_image] [--save_path Pred_Save_Path]
    

Disclaimer

This project is under active development. So things that are currently working might break in a future release. However, feel free to open issue if you get stuck anywhere.

Citation

The following are BibTeX references. The BibTeX entry requires the url LaTeX package.

Please consider citing this project in your publications if it helps your research.

@misc{torchseg2019,
  author =       {Yu, Changqian},
  title =        {TorchSeg},
  howpublished = {\url{https://github.com/ycszen/TorchSeg}},
  year =         {2019}
}

Please consider citing the DFN in your publications if it helps your research.

@inproceedings{yu2018dfn,
  title={Learning a Discriminative Feature Network for Semantic Segmentation},
  author={Yu, Changqian and Wang, Jingbo and Peng, Chao and Gao, Changxin and Yu, Gang and Sang, Nong},
  booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  year={2018}
}

Please consider citing the BiSeNet in your publications if it helps your research.

@inproceedings{yu2018bisenet,
  title={Bisenet: Bilateral segmentation network for real-time semantic segmentation},
  author={Yu, Changqian and Wang, Jingbo and Peng, Chao and Gao, Changxin and Yu, Gang and Sang, Nong},
  booktitle={European Conference on Computer Vision},
  pages={334--349},
  year={2018},
  organization={Springer}
}

Why this name, Furnace?

Furnace means the Alchemical Furnace. We all are the Alchemist, so I hope everyone can have a good alchemical furnace to practice the Alchemy. Hope you can be a excellent alchemist.