yolo-nas-onnx
yolo-nas-onnx copied to clipboard
YoloNAS with dynamic input shape
I'm not able to convert the model to onnx with dynamic input shape.
from super_gradients.training import models
net = models.get("yolo_nas_s", pretrained_weights="coco")
models.convert_to_onnx(model=net, input_shape=(3,640,640), out_path="yolo_nas_s.onnx")
Is there any flag I can put in the above code?
I tried to convert using the ultralytics package, but without success. Only works with yolov8.
yolo task=detect mode=export model=yolo_nas_s.pt format=onnx dynamic=True
The console stream is logged into /root/sg_logs/console.log
[2023-09-08 04:54:41] INFO - crash_tips_setup.py - Crash tips is enabled. You can set your environment variable to CRASH_HANDLER=FALSE to disable it
Traceback (most recent call last):
File "/usr/local/bin/yolo", line 8, in <module>
sys.exit(entrypoint())
File "/usr/local/lib/python3.8/dist-packages/ultralytics/cfg/__init__.py", line 420, in entrypoint
model = YOLO(model, task=task)
File "/usr/local/lib/python3.8/dist-packages/ultralytics/engine/model.py", line 92, in __init__
self._load(model, task)
File "/usr/local/lib/python3.8/dist-packages/ultralytics/engine/model.py", line 138, in _load
self.model, self.ckpt = attempt_load_one_weight(weights)
File "/usr/local/lib/python3.8/dist-packages/ultralytics/nn/tasks.py", line 589, in attempt_load_one_weight
args = {**DEFAULT_CFG_DICT, **(ckpt.get('train_args', {}))} # combine model and default args, preferring model args
File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1614, in __getattr__
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'YoloNAS_S' object has no attribute 'get'
Regards, Kevin