Git Product home page Git Product logo

yolov5-onnx's Introduction

Yolov5-ONNX

made-with-python Open In Colab

YOLOv5 inference using ONNX, with no complicated installations setup and zero precession loss!

Inference with ONNX

Tested with Linux based systems (Colab T4/P4/K80, AWS t2.micro (Intel Xeon), Ubuntu-GTX 1650)

$ git clone https://github.com/BlueMirrors/Yolov5-ONNX.git
$ cd Yolov5-ONNX
$ pip install -r requirements.txt

Now run inference on video or image file (with pretrained weights).

python detect.py --input $PATH_TO_INPUT_FILE --output $OUTPUT_FILE_NAME

You can also pass --weights to use your own custom onnx weight file.

For pretrained default weights (--weights yolov5s), scripts will download the weights file automatically.

Convert to ONNX

If you want to run the inference for your custom weights, simply do the following:

Make sure you use the ---dynamic flag while exporting your custom weights.

python export.py --weights $PATH_TO_PYTORCH_WEIGHTS --dynamic --include onnx

FPS and Accuracy Info (CPU)

In our tests, ONNX had identical outputs as original pytorch weights.

Based on 500-700 inference iterations after 50 iterations of warmups. Includes Image Preprocessing (letterboxing etc.), Model Inference and Output Postprocessing (NMS, Scale-Coords, etc.) time only.

Hardware FPS
AWS T2.Micro 5.0-5.5
Colab-CPU Runtime (Intel(R) Xeon(R) CPU @ 2.20GHz) 5.1-5.7
MacBook Pro (13-inch, 2016, Four Thunderbolt 3 Ports) Processor: 2.9 GHz Intel Core i5 10-11

FPS and Accuracy Info (GPU)

In our tests, ONNX had identical outputs as original pytorch weights.

Based on 5000 inference iterations after 100 iterations of warmups. Includes Image Preprocessing (letterboxing etc.), Model Inference and Output Postprocessing (NMS, Scale-Coords, etc.) time only.

Hardware FPS
T4 83-89
P4 62-65
K80 31-34

Notes

  • Batch support will be added next week (after 15th August)

References

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.