-
Notifications
You must be signed in to change notification settings - Fork 385
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
Expose tensor slice selection to blueprint #6590
Conversation
…the tensor selection
Deployed docs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(half-reviewed - I ran out of day)
rerun_py/rerun_sdk/rerun/datatypes/tensor_dimension_selection_ext.py
Outdated
Show resolved
Hide resolved
docs/snippets/all/views/tensor.py
Outdated
tensor = np.random.randint(0, 256, (32, 20, 12, 14), dtype=np.uint8) | ||
rr.log("tensor", rr.Tensor(tensor, dim_names=("width", "height", "batch", "other"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think we should make our examples as realistic as possible to make it easier for users to copy-paste them
tensor = np.random.randint(0, 256, (32, 20, 12, 14), dtype=np.uint8) | |
rr.log("tensor", rr.Tensor(tensor, dim_names=("width", "height", "batch", "other"))) | |
tensor = np.random.randint(0, 256, (32, 768, 1024, 3), dtype=np.uint8) | |
rr.log("tensor", rr.Tensor(tensor, dim_names=("batch", "height", "width", "channel"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not going with an as-high resolution since it looks too ugly with this noise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm unless I set the filter to "nearest" but that's already the default so not as interesting
crates/re_types/definitions/rerun/blueprint/archetypes/tensor_slice_selection.fbs
Show resolved
Hide resolved
crates/re_types/definitions/rerun/blueprint/datatypes/tensor_dimension_index_slider.fbs
Outdated
Show resolved
Hide resolved
crates/re_types/definitions/rerun/blueprint/datatypes/tensor_dimension_index_slider.fbs
Outdated
Show resolved
Hide resolved
crates/re_types/definitions/rerun/blueprint/components/tensor_dimension_index_slider.fbs
Outdated
Show resolved
Hide resolved
thanks! some neat stuff in there. Plz have a quick look at the comments I replied to |
/// General rules for scrubbing the input data: | ||
/// * out of bounds dimensions and indices are clamped to valid | ||
/// * missing width/height is filled in if there's at least 2 dimensions. | ||
pub fn load_tensor_slice_selection_and_make_valid( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could really use a unit-test or two.
For instance, what happens if your dimensions are named height, width
and the input is height=1, width=null
? From just reading the code, it looks like maybe the output will be height=1, width=1
.
I guess we should grey it out when there's nothing. But very unrelated to this PR |
I'll make a new issue |
…onfuse them with the width/height setting.
@rerun-bot full-check |
Started a full build: https://github.com/rerun-io/rerun/actions/runs/9646353988 |
What
Updated python example:
Models out the tensor slice selection in store compatible data structures
Refrained from polishing up the ui all that much, it's pretty much the same but uses the new datastructure under the hood.
Minor differences:
Had to do add a bit of codegen for python struct serialization, but ended up doing most of the new datatypes by hand after all because of hard to generalize conversions.
Tested manually against 1D tensors.
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.