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

[Web] Yolov8 object detection on webGPU #22176

Closed
reinhrst opened this issue Sep 23, 2024 · 5 comments
Closed

[Web] Yolov8 object detection on webGPU #22176

reinhrst opened this issue Sep 23, 2024 · 5 comments
Labels
ep:WebGPU ort-web webgpu provider platform:web issues related to ONNX Runtime web; typically submitted using template

Comments

@reinhrst
Copy link
Contributor

Describe the issue

I would like to get clarification if YoloV8 object detection is expected to run on webGPU. When I try it I get:

[WebGPU]: Error: softmax only supports last axis for now.

In Netron visualisation I can see a Softmax on axis 1 (which I guess accounts for the error). I understand from #20710 (comment) that Softmax on WebGPU EP on arbitrary axis is somewhere planning (which would be great :)).

However looking at #19779, it suggests that Yolov8 nano should just work on WebGPU (unfortunately the link to download the model is broken, so I cannot check how that model looks).

To reproduce

Get a yolov8 nano model in onnx format (install ultralytics, then run yolo export model=yolov8n format=onnx).

Use this model in an onnx WebGPU EP, and it gives above error.

Using WASM the model works just fine.

Urgency

Rewriting my browser-based inferrer from tensorflowjs to onnx, and would love to finish, but no strict deadlines.

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

https://registry.npmjs.org/onnxruntime-common/-/onnxruntime-common-1.19.2.tgz

Execution Provider

'webgpu' (WebGPU)

@reinhrst reinhrst added the platform:web issues related to ONNX Runtime web; typically submitted using template label Sep 23, 2024
@github-actions github-actions bot added the ep:WebGPU ort-web webgpu provider label Sep 23, 2024
@reinhrst
Copy link
Contributor Author

Some more info that I just found out; when I export with opset=12 it does work on WebGPU. Does that sound plausible to you? If so, do you have any suggestions what opset I should use?

@fs-eire
Copy link
Contributor

fs-eire commented Sep 25, 2024

Usually the latest opset is recommended. The problem of Softmax is unexpected and should be fixed. Will let you know when the fix is merged.

@gyagp
Copy link

gyagp commented Sep 26, 2024

I'm currently working on this. Stay tuned.

gyagp pushed a commit to gyagp/onnxruntime that referenced this issue Sep 26, 2024
In current implementation, axis in softmax has to be the last, which is
an obvious limitation. This PR removes this limitation and will fix
issues microsoft#20710 and microsoft#22176.
fs-eire pushed a commit that referenced this issue Oct 1, 2024
In current implementation, axis in softmax has to be the last, which is
an obvious limitation. This PR removes this limitation and will fix
issues #20710 and #22176.
@fs-eire
Copy link
Contributor

fs-eire commented Oct 8, 2024

This should be fixed in latest dev version. @reinhrst could you please help to verify if it works now?

@reinhrst
Copy link
Contributor Author

reinhrst commented Oct 8, 2024

Confirmed, the yolo v8 export (opset 17) work on dev version!

@reinhrst reinhrst closed this as completed Oct 8, 2024
ishwar-raut1 pushed a commit to ishwar-raut1/onnxruntime that referenced this issue Nov 19, 2024
In current implementation, axis in softmax has to be the last, which is
an obvious limitation. This PR removes this limitation and will fix
issues microsoft#20710 and microsoft#22176.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ep:WebGPU ort-web webgpu provider platform:web issues related to ONNX Runtime web; typically submitted using template
Projects
None yet
Development

No branches or pull requests

3 participants