pytorch3d
pytorch3d copied to clipboard
when i use pytorch3d to visual a voxel error.
❓ Questions on how to use PyTorch3D
i use the code below to visual my voxel from shapenet. the shapenet model is d8e2e2a923b372731cf97e154cc62f43. i look this model in meshlab which is correct. Why does this happen?
def render_vox(voxels_src, src_path = "submissions/source_vox.gif", num_views = 100):
R, T = look_at_view_transform(dist=5, elev=0, azim=np.linspace(-180, 180, num_views, endpoint=False))
many_cameras = FoVPerspectiveCameras(R=R, T=T, device=voxels_src.device)
renderer = get_mesh_renderer(device=voxels_src.device)
cube_src = cubify(voxels_src, 0.5, align="center")
vertex_src = cube_src.verts_list()[0]
texture_src = TexturesVertex(vertex_src.unsqueeze(0))
cube_src.textures = texture_src
my_images = renderer(cube_src.extend(num_views), cameras=many_cameras)
my_images = my_images[:, ..., :3].cpu().detach().numpy()
my_images = (my_images * 255).astype(np.uint8)
img_list = [i for i in my_images]
imageio.mimsave(src_path, img_list, fps=15)
this figure is used imageio
this figure is used meshlab to watch.