Giter Site home page Giter Site logo

bot66 / yolov5_tinytrt Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 2.0 60.29 MB

Deploy yolov5 on TensorRT with Libtinytrt ⚡️.Both x86 and ARM(NVIDIA Jetson).

License: MIT License

CMake 12.54% C++ 87.46%
tensorrt yolov5 object-detection jetson-nano onnx-torch tiny-tensorrt

yolov5_tinytrt's Introduction

Benchmark

Models Device BatchSize Mode Input Shape(HxW) Pytorch TensorRT
YOLOV5-X RTX3070 1 FP32 640x640 38.0ms 21.1ms
YOLOV5-L RTX3070 1 FP32 640x640 23.3ms 13.4ms
YOLOV5-M RTX3070 1 FP32 640x640 12.0ms 7.5ms
YOLOV5-S RTX3070 1 FP32 640x640 6.3ms 4.6ms
YOLOV5-S Jetson Nano 1 FP32 640x640 \ 6.4ms

Installation

Build on x86

Require TensorRT 8+ . Recommend use Nvidia official Docker image: nvcr.io/nvidia/pytorch:21.11-py3

Create docker container

#this docker image is tested, recommend pull this image
docker pull nvcr.io/nvidia/pytorch:21.11-py3

#create container
nvidia-docker run -it --name yolov5_tinytrt nvcr.io/nvidia/pytorch:21.11-py3 /bin/bash

Build on ARM(NVIDIA Jetson)

Recommend pull this docker image l4t-ml:r32.6.1-py3(OpenCV inside).Make sure your JetPack version support it. My Jetson Nano is JetPack 4.4, also can run this docker image.

Create docker container

#this docker image is tested, recommend pull this image
docker pull nvcr.io/nvidia/l4t-ml:r32.6.1-py3

#create container
nvidia-docker run -it --name yolov5_tinytrt nvcr.io/nvidia/l4t-ml:r32.6.1-py3 /bin/bash

Install

#clone project and submodule
git clone --recurse-submodules -j8 https://github.com/bot66/yolov5_tinytrt.git

#install dependencies
sudo apt-get update -y
sudo apt-get install cmake zlib1g-dev

#for python binding
sudo apt-get install python3 python3-pip
pip3 install numpy

#build
cd yolov5_tinytrt
mkdir build && cd build

cmake .. && make -j8

Usage

Use TensorRT to speed up your model, you need parse it to TensorRT .engine format, you can use build/tiny-tensorrt/tinyexec to parse .onnx model to create .engine model.

#default yolov5s as example

#generate engine 
./build/tiny-tensorrt/tinyexec --onnx yolov5s.onnx --model yolov5s.engine

#inference
#usage:./yolov5_tinytrt <engine_model> <input_folder> <output_folder>
./build/yolov5_tinytrt yolov5s.engine  images/ results/

results/000000007816.jpg

Reference

zerollzeng / tiny-tensorrt

ultralytics / yolov5

yolov5_tinytrt's People

Contributors

bot66 avatar

Stargazers

 avatar

Watchers

 avatar

yolov5_tinytrt's Issues

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.