This the non-official reimplementation of HRNetV2 for Semantic Segmentation. (Official code)
Although HRNet-OCR is implemented in official code, I implemented pure HRNetV2 without OCR. I evaluated the model only on Cityscapes dataset.
Please refer to Qiita article for more imformation about this project. (Japanese)
Set up your environment by running
pip install -r requirements.txt
Only Cityscapes dataset is supported.
First, download Cityscapes dataset.
Then, modify ./config/default.py
appropriately.
For example, train the HRNet-W40 with a batch size of 12 on 4 GPUs (cuda:0, 1, 2, 3):
...
...
# CUDA related prarams
_C.CUDA = CN()
_C.CUDA.USE_CUDA = True
_C.CUDA.CUDA_NUM = [0,1,2,3]
...
...
# model
_C.MODEL = CN()
_C.MODEL.C = 40
...
...
_C.TRAIN.BATCH_SIZE = 12
After you set config file, then run:
python train.py
You can test semantic segmentation on your image file. Modify settings in ./config/default.py
and ./config/predict.yaml
as you like, then run:
python predict.py --input_path $INPUT_IMG(or DIR)_PATH --output_path $OUTPUT_DIR_PATH
Since ground truth for test set is not publicly available, I used validation set to evaluate.
Modify settings in ./config/default.py
and ./config/test_eval.yaml
as you like, then you can run:
python test_eval.py
-
J. Wang, K. Sun, T. Cheng, B. Jiang, C. Deng, Y. Zhao, D. Liu, Y. Mu, M. Tan, X. Wang, W. Liu and B. Xiao "Deep High-Resolution Representation Learning for Visual Recognition," TPAMI, vol.43, no.10, pp.3349-3364, Apr 2020. [ieee]
-
pytorch-polynominal-lr-decay implementation by @cmpark0126 [github]
-
Syncronized-BatchNorm-PyTorch implementation by @vacancy [githhub]