Giter Club home page Giter Club logo

documentation's Introduction

pytorch to TensorRT conversion

Export yolov5 for batch inference (e.g. For input size 640x640 and batch size 4)

  1. using yolov5 export file, python3 export.py --weights yolov5m_shear.pt --include onnx --data coco128.yaml --device 0 --batch-size 4
  2. Convert batch parameter to 'b' using models/dynmic.py.
  3. use following trtexec command for conversion (change the input resolution and batch size accordigly)
    trtexec --onnx=dynamic.onnx --fp16 --minShapes=images:1x3x640x640 --optShapes=images:4x3x640x640 --maxShapes=images:8x3x640x640 --useCudaGraph --saveEngine= < output name >_dynamic.engine

Export yolov5 for inference

  1. using yolov5 export file,python3 export.py --weights yolov5m_shear.pt --include onnx --data coco128.yaml --device 0
  2. trtexec --onnx=yolov5m.onnx --fp16 --saveEngine=yolov5m_static.engine --useCudaGraph

For batch inference,

  1. Alaways use a dynamic engine file.
  2. In config.py
    • Make the TensorRT.batch True
    • Set the correct batch size of the converted engine file in TensorRT.batch_size
  3. Make shure the camera fps is set to a divisible value of the batch_size.

documentation's People

Contributors

jjjonathan14 avatar

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.