ClassHyPer: ClassMix-Based Hybrid Perturbations for Deep Semi-Supervised Semantic Segmentation of Remote Sensing Imagery
The PyTorch implementation of semi-supervised learning method—ClassHyPer. The manuscript can be visited via https://www.mdpi.com/2072-4292/14/4/879
- DeepGlobe Road
- Massachusetts Building
- WHU Aerial Building
- ISPRS 2D Semantic Labeling (Potsdam and Vaihingen)
After obtain the datasets, you need to process first and generate lists of image/label files and place as the structure shown below. Every txt file contains the full absolute path of the files, each image/label per line. Example files can be found in ./examples
.
/root
/save/{model.name}/{datetime}/log/{model.name}.txt
/history.txt
/checkpoint-ep{epoch}-{val_iou}.pth
/checkpoint-best.pth
/test/log/{model.name}/{datetime}/test-result.txt
/train_image.txt
/train_label.txt
/test_image.txt
/test_label.txt
/val_image.txt
/val_label.txt
/train_unsup_image.txt
The code is developed using Python 3.8 with PyTorch 1.9.0 and tested based on single RTX 2080 Ti GPU.
(1) Clone this repo.
git clone https://github.com/YJ-He/ClassHyPer.git
(2) Create a conda environment.
conda env create -f environment.yaml
conda activate class_hyper
- set
root_dir
and hyper-parameters configuration in./configs/config.cfg
. - run
python train.py
.
- set
root_dir
and hyper-parameters configuration in./configs/config.cfg
. - set
pathCkpt
intest.py
to indicate the model checkpoint file. - run
python test.py
.
If this repo is useful in your research, please kindly consider citing our paper as follow.
@article{he2022classhyper,
title={ClassHyPer: ClassMix-Based Hybrid Perturbations for Deep Semi-Supervised Semantic Segmentation of Remote Sensing Imagery},
author={He, Yongjun and Wang, Jinfei and Liao, Chunhua and Shan, Bo and Zhou, Xin},
journal={Remote Sensing},
volume={14},
number={4},
pages={879},
year={2022},
publisher={MDPI}
}
[1] Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision
[2] Semi-supervised semantic segmentation needs strong, varied perturbations
[3] ClassMix: Segmentation-Based Data Augmentation for Semi-Supervised Learning
...
If our work give you some insights and hints, star me please! Thank you~