Files
frigate/notebooks/YOLO_NAS_Pretrained_Export.ipynb
T
aptalca ccf20f456a update YOLO_NAS notebook (#17414)
Google Colab updated to python 3.11
super-gradients v3.7.1 is not compatible with py3.11 and install fails
super-gradients committed a fix to master branch but did not cut a relase since (acquired by Nvidia in the meantime)
This commit installs super-gradients from master branch
2025-03-27 10:33:03 -06:00

2.3 KiB

In [ ]:
! pip install -q git+https://github.com/Deci-AI/super-gradients.git
In [ ]:
! sed -i 's/sghub.deci.ai/sg-hub-nv.s3.amazonaws.com/' /usr/local/lib/python3.11/dist-packages/super_gradients/training/pretrained_models.py
! sed -i 's/sghub.deci.ai/sg-hub-nv.s3.amazonaws.com/' /usr/local/lib/python3.11/dist-packages/super_gradients/training/utils/checkpoint_utils.py
In [ ]:
from super_gradients.common.object_names import Models
from super_gradients.conversion import DetectionOutputFormatMode
from super_gradients.training import models

model = models.get(Models.YOLO_NAS_S, pretrained_weights="coco")
In [ ]:
# export the model for compatibility with Frigate

model.export("yolo_nas_s.onnx",
             output_predictions_format=DetectionOutputFormatMode.FLAT_FORMAT,
             max_predictions_per_image=20,
             confidence_threshold=0.4,
             input_image_shape=(320,320),
            )
In [ ]:
from google.colab import files

files.download('yolo_nas_s.onnx')