Git Product home page Git Product logo

hrnetv2's Introduction

HRNetV2 for Semantic Segmentation

Introduction

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

Set up your environment by running

pip install -r requirements.txt 

Training

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

Testing

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

Evaluation

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

Reference

  • 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]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.