This repository is still under cosntruction, use the code at your own risk!
This repository contains a Tensorflow implementation of Training and Inference for Integer-based Semantic Segmentation Network along with pre-trained models.
The goal of this implementation is to help you understand the implementation of quantization framework for semantic segmentation, and integrade them to your own network if possible.
Make sure you have python3 installed in your environment.
Type the following commands:
git clone https://github.com/MarkYangjiayi/Semantic-Quantization
cd Semantic-Quantization
pip install -r requirements.txt
- Pretrained Weights
For Deeplab, download pretrained checkpoint here. For FCN, download pretrained weights here. After download, put them into the pretrain folder of the corresponding network you want to train. - Datasets
We use TFrecord to feed data into our network, the code references DeepLabv3+ from google, which you can find here.
To train the model with PASCAL VOC 2012 dataset, first download PASCAL VOC 2012 and SegmentationClassAug. Do not unzip and move them into the "./data" folder. Then,
cd data
sh convert_voc2012_aug.sh
If successful, you should have an "./data/pascal_voc_seg/tfrecord" folder with the dataset ready in TFRecords format. Reference this blog post for more information.
- Training
mode = "train"
- Evaluation
mode = "val"
- Visualization
mode = "vis"
Note that the output prediction and ground truth is labeled with single channel. To gain better visualization, you have to convert them into RGB images.
If you find a bug, create a GitHub issue, or even better, submit a pull request. Similarly, if you have questions, simply post them as GitHub issues.