Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YoloNAS with dynamic input shape #7

Open
kevinzezel opened this issue Sep 8, 2023 · 0 comments
Open

YoloNAS with dynamic input shape #7

kevinzezel opened this issue Sep 8, 2023 · 0 comments

Comments

@kevinzezel
Copy link

kevinzezel commented Sep 8, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant