Giter Club home page Giter Club logo

crnn.pytorch.tensorrt.chinese's Introduction

Chinese Characters Recognition inferenced by tensorrt

A Chinese characters recognition repository with tensorrt format supported based on CRNN_Chinese_Characters_Rec and TensorRTx.

tensorrt performance

Item performance
time -65%
GPU memory -25%

Dev Environments

  1. Ubuntu 18.04
  2. python 3.7
  3. PyTorch 1.7.1
  4. cuda 10.0, cudnn 7.6.5
  5. yaml, easydict, tensorboardX...
    Options:
  6. OpenCV3.4.1
  7. tensorrt7.0.0
  8. pycuda>=2019.1.1

Notes:

  1. Tensorrt should be installed refer to the official documentation if you want to improve the efficiency and save, the version of tensorrt should match the version of ubuntu,cuda,cudnn. Cuda, cudnn and OpenCV should be installed in the system environment to satisfy the compile work.

Inference

pytorch .pth weights inference:

$ python inference.py

tensorrt .engine weights inference:

$ python inference_trt.py

Train

   $ python train.py --cfg lib/config/cn_config.yaml

loss curve

   $ cd output/W_PAD/crnn_cn/xxxx-xx-xx-xx-xx/
   $ tensorboard --logdir log

torch to tensorrt

  1. You should rebuild crnn torch2trt, if you change the size of input or class number. If not, you can start from step4
   $ mkdir crnn_trt/build
   $ cd crnn_trt/build
   $ rm -rf *
  1. change the parameters in crnn.cpp to yours, you may change INPUT_H, INPUT_W, NUM_CLASS

  2. Rebuild crnn torch2trt

   $ cmake ..
   $ make
  1. Go to root path, and transform torch weights .pth file to .wts. You will get crnn.wts in crnn_trt/build.
   $ cd ../../
   $ python gen_wts.py
  1. Transform .wts to .engine
   $ cd crnn_trt/build
   $ sudo ./crnn -s
  1. Move crnn.engine in crnn_trt/build to weights/
  2. Run inference.py and inference_trt.py to compare the time use
   $ cd ../../
   $ python inference.py
   $ python inference_trt.py

References

crnn.pytorch.tensorrt.chinese's People

Watchers

 avatar

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.