Coder Social home page Coder Social logo

k9ele7en / onnx-tensorrt-inference-craft-pytorch Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 2.0 12.64 MB

Advance inference performance using TensorRT for CRAFT Text detection. Implemented modules to convert Pytorch -> ONNX -> TensorRT, with dynamic shapes (multi-size input) inference.

License: BSD 3-Clause "New" or "Revised" License

Python 98.03% Shell 1.97%
tensorrt onnx onnx-torch onnx-tensorrt text-detection tensorrt-inference tensorrt-conversion

onnx-tensorrt-inference-craft-pytorch's Introduction

Convert Pytorch pretrain -> TensoRT engine directly for CRAFT (Character-Region Awareness For Text detection)

Overview

Implementation of inference pipeline using Tensor RT for CRAFT text detector. Two modules included:

  • Convert pretrain Pytorch -> ONNX -> TensorRT
  • Inference using Tensor RT

Note: This repo is about converting steps to finally get Tensor RT engine, and inference on the engine. More related repo about Tensor RT inference, check out:

Author

k9ele7en. Give 1 star if you find some value in this repo.
Thank you.

License

[MIT License] A short, permissive software license. Basically, you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source.

Updates

7 Aug, 2021: Init repo, converter run success. Run infer by ONNX success. Run infer by RT engine return wrong output.

Getting started

1. Install dependencies

Requirements

$ pip install -r requirements.txt

Install ONNX, TensorRT

Check details at ./README_Env.md

2. Download the trained models

Model name Used datasets Languages Purpose Model Link
General SynthText, IC13, IC17 Eng + MLT For general purpose Click
IC15 SynthText, IC15 Eng For IC15 only Click
LinkRefiner CTW1500 - Used with the General Model Click

3. Start converting Pytorch->TensorRT

Use single .sh script to run converter, ready to infer after complete successfully

sh prepare.sh

Seperate single converters

$ cd converters
$ python pth2onnx.py
$ python onnx2trt.py

4. Start infer on Tensor RT engine

$ python infer_trt.py

5. Infer on ONNX format

$ python infer_onnx.py

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.