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

Rerun ERROR: Shape must be rank 2. when logging depth image with shape (H, W, 1) from C++ #5254

Closed
roym899 opened this issue Feb 22, 2024 · 2 comments · Fixed by #6797
Closed
Assignees
Labels
😤 annoying Something in the UI / SDK is annoying to use 🪳 bug Something isn't working 🌊 C++ API C/C++ API specific 🏎️ Quick Issue Can be fixed in a few hours or less

Comments

@roym899
Copy link
Collaborator

roym899 commented Feb 22, 2024

Describe the annoyance
Minor annoyance: when logging a DepthImage with a tensor shape of length 3 (such as {height, width, 1}) Rerun reports

Rerun ERROR: Shape must be rank 2.

on every log call; however, the depth image shows up nonetheless.

This is a little annoying, because the same code to log an Image will not work when logging a depth image, i.e., you need some separate logic to get the tensor shape for a depth image compared to a normal image.

In Python there is no equivalent warning when logging a DepthImage with shape (H, W, 1).

Workaround

rerun::DepthImage({img.rows, img.cols}, rerun::TensorBuffer::u16(img))

instead of

rerun::DepthImage({img.rows, img.cols, img.channels()}, rerun::TensorBuffer::u16(img))

Expected behavior
Accepts tensor shapes of rank 3 as long as the last dimension has size 1.

@roym899 roym899 added 😤 annoying Something in the UI / SDK is annoying to use 👀 needs triage This issue needs to be triaged by the Rerun team 🌊 C++ API C/C++ API specific labels Feb 22, 2024
@roym899
Copy link
Collaborator Author

roym899 commented Feb 22, 2024

Related to that, I think it'd be easier to understand the error if it says "Shape must be length 2." instead of "rank 2". I think rank isn't even a well-defined term for a vector.

@Wumpf Wumpf self-assigned this Feb 23, 2024
@Wumpf Wumpf added 🪳 bug Something isn't working 🏎️ Quick Issue Can be fixed in a few hours or less and removed 👀 needs triage This issue needs to be triaged by the Rerun team labels Feb 23, 2024
@Wumpf Wumpf removed their assignment Jun 27, 2024
@emilk
Copy link
Member

emilk commented Jul 4, 2024

I agree that "rank" is a confusing term. I suggest we replace "rank N" with "N-dimensional" in our language. In this case, the error message should be something like "The tensor must be 2-dimensional, but got shape 800x600x1".

Of course, the problem with that is we need to do string formatting in C++, which is hell.

@emilk emilk self-assigned this Jul 8, 2024
@emilk emilk closed this as completed in be5cf36 Jul 8, 2024
abey79 pushed a commit that referenced this issue Jul 8, 2024
…ges (#6797)

### What
* Closes #5254

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested the web demo (if applicable):
* Using examples from latest `main` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}?manifest_url=https://app.rerun.io/version/main/examples_manifest.json)
* Using full set of examples from `nightly` build:
[rerun.io/viewer](https://rerun.io/viewer/pr/{{pr.number}}?manifest_url=https://app.rerun.io/version/nightly/examples_manifest.json)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG
* [x] If applicable, add a new check to the [release
checklist](https://github.com/rerun-io/rerun/blob/main/tests/python/release_checklist)!

- [PR Build Summary](https://build.rerun.io/pr/{{pr.number}})
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)

To run all checks from `main`, comment on the PR with `@rerun-bot
full-check`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
😤 annoying Something in the UI / SDK is annoying to use 🪳 bug Something isn't working 🌊 C++ API C/C++ API specific 🏎️ Quick Issue Can be fixed in a few hours or less
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants