Giter VIP home page Giter VIP logo

pytorch-onnx-tensorrt's Introduction

PyTorch-Onnx-Tensorrt

A set of tool which would make your life easier with Tensorrt and Onnxruntime for Yolov3.

Requirements

  1. Python 3
  2. OpenCV
  3. PyTorch
  4. Onnx 1.4.1
  5. Onnxruntime
  6. Tensorrt

I would Highly Recommend setting up a Nvidia Deepstream/Tensorrt Docker for these operations.

Downloading YoloV3 Configs and Weights

mkdir cfg
cd cfg 
wget https://raw.githubusercontent.com/pjreddie/darknet/f86901f6177dfc6116360a13cc06ab680e0c86b0/cfg/yolov3.cfg

mkdir weights
cd weights
wget https://pjreddie.com/media/files/yolov3.weights

Editing Config File

Inorder to Run the model in Pytorch or creating Onnx / Tensorrt File for different Input image Sizes ( 416, 608, 960 etc), you need to edit the Batch Size and Input image size in the config file - net info section.

batch=1
width=416
height=416

Running the detector Using Pytorch

python3 detect.py --cfg cfg/yolov3.cfg --weights weights/yolov3.weights 

Generating the Onnx File

python3 create_onnx.py --reso 416

Running the detector Using ONNX

python3 detect.py --use_onnx True --onnx_file yolov3.onnx

Generating the Tensorrt File

python3 create_trt_engine.py --onnx_file yolov3.onnx 

Creating the Tensorrt engine takes some time. So have some patience.

pytorch-onnx-tensorrt's People

Contributors

rapternmn 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.