Image Source: https://www.pinterest.com/pin/784752303797219490/
Run YOLO-NAS models with ONNX without using Pytorch. Inferencing YOLO-NAS ONNX models with ONNXRUNTIME or OpenCV DNN.
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)
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