Pytorch3d: Blurred rendering bug

Created on 18 Aug 2020  路  7Comments  路  Source: facebookresearch/pytorch3d

It seem like blurred rendering does not work in nightly build.
Setting blur_radius=0.001 causes IndexError or CUDA error.

馃悰 Bugs / Unexpected behaviors

Instructions To Reproduce the Issue:

import os

import matplotlib.pyplot as plt
import pytorch3d.io

import torch
from pytorch3d.structures import Meshes
from pytorch3d.renderer.mesh import TexturesAtlas
from pytorch3d.renderer import (look_at_view_transform, OpenGLPerspectiveCameras, RasterizationSettings, MeshRenderer,
                                MeshRasterizer, BlendParams, SoftPhongShader, PointLights
                                )

device = torch.device('cuda:0')
# device = torch.device('cpu')

# load mesh
base_dir = os.path.dirname(os.path.realpath(__file__))
DATA_DIR = "data"
obj_filename = os.path.join(base_dir, DATA_DIR, "cow_mesh/cow.obj")
verts, faces_idx, _ = pytorch3d.io.load_obj(obj_filename, load_textures=False)
faces = faces_idx.verts_idx

F = faces.shape[0]
atlas = torch.ones(1, F, 1, 1, 3)  # (1, F, R=1, R=1, D=3) white
texture = TexturesAtlas(atlas)

# create mesh with texture atlas
mesh = Meshes(verts=[verts], faces=[faces], textures=texture).to(device)

# renderer
R, T = look_at_view_transform(5, 0, 0)
cameras = OpenGLPerspectiveCameras(device=device, R=R, T=T)
lights = PointLights(device=device, location=[[0.0, 0.0, -3.0]])
raster_settings = RasterizationSettings(
    image_size=512,
    blur_radius=0.00001, # bug
    faces_per_pixel=5,
)

blend_params = BlendParams(sigma=1e-4, gamma=1e-4, background_color=(0.0, 0.0, 0.0))

renderer_ = MeshRenderer(
    rasterizer=MeshRasterizer(cameras=cameras, raster_settings=raster_settings),
    shader=SoftPhongShader(device=device, cameras=cameras, lights=lights, blend_params=blend_params)
)
images = renderer_(mesh, cameras=cameras)

tt = images[0, ..., :].cpu().numpy()

fig, ax = plt.subplots()
ax.imshow(tt)
fig.show()

environment

Ubuntu 20.04
python 3.8
conda install pytorch3d -c pytorch3d-nightly
bug

All 7 comments

@Deuce0 thanks for reporting this issue. We will try to reproduce it and get back to you. Does it work on CPU? What if you change the texture type to e.g. TexturesVertex do you experience the same issue?

Above code (TexturesAtlas) produces IndexError on CPU

Traceback (most recent call last):
  File "/mnt/d/workspace/3d/tmp/bbb.py", line 51, in <module>
    images = renderer_(mesh, cameras=cameras)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/renderer.py", line 49, in forward
    images = self.shader(fragments, meshes_world, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shader.py", line 108, in forward
    texels = meshes.sample_textures(fragments)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/meshes.py", line 1496, in sample_textures
    return self.textures.sample_textures(
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/textures.py", line 499, in sample_textures
    texels = atlas_packed[pix_to_face, w_y, w_x]
IndexError: index 1 is out of bounds for dimension 2 with size 1

and CUDA error on GPU.

/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [100,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [101,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [102,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [109,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [110,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [111,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [37,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [38,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [39,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [85,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [86,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [87,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [1,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [2,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [3,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [7,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [8,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [9,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [16,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [17,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [18,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [22,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [23,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [24,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [31,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [103,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [104,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [105,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [118,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [119,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [120,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
Traceback (most recent call last):
  File "/mnt/d/workspace/3d/tmp/bbb.py", line 51, in <module>
    images = renderer_(mesh, cameras=cameras)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/renderer.py", line 49, in forward
    images = self.shader(fragments, meshes_world, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shader.py", line 112, in forward
    colors = phong_shading(
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shading.py", line 71, in phong_shading
    vertex_normals = meshes.verts_normals_packed()  # (V, 3)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/meshes.py", line 684, in verts_normals_packed
    self._compute_vertex_normals()
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/meshes.py", line 808, in _compute_vertex_normals
    if self.isempty():
RuntimeError: CUDA error: device-side assert triggered

Process finished with exit code 1

TexturesVertex works on nightly build. (CPU and GPU)

I think this is because TexturesAtlas cannot cope with the negative barycentric coordinates which come from blurring, and so you need clipping to be turned on. The default was changed in https://github.com/facebookresearch/pytorch3d/commit/46c0e834616f6950d0ed5a9826a49744d8e83f7e to enable clipping whenever the blur radius is positive, so I think your example now work.

I updated pytorch3d to v0.2.5 release and manually turned on clipping. The issue is not resolved. I will use TexturesVertex for now.

import os

import matplotlib.pyplot as plt
import pytorch3d.io

import torch
from pytorch3d.structures import Meshes
from pytorch3d.renderer.mesh import TexturesAtlas, TexturesVertex
from pytorch3d.renderer import (look_at_view_transform, OpenGLPerspectiveCameras, RasterizationSettings, MeshRenderer,
                                MeshRasterizer, BlendParams, SoftPhongShader, PointLights
                                )

device = torch.device('cuda:0')
# device = torch.device('cpu')

# load mesh
base_dir = os.path.dirname(os.path.realpath(__file__))
DATA_DIR = "data"
obj_filename = os.path.join(base_dir, DATA_DIR, "cow_mesh/cow.obj")
verts, faces_idx, _ = pytorch3d.io.load_obj(obj_filename, load_textures=False)
faces = faces_idx.verts_idx

# TexturesAtlas
F = faces.shape[0]
atlas = torch.ones(1, F, 1, 1, 3)  # (N=1, F, R=1, R=1, D=3) white
texture = TexturesAtlas(atlas)

# TexturesVertex
# V = verts.shape[0]
# verts_features = torch.ones(1, V, 3)  # (N=1, V, D=3) white
# texture = TexturesVertex(verts_features)

# create mesh with texture atlas
mesh = Meshes(verts=[verts], faces=[faces], textures=texture).to(device)

# renderer
R, T = look_at_view_transform(5, 0, 0)
cameras = OpenGLPerspectiveCameras(device=device, R=R, T=T)
lights = PointLights(device=device, location=[[0.0, 0.0, -3.0]])
raster_settings = RasterizationSettings(
    image_size=512,
    blur_radius=0.001,  # bug
    faces_per_pixel=100,
    clip_barycentric_coords=True,  # clipping
)

blend_params = BlendParams(sigma=1e-4, gamma=1e-4, background_color=(0.0, 0.0, 0.0))

renderer_ = MeshRenderer(
    rasterizer=MeshRasterizer(cameras=cameras, raster_settings=raster_settings),
    shader=SoftPhongShader(device=device, cameras=cameras, lights=lights, blend_params=blend_params)
)
images = renderer_(mesh, cameras=cameras)

tt = images[0, ..., :].cpu().numpy()

fig, ax = plt.subplots()
ax.imshow(tt)
fig.show()

I am working on https://github.com/facebookresearch/pytorch3d/issues/342 and I think we have an issue in our sample_textures with TextureAtlas. Namely, here

https://github.com/facebookresearch/pytorch3d/blob/dc40adfa245b019e19de7ee6bc0d736a07742b06/pytorch3d/renderer/mesh/textures.py#L497

The barycentric coordinates are multiplied by R. So if a barycentric coordinate is (1,1) then it maps to (R,R) which is problematic when it comes to indexing the texture atlas image. I think the two issues are related in that regard and issue https://github.com/facebookresearch/pytorch3d/issues/342 is giving us data to reproduce the problem.

Hello. I would like to ask on updates on resolving this issue so far? I also encountered the same IndexError (on CPU) with my own code that is similar.

Above code (TexturesAtlas) produces IndexError on CPU

Traceback (most recent call last):
  File "/mnt/d/workspace/3d/tmp/bbb.py", line 51, in <module>
    images = renderer_(mesh, cameras=cameras)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/renderer.py", line 49, in forward
    images = self.shader(fragments, meshes_world, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shader.py", line 108, in forward
    texels = meshes.sample_textures(fragments)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/meshes.py", line 1496, in sample_textures
    return self.textures.sample_textures(
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/textures.py", line 499, in sample_textures
    texels = atlas_packed[pix_to_face, w_y, w_x]
IndexError: index 1 is out of bounds for dimension 2 with size 1

and CUDA error on GPU.

/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [100,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [101,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [102,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [109,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [110,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [111,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [37,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [38,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [39,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [85,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [86,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2797,0,0], thread: [87,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [1,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [2,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [3,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [7,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [8,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [9,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [16,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [17,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [18,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [22,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [23,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [24,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2587,0,0], thread: [31,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [103,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [104,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [105,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [118,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [119,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
/opt/conda/conda-bld/pytorch_1595629395347/work/aten/src/ATen/native/cuda/IndexKernel.cu:84: operator(): block: [2796,0,0], thread: [120,0,0] Assertion `index >= -sizes[i] && index < sizes[i] && "index out of bounds"` failed.
Traceback (most recent call last):
  File "/mnt/d/workspace/3d/tmp/bbb.py", line 51, in <module>
    images = renderer_(mesh, cameras=cameras)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/renderer.py", line 49, in forward
    images = self.shader(fragments, meshes_world, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shader.py", line 112, in forward
    colors = phong_shading(
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/renderer/mesh/shading.py", line 71, in phong_shading
    vertex_normals = meshes.verts_normals_packed()  # (V, 3)
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/meshes.py", line 684, in verts_normals_packed
    self._compute_vertex_normals()
  File "/home/user/miniconda3/envs/pytorch3d/lib/python3.8/site-packages/pytorch3d/structures/meshes.py", line 808, in _compute_vertex_normals
    if self.isempty():
RuntimeError: CUDA error: device-side assert triggered

Process finished with exit code 1

TexturesVertex works on nightly build. (CPU and GPU)

@Deuce0 this issue has now been fixed - see #342 for more details.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

unlugi picture unlugi  路  3Comments

aluo-x picture aluo-x  路  3Comments

MarkTension picture MarkTension  路  3Comments

NotAnyMike picture NotAnyMike  路  3Comments

farhanrw picture farhanrw  路  3Comments