xiaoyufenfei / Efficient-Segmentation-Networks

Lightweight models for real-time semantic segmentationon PyTorch (include SQNet, LinkNet, SegNet, UNet, ENet, ERFNet, EDANet, ESPNet, ESPNetv2, LEDNet, ESNet, FSSNet, CGNet, DABNet, Fast-SCNN, ContextNet, FPENet, etc.)
MIT License
914 stars 164 forks source link
camvid cityscapes computer-vision driving-scene-understanding efficient-segmentation-networks image-segmentation lightweight-semantic-segmentation neural-networks pytorch real-time-semantic-segmentation scene-understanding segmentation semantic-segmentation semantic-segmentation-models

Efficient-Segmentation-Networks

python-image pytorch-image

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:

Losses

The project supports these loss functions:

  1. Weighted Cross Entropy
  2. Weighted Cross Entropy with Label Smooth
  3. Focal Loss
  4. Ohem Cross Entropy
  5. LovaszSoftmax
  6. SegLoss-List
  7. ...

Optimizers

The project supports these optimizers:

  1. SGD
  2. Adam
  3. AdamW
  4. RAdam
  5. RAdam + Lookahead
  6. ...

Activations

  1. ReLu
  2. PReLU
  3. ReLU6
  4. Swish
  5. Mish : A Self Regularized Non-Monotonic Neural Activation Function
  6. ...

Learning Rate Scheduler

The project supports these LR_Schedulers:

  1. Poly decay
  2. Warmup Poly
  3. ...

Normalization methods

  1. In-Place Activated BatchNorm
  2. Switchable Normalization
  3. Weight Standardization
  4. ...

Enhancing Semantic Feature Learning Method

  1. Attention Family
  2. NAS Family
  3. ...

Some useful Tools

  1. pytorch-OpCounter
  2. flops-counter.pytorch
  3. Netron : Visualizer for neural network models, On line URL: Netron
  4. Falshtorch: Visualization toolkit for neural networks in PyTorch !
  5. Bag of Tricks for Image Classification with Convolutional Neural Networks
  6. ...

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
|  |  |-- ...

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:

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
  1. training on train set
python train.py  --help
  1. training on train+val set
python train.py --help
Testing
python test.py --help
Predicting
python predict.py --help
Evaluating
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: wangy314159@163.com

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.