duan8/hrnet/hrnet-semantic-segmentation
BaofengZan 37f03a77c5
fixed some issues (#400)
* 1 动态输入
2 图像预处理和后处理和pytorch同步
3 代码格式统一

* 重新梳理代码

* tab 替换为4 space

* HRNet-Semantic-Segmentation

* update result img

* update readme

* Synchronize

* Modify some bugs
2021-02-07 17:41:16 +08:00
..
CMakeLists.txt fix and optimize 2021-01-29 16:20:48 +08:00
common.hpp rename files, update readme 2020-12-28 10:08:16 +08:00
demo.py rename files, update readme 2020-12-28 10:08:16 +08:00
hrnetseg.cpp rename files, update readme 2020-12-28 10:08:16 +08:00
logging.h rename files, update readme 2020-12-28 10:08:16 +08:00
README.md fixed some issues (#400) 2021-02-07 17:41:16 +08:00

HRNet-Semantic-Segmentation

The Pytorch implementation is HRNet-Semantic-Segmentation-v1.1. The implemented model is HRNetV2-W18-Small-v2

How to Run

    1. generate .wts

    Download code and model from HRNet-Semantic-Segmentation-v1.1 and config your environments.

    Put demo.py in the YOUR_ROOT_DIR\HRNet-Semantic-Segmentation\tools folder, set savewts in main() as True, and run, the .wts will be generated.

    1. cmake and make
    mkdir build
    cd build
    cmake ..
    make
    sudo ./hrnetseg -s             // serialize model to plan file i.e. 'hrnetseg.engine'
    sudo ./hrnetseg -d  ../samples // deserialize plan file and run inference, the images in samples will be processed.
    

Result

TRT Result:

trtcity

pytorch result:

image-20201225171224159

Note

  • Some source codes are changed for simplicity. But the original model can still be used.

    All "upsample" op in source code are changed to mode='bilinear', align_corners=True

  • Image preprocessing operation and postprocessing operation are put into Trt Engine.

  • Zero-copy technology (CPU/GPU memory copy) is used.