A native Keras implementation of semantic segmentation according to Multi-Scale Context Aggregation by Dilated Convolutions (2016). Optionally uses the pretrained weights by the authors'.
The code requires Python 3.5.
Follow the instructions in the conversion
folder to convert the weights to the TensorFlow
format that can be used by Keras.
pip install -r requirements.txt
pip install tensorflow-gpu
python predict.py --weights_path conversion/converted/dilation8_pascal_voc.npy
Download the Augmented Pascal VOC dataset
here. Use the convert_masks.py
script to convert the
provided masks in .mat format to RGB pngs:
python convert_masks.py \
--in-dir /mnt/pascal_voc/dataset/cls \
--out-dir /mnt/pascal_voc/dataset/pngs
Start training:
python train.py --batch-size 2
Model checkpoints are saved under trained/
, and can be used with the predict.py
script for testing.
The training code is currently limited to the frontend module, and thus only outputs 16x16 segmentation maps. The augmentation pipeline does mirroring but not cropping or rotation.
Fisher Yu and Vladlen Koltun, Multi-Scale Context Aggregation by Dilated Convolutions, 2016