Skip to content

Semantic Segmentation for Autonomous Driving scenes

License

Notifications You must be signed in to change notification settings

anbohuyn/pytorch-semseg

 
 

Repository files navigation

Semantic Segmentation for Autonomous Driving Scenes [PyTorch]

Adapted from https://github.com/meetshah1995/pytorch-semseg

Networks implemented

  • FCN - All 1 (FCN32s), 2 (FCN16s) and 3 (FCN8s) stream variants
  • Segnet - With Unpooling using Maxpool indices
  • PSPNet - With support for loading pretrained models w/o caffe dependency

Datasets/Dataloaders

Requirements

  • pytorch >=0.3.0
  • torchvision ==0.2.0
  • visdom >=1.0.1 (for loss and results visualization)
  • scipy
  • tqdm

One-line installation

pip install -r requirements.txt

To train the model :

python train.py [-h] [--arch [ARCH]] [--dataset [DATASET]]
                [--img_rows [IMG_ROWS]] [--img_cols [IMG_COLS]]
                [--n_epoch [N_EPOCH]] [--batch_size [BATCH_SIZE]]
                [--l_rate [L_RATE]] [--feature_scale [FEATURE_SCALE]]
                [--visdom [VISDOM]]

  --arch           Architecture to use ['fcn8s, unet, segnet etc']
  --dataset        Dataset to use ['pascal, camvid, ade20k etc']
  --img_rows       Height of the input image
  --img_cols       Width of the input image
  --n_epoch        # of the epochs
  --batch_size     Batch Size
  --l_rate         Learning Rate
  --feature_scale  Divider for # of features to use
  --visdom         Show visualization(s) on visdom | False by default

To validate the model :

python validate.py [-h] [--model_path [MODEL_PATH]] [--dataset [DATASET]]
                   [--img_rows [IMG_ROWS]] [--img_cols [IMG_COLS]]
                   [--batch_size [BATCH_SIZE]] [--split [SPLIT]]

  --model_path   Path to the saved model
  --dataset      Dataset to use ['pascal, camvid, ade20k etc']
  --img_rows     Height of the input image
  --img_cols     Width of the input image
  --batch_size   Batch Size
  --split        Split of dataset to validate on

To test the model w.r.t. a dataset on custom images(s):

python test.py [-h] [--model_path [MODEL_PATH]] [--dataset [DATASET]]
               [--dcrf [DCRF]] [--img_path [IMG_PATH]] [--out_path [OUT_PATH]]
 
  --model_path          Path to the saved model
  --dataset             Dataset to use ['pascal, camvid, ade20k etc']
  --dcrf                Enable DenseCRF based post-processing
  --img_path            Path of the input image
  --out_path            Path of the output segmap

Reference

@article{mshahsemseg,
    Author = {Meet P Shah},
    Title = {Semantic Segmentation Architectures Implemented in PyTorch.},
    Journal = {https://github.com/meetshah1995/pytorch-semseg},
    Year = {2017}
}

About

Semantic Segmentation for Autonomous Driving scenes

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%