Code for Augmentation Invariance and Adaptive Sampling in Semantic Segmentation of Agricultural Aerial Images (CVPRW 2022)
pip install -r requirements.txt -f https://download.pytorch.org/whl/torch_stable.html
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu111/torch1.9/index.html
pip install -e .
Well, there are mostly two contributions in this work: augmentation invariance, and adaptive sampling.
- The augmentation invariance regularization is computed in custom.py
- The adaptive sampling is part of the dataset, in sampling.py
Before training, you will need to format the dataset so that the labels and the boundaries are merged into a single image. Follow the conversion script located inside tools to carry this out.
CUDA_VISIBLE_DEVICES=$DEVICES tools/train.py [CONFIG_FILE] [OPTIONS]
source scripts/dist_train.sh [GPUS, e.g. 0,1] [CONFIG_FILE] [OPTIONS]
Evaluation only:
CUDA_VISIBLE_DEVICES=$DEVICES python tools/test.py [CONFIG] --eval mIoU
Evaluate generating images:
# evaluate while plotting masks
CUDA_VISIBLE_DEVICES=$DEVICES python tools/test.py [CONFIG] --eval mIoU --show --opacity=1
# evaluate while plotting RGB images
CUDA_VISIBLE_DEVICES=$DEVICES python tools/test.py [CONFIG] --eval mIoU --show --opacity=0
# evaluate while plotting IRRG images
CUDA_VISIBLE_DEVICES=$DEVICES python tools/test.py [CONFIG] --eval mIoU --show --opacity=0 --channels irrg