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

[Fix] Adapt YOLOv5 pipeline to handle models with dynamic HxW #967

Merged
merged 2 commits into from
Mar 21, 2023

Conversation

dbogunowicz
Copy link
Contributor

@dbogunowicz dbogunowicz commented Mar 21, 2023

YOLO Pipeline currently fails if the model has dynamic axis:
e.g.

(batch: "dynamic", channels: 3, height: "dynamic", width: "dynamic)

Testing

Raise value error if no image_size specified

from deepsparse import Pipeline

pipeline = Pipeline.create(model_path="zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none", task="yolo")
out = pipeline(images="src/deepsparse/yolo/sample_images/basilica.jpg")

out:

 File "/home/ubuntu/damian/deepsparse/src/deepsparse/yolo/pipelines.py", line 167, in setup_onnx_file_path
    raise ValueError(
ValueError: The model does not have a static image size shape. Specify the expected image size by passing the`image_size` argument to the pipeline.

Pass otherwise

from deepsparse import Pipeline

pipeline = Pipeline.create(model_path="zoo:cv/detection/yolov5-s/pytorch/ultralytics/coco/base-none", task="yolo", image_size=(320,320)
out = pipeline(images="src/deepsparse/yolo/sample_images/basilica.jpg")

Test with annotation pipeline

Behavior is consistent with Pipelines. The user need to specify the appropriate argument to specify the image size (will be notified about it by the appropriate error message)

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

Successfully merging this pull request may close these issues.

None yet

3 participants