Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
visu3d
is an abstraction layer between Torch/TF/Jax/Numpy and your program.
It provides:
Ray
, Camera
, Transform
,...).
You can combine those standard primitives with your custom ones.dataclass_array
,
dataclasses which can be reshaped, sliced,... as if they were numpy arrays.Everything is a v3d.DataclassArray
: dataclass behave like np.array
(with
indexing, slicing, shape manipulation, vectorization,...).
# Single ray
ray = v3d.Ray(pos=[0, 0, 0], dir=[1, 1, 1])
assert rays.shape == ()
# Multiple rays batched together
rays = v3d.Ray(pos=np.zeros((B, H, W, 3)), dir=np.ones((B, H, W, 3)))
assert rays.shape == (B, H, W)
rays = rays.reshape('b h w -> b (h w)') # Native `einops` support
top_left_ray = rays[..., 0, 0] # (b, h, w) -> (b,)
rays = rays.flatten()
rays = rays[rays.norm() > 0] # Filter invalid rays
Everything is visualizable interactively
Every object has a .fig
property for interactive visualization:
rays.fig # Plot the rays
Display multiple objects together:
v3d.make_fig([cam, rays, point_cloud])
Auto-plot figures with Colab magic:
v3d.auto_plot_figs() # Once at the start of the Colab
cam, rays, point_cloud # Tuple auto-displayed without `v3d.make_fig` call
Same code seamlessly works across Torch, Jax, TensorFlow, Numpy.
rays = rays.as_jax() # .as_tf(), as_np(), .as_jax()
assert isinstance(rays.pos, jnp.ndarray)
assert rays.xnp is jnp
rays = rays.as_torch()
assert isinstance(rays.pos, torch.Tensor)
assert rays.xnp is torch
With native support for auto-diff, jax.vmap
, jax.tree_utils
,...
Common primitives (Ray
, Camera
, Transform
,...), so user can express
intent, instead of math.
H, W = (256, 1024)
cam_spec = v3d.PinholeCamera.from_focal(
resolution=(H, W),
focal_in_px=35.,
)
cam = v3d.Camera.from_look_at(
spec=cam_spec,
pos=[5, 5, 5],
target=[0, 0, 0], # Camera looks at the scene center
)
rays = cam.rays() # Rays in world coordinates
# Project `(*shape, 3)` world coordinates into `(*shape, 2)` pixel coordinates.
px_coords = cam.px_from_world @ point_cloud
See the API for a full list of primitive.
Creating your own primitives is trivial.
Converting any dataclass to dataclass array is trivial:
v3d.DataclassArray
etils.array_types
to annotate the array fields (or exlicitly use my_field: Any = dca.field(shape=, dtype=)
instead of dataclasses.field
)from etils.array_types import FloatArray
class MyRay(v3d.DataclassArray):
pos: FloatArray[..., 3]
dir: FloatArray[..., 3]
rays = MyRay(pos=jnp.zeros((H, W, 3)), dir=jnp.ones((H, W, 3)))
assert rays.shape == (H, W)
v3d
makes it easy to opt-in to the feature you need by implementing the
corresponding protocol.
The best way to get started is to try the Colab tutorials (in the documentation):
Installation:
pip install visu3d
Usage:
import visu3d as v3d
pip install visu3d
This is not an official Google product.
FAQs
3d geometry made easy.
We found that visu3d demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.