Efficient-Segmentation-Networks
This project aims at providing an easy-to-use, modifiable reference implementation for real-time semantic segmentation models using PyTorch.
---Table of Contents:
Requirements
PyTorch and Torchvision needs to be installed before running the scripts, PyTorch v1.1 or later is supported.
pip3 install -r requirements.txt
Models
The project supports these semantic segmentation models as follows:
- (SQNet) Speeding up Semantic Segmentation for Autonomous Driving [Paper]
- (LinkNet) Exploiting Encoder Representations for Efficient Semantic Segmentation [Paper]
- (SegNet) A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation [Paper]
- (UNet) Convolutional Networks for Biomedical Image Segmentation [Paper]
- (ENet) A Deep Neural Network Architecture for Real-Time Semantic Segmentation [Paper]
- (ERFNet) Efficient ConvNet for Real-time Semantic Segmentation [Paper]
- (EDANet) Efficient Dense Modules of Asymmetric Convolution for Real-Time Segmentation [Paper]
- (ESPNet) Efficient Spatial Pyramid of Dilated Convolutions for Semantic Segmentation [Paper]
- (ESPNetv2) A Light-weight, Power Efficient, and General Purpose ConvNet [Paper]
- (LEDNet) A Lightweight Encoder-Decoder Network for Real-Time Semantic Segmentation [Paper]
- (FSSNet) Fast Semantic Segmentation for Scene Perception [Paper]
- (ESNet) An Efficient Symmetric Network for Real-time Semantic Segmentation [Paper]
- (CGNet) A Light-weight Context Guided Network for Semantic Segmentation [Paper]
- (Fast-SCNN) Fast Semantic Segmentation Network [Paper]
- (DABNet) Depth-wise Asymmetric Bottleneck for Real-time Semantic Segmentation [Paper]
- (ContextNet) Exploring Context and Detail for Semantic Segmentation in Real-time [Paper]
- (FPENet) Feature Pyramid Encoding Network for Real-time Semantic Segmentation [Paper]
- ...
Losses
The project supports these loss functions:
- Weighted Cross Entropy
- Weighted Cross Entropy with Label Smooth
- Focal Loss
- Ohem Cross Entropy
- LovaszSoftmax
- SegLoss-List
- ...
Optimizers
The project supports these optimizers:
- SGD
- Adam
- AdamW
- RAdam
- RAdam + Lookahead
- ...
Activations
- ReLu
- PReLU
- ReLU6
- Swish
- Mish : A Self Regularized Non-Monotonic Neural Activation Function
- ...
Learning Rate Scheduler
The project supports these LR_Schedulers:
- Poly decay
- Warmup Poly
- ...
Normalization methods
Enhancing Semantic Feature Learning Method
Some useful Tools
- pytorch-OpCounter
- flops-counter.pytorch
- Netron : Visualizer for neural network models, On line URL: Netron
- Falshtorch: Visualization toolkit for neural networks in PyTorch !
- Bag of Tricks for Image Classification with Convolutional Neural Networks
- ...
Dataset-Setting
This project has been tailored to suit the Cityscapes and CamVid datasets. The folds of your dataset need satisfy the following structures:
|-- dataset
| |-- camvid
| | |-- train
| | |-- trainannot
| | |-- val
| | |-- valannot
| | |-- test
| | |-- testannot
| | |-- ...
| |-- cityscapes
| | |-- leftImg8bit
| | | |-- train
| | | |-- val
| | | |-- test
| | |-- gtFine
| | | |-- train
| | | |-- val
| | | |-- test
| | |-- ...
- You can download cityscapes dataset from here. Note: please download leftImg8bit_trainvaltest.zip(11GB) and gtFine_trainvaltest(241MB).
- You can download camvid dataset from here.
- The Cityscapes dataset scripts for inspection, preparation, and evaluation can download from here.
Usage
Clone this Repo
git clone https://github.com/xiaoyufenfei/Efficient-Segmentation-Networks
cd Efficient-Segmentation-Networks
Currently, the code supports Python 3
Torch dependencies:
- PyTorch (>=1.1.0)
- torchvision(>=0.3.0)
Data dependencies:
Download Cityscapes and run the script createTrainIdLabelImgs.py
to create annotations based on the training labels. Make sure that the folder is named cityscapes
Training
- For Cityscapes / CamVid
- training on train set
python train.py --help
- training on train+val set
python train.py --help
Testing
- For Cityscapes / CamVid
python test.py --help
Predicting
- For Cityscapes
python predict.py --help
Evaluating
- For Cityscapes
cd tools
python trainID2labelID.py
Contact
If you think this work useful, please give me a star! And if you find any errors or have any suggestions, please contact me.
GitHub: xiaoyufenfei
Email: [email protected]
Refer to this Rep
You are encouraged to cite the following papers if this work helps your research.
@misc{Efficient-Segmentation-Networks,
author = {Yu Wang},
title = {Efficient-Segmentation-Networks Pytorch Implementation},
year = {2019},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/xiaoyufenfei/Efficient-Segmentation-Networks}},
commit = {master}
}
License
This project is released under the MIT License. See LICENSE for additional details.