duan8/psenet
weiwei zhou cd277360e2
create psenet project with weight from tensorflow (#321)
* create psenet

create psenet with weight from tensorflow

* delete some useless code

* repalce tab with 4 blanks
2020-12-04 22:32:27 +08:00
..
CMakeLists.txt create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
gen_tf_wts.py create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
layers.cpp create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
layers.h create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
main.cpp create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
psenet.cpp create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
psenet.h create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
README.md create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
test.jpg create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
utils.cpp create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00
utils.h create psenet project with weight from tensorflow (#321) 2020-12-04 22:32:27 +08:00

PSENet

preprocessing + inference + postprocessing = 30ms with fp32 on Tesla P40. The Tensorflow implementation is tensorflow_PSENet.

Key Features

  • Generating .wts from Tensorflow.
  • Dynamic batch and dynamic shape input.
  • Object-Oriented Programming.
  • Practice with C++ 11.

How to Run

    1. generate .wts

    Download pretrained model from https://github.com/liuheng92/tensorflow_PSENet and put model.ckpt.* to model dir. Add a file model/checkpoint with content

    model_checkpoint_path: "model.ckpt"
    all_model_checkpoint_paths: "model.ckpt"
    

    Then run

    python gen_tf_wts.py
    

    which will gengerate a psenet.wts.

    1. cmake and make
    mkdir build
    cd build
    cmake ..
    make
    
    1. build engine and run detection
    cp ../psenet.wts ./
    cp ../test.jpg ./
    ./psenet -s  // serialize model to plan file
    ./psenet -d  // deserialize plan file and run inference"
    

Known Issues

  1. The output of network is not completely the same as the tf's due to the difference between tensorrt's addResize and tf.image.resize, I will figure it out.

Todo

  • use ExponentialMovingAverage weight.
  • faster preporcess and postprocess.