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

Allow showing image shaped tensors in the tensor view #3583

Merged
merged 1 commit into from Oct 2, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Oct 2, 2023

What

Testcode:

import numpy as np
import rerun as rr

rr.init("tensor", spawn=True)
rr.log("tensor", rr.Tensor(np.asarray(np.random.rand(100, 100, 3) * 255, dtype=np.uint8)))
rr.log("image", rr.Image(np.random.rand(100, 100, 3)))

Before the tensor entity wouldn't show anything, now this shows two space views:
image

In fact, we didn't allow tensor views for anything image shaped at all before!

Tested with python ./scripts/run_all.py --fast and (todo!) webdemo that this didn't break heuristic

Checklist

@Wumpf Wumpf added enhancement New feature or request 📺 re_viewer affects re_viewer itself include in changelog labels Oct 2, 2023
@Wumpf Wumpf merged commit 02a0eae into main Oct 2, 2023
33 of 34 checks passed
@Wumpf Wumpf deleted the andreas/tensor-view-for-image branch October 2, 2023 16:27
emilk added a commit that referenced this pull request Oct 5, 2023
…root space view (#3681)

### What

* Fixes #3677

Definitely need to come up with something better to steer the heuristics
- we made good strides in space view refactor and recent advances in
System heuristics, but there's still a lot to be desired!

In the test scene there's still the issue of a unexplicably large
accumulated bounding box which causes the camera to zoom out a lot. This
is most likely caused by an initially bad heuristic for the frustum
length. I suspect this is a problem we already had in 0.8 and might be
fairly hard to solve until we fixup our blueprint & object property
story.


Before:

![image](https://github.com/rerun-io/rerun/assets/1220815/fa3e3867-aa52-47da-b0a9-83eae9436429)

After:

![image](https://github.com/rerun-io/rerun/assets/1220815/2dd20446-bc68-4c22-99ab-0465f64262dc)


Test code:
```py
"""Log a pinhole and a random image."""
import numpy as np
import rerun as rr

rr.init("rerun_example_pinhole", spawn=True)
rng = np.random.default_rng(12345)

image = rng.uniform(0, 255, size=[3, 3, 3])
rr.log("world/camera/image", rr.Pinhole(focal_length=3, width=3, height=3))
rr.log("world/camera/image", rr.Image(image))

image = rng.uniform(0, 255, size=[3, 3, 1])
rr.log("seg", rr.SegmentationImage(image))
```

Also made sure this doesn't regress the fix in #3583 (which touched this
code last!)

### 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 [demo.rerun.io](https://demo.rerun.io/pr/3681) (if
applicable)

- [PR Build Summary](https://build.rerun.io/pr/3681)
- [Docs
preview](https://rerun.io/preview/a29d7764be26c9cc746a726c589a284ef7efad8f/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/a29d7764be26c9cc746a726c589a284ef7efad8f/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://ref.rerun.io/dev/bench/)
- [Wasm size tracking](https://ref.rerun.io/dev/sizes/)

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request include in changelog 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rr.Tensor with image-like shape does not show in viewer
2 participants