microsoft / microsoft/onnxruntime-inference-examples

Segment Anything example fails with "invalid rank for input" on Mac with Chrome

Open
#364 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

javascript
Dominant language
C++
Stars
1.7k
Forks
414
Avg merge
1d 6h
Merged PRs (30d)
14

Description

  • Mac M1 Pro running Sonoma 14.2.1
  • Chrome 120.0.6099.129
  • Example webpage fails in Javascript with
    Uncaught (in promise) Error: failed to call OrtRun(). ERROR_CODE: 2, ERROR_MESSAGE: Invalid rank for
    input: input_image Got: 4 Expected: 3 Please fix either the inputs/outputs or the model.

The same webpage/example works fine with Safari

I tried fixing the main.js to reduce the rank to 3 (removing batch dimension), but a second error popped up indicating the tensor should be HWC, but instead the Tensor was CHW.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Segment Anything example and its main.js entry point, then reproduce the failure in Chrome on the listed Mac setup. Compare the input rank and layout expected by the model with the tensor passed to OrtRun; done means the example runs successfully in Chrome as it already does in Safari.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
machine-learning, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.