This is the PyTorch implementation for paper Self-Regulation for Semantic Segmentation, ICCV 2021.
Clone this repo:
git clone git@github.com:dongzhang89/SR-SS.git
cd SR-SS
Install PyTorch 0.4.0:
pip install pytorch==0.4.0
GPU is not necessary, but it will be very slow without GPU.
Install Python Package
pip install -r requirements
Tensorflow is necessary for tensorboardX. If you don't want to use tensorboardX for visualization, delete it.
Dataset preparation We use the PASCAL VOC 2012 dataset in SR. Go to the official webpage and download the training images. We use the augmented pseudo-labels in experiments. The final file structure is shown below:
data
|- VOC2012
|- SegmentationClassAug_pseudo_label #label path
|- JPEGImages #image path
Test on a single image could be done by running:
python demo.py --img_path path --model path/weight
You can get a similar image as:
checkpoint = torch.load(model_path)
net.load_state_dict(checkpoint['model'])
Training your own model could be done by running:
python trainval.py
Testing your trained model could be done by running:
python test.py --model=path/model
Monitor your training process with tensorboardX. Run:
tensorboard --logdir=$DEEPLAB_V2_PYTORCH/logs/loss_lr/lr --port=7001
Then open your firefox or chrome, and visit localhost:7001.
This project heavily relies on the following projects:
You may want to cite:
@article{zhang2021sr,
title={Self-Regulation for Semantic Segmentation},
author={Dong, Zhang and Hanwang, Zhang and Jinhui, Tang and Xiansheng, Hua and Qianru, Sun},
journal={International Conference on Computer Vision (ICCV)},
year={2021}
}