TensorRT implementation of the official DDRNet
DDRNet-23-slim outperform other light weight segmentation method,see
-
- get model.wts
Convert pytorch model to wts model using getwts.py, or download the wts [model](url: https://pan.baidu.com/s/1Cm1A2mq6RxCFhUJrOJBSrw ;passworld: p6hy ) convert from official implementation.
note that we do not use extral segmentation head while inference(set augment=False in https://github.com/ydhongHIT/DDRNet/blob/76a875084afdc7dedd20e2c2bdc0a93f8f481e81/segmentation/DDRNet_23_slim.py#L345).
-
-
cmake and make
config ur cmakelist and
mkdir build cd build cmake .. make -j8 ./ddrnet -s // serialize model to plan file i.e. 'DDRNet.engine' ./ddrnet -d ../images // deserialize plan file and run inference, the images in samples will be processed.
-
for INT8 support:
#define USE_INT8 // comment out this if want to use INT8
//#define USE_FP16 // comment out this if want to use FP32
mkdir "calib" and put around 1k images(cityscape val/test images) into folder "calib".
Test on RTX2070
model | input | FPS |
---|---|---|
Pytorch-aug | (3,1024,1024) | 107 |
Pytorch-no-aug | (3,1024,1024) | 108 |
TensorRT-FP32 | (3,1024,1024) | 117 |
TensorRT-FP16 | (3,1024,1024) | 215 |
TensorRT-INT8 | (3,1024,1024) | 232 |
Pytorch-aug means augment=True.
we use Upsample with "nearest" other than "bilinear",which may lead to lower accuracy .
Finetune with "nearest" upsample may recover the accuracy.
Here we convert from the official model directly.
- refer to:https://github.com/chenjun2hao/DDRNet.pytorch
- generate wts model with getwts.py
https://github.com/midasklr/DDRNet.Pytorch wirte your own dataset and finetune the model with cityscape.