Hyuto / yolo-nas-onnx

Inference YOLO-NAS ONNX model

Home Page:https://hyuto.github.io/yolo-nas-onnx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YOLO-NAS ONNX

sample

Image Source: https://www.pinterest.com/pin/784752303797219490/


love onnxruntime-web opencv python c++ javascript

Run YOLO-NAS models with ONNX without using Pytorch. Inferencing YOLO-NAS ONNX models with ONNXRUNTIME or OpenCV DNN.

Generate ONNX Model

Generate YOLO-NAS ONNX model without preprocessing and postprocessing within the model. You can convert the model using the following code after installing super_gradients library.

Example: Exporting YOLO-NAS S

from super_gradients.training import models
from super_gradients.common.object_names import Models

model = models.get(Models.YOLO_NAS_S, pretrained_weights="coco")

model.eval()
model.prep_model_for_conversion(input_size=[1, 3, 640, 640])
model.export("yolo_nas_s.onnx", postprocessing=None, preprocessing=None)

Custom Model

To run custom trained YOLO-NAS model in this project you need to generate custom model metadata. Custom model metadata generated from custom-nas-model-metadata.py to provide additional information from torch model.

Usage

python custom-nas-model-metadata.py -m <CHECKPOINT-PATH> \ # Custom trained YOLO-NAS checkpoint path
                                        -t <MODEL-TYPE> \ # Custom trained YOLO-NAS model type
                                        -n <NUM-CLASSES> # Number of classes

After running that it'll generate metadata (json formated) for you

References

About

Inference YOLO-NAS ONNX model

https://hyuto.github.io/yolo-nas-onnx/

License:MIT License


Languages

Language:C++ 34.0%Language:Python 31.5%Language:JavaScript 27.5%Language:CSS 3.5%Language:HTML 2.2%Language:CMake 1.3%