Pytorch3d: How to render a 3D numpy array.

Created on 28 Apr 2021  ยท  3Comments  ยท  Source: facebookresearch/pytorch3d

โ“ Questions on how to use PyTorch3D

I'd like to render a 3D numpy array consisting of 1 and 0 only, and see it on jupyter notebook(or colab). The array has ball-like shape. I don't have a mesh. Is this rendering possible with this pytorch3d? If it's possible, what pytorch3d api is useful to do this?

I've read "README.md" and it describes some Key features. There are "Render textured meshes" and "Render textured pointclouds". What should I see?

how to question

Most helpful comment

PyTorch's VolumeRenderer can be made do this. You can see a slightly more complicated application of it being used in the fit_textured_volume tutorial.

A simple way to visualise the array, without a renderer, would be to use the function torch.nonzero to convert it to a list of occupied coordinates, which you could then make into a PyTorch3D Pointclouds object. This could then be viewed with plotly.

All 3 comments

PyTorch's VolumeRenderer can be made do this. You can see a slightly more complicated application of it being used in the fit_textured_volume tutorial.

A simple way to visualise the array, without a renderer, would be to use the function torch.nonzero to convert it to a list of occupied coordinates, which you could then make into a PyTorch3D Pointclouds object. This could then be viewed with plotly.

For @bottler's second suggestion of converting to a pointcloud, you could use the plotly utils similar to this example: https://pytorch3d.org/tutorials/render_colored_points#View-pointclouds-in-Plotly-figures

For @bottler's second suggestion of converting to a pointcloud, you could use the plotly utils similar to this example: https://pytorch3d.org/tutorials/render_colored_points#View-pointclouds-in-Plotly-figures

Thanks for suggesting such a good work.
I'll try to convert my numpy array to a pointcloud. Is there a module for this? Or should I for-loop my 3D numpy array?


I found np.argwhere(input). Thanks!
Oops @bottler said torch.nonzero.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

farhanrw picture farhanrw  ยท  3Comments

shersoni610 picture shersoni610  ยท  3Comments

eliemichel picture eliemichel  ยท  3Comments

unlugi picture unlugi  ยท  3Comments

cihanongun picture cihanongun  ยท  3Comments