Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

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

Merged
dbogunowicz merged 2 commits into
mainfrom
fix/damian/dynamic_height_width
Mar 21, 2023
Merged

[Fix] Adapt YOLOv5 pipeline to handle models with dynamic HxW#967
dbogunowicz merged 2 commits into
mainfrom
fix/damian/dynamic_height_width

Conversation

@dbogunowicz

@dbogunowicz dbogunowicz commented Mar 21, 2023

Copy link
Copy Markdown
Contributor

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)

Comment thread src/deepsparse/yolo/pipelines.py Outdated
@dbogunowicz dbogunowicz requested review from KSGulin and bfineran March 21, 2023 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants