pytorch3d
pytorch3d copied to clipboard
new values must have the same number of points
🐛 Bugs / Unexpected behaviors
I load obj file,and when I want to render it to image, I get error: new values must have the same number of points
Instructions To Reproduce the Issue:
this is my obj file: just contains a polyline:
my core code is:
mesh = load_objs_as_meshes([obj_filename], create_texture_atlas=False, device=device)
camera = FoVOrthographicCameras(R=R, T=T, device=device, znear=XX, zfar=XX, max_x=XX, min_x=XX, max_y=XX, min_y=XX )
raster_settings = RasterizationSettings(
image_size=int(500),
blur_radius=0.0,
faces_per_pixel=10,
)
renderer = MeshRenderer(
rasterizer=MeshRasterizer(
cameras=camera,
raster_settings=raster_settings
),
shader=HardPhongShader(
device=device,
cameras=camera,
lights=lights
)
)
target_images = renderer(mesh) # get error
Can you share a stack trace? Any other details you have?
Can you share a stack trace? Any other details you have?
this is full stack trace:
Traceback (most recent call last):
File "C:\Users\Administrator\PycharmProjects\pythonProject\main.py", line 129, in <module>
target_images = renderer(mesh)
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\pytorch3d-0.7.0-py3.9-win-amd64.egg\pytorch3d\renderer\mesh\renderer.py", line 61, in forward
fragments = self.rasterizer(meshes_world, **kwargs)
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\pytorch3d-0.7.0-py3.9-win-amd64.egg\pytorch3d\renderer\mesh\rasterizer.py", line 219, in forward
meshes_proj = self.transform(meshes_world, **kwargs)
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\pytorch3d-0.7.0-py3.9-win-amd64.egg\pytorch3d\renderer\mesh\rasterizer.py", line 208, in transform
meshes_ndc = meshes_world.update_padded(new_verts_padded=verts_ndc)
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\pytorch3d-0.7.0-py3.9-win-amd64.egg\pytorch3d\structures\meshes.py", line 1426, in update_padded
check_shapes(new_verts_padded, [self._N, self._V, 3])
File "C:\ProgramData\anaconda3\envs\py39\lib\site-packages\pytorch3d-0.7.0-py3.9-win-amd64.egg\pytorch3d\structures\meshes.py", line 1422, in check_shapes
raise ValueError("new values must have the same number of points.")
ValueError: new values must have the same number of points.
The other OBJ models are working properly, but this data.obj file only contains polylines, and I am not sure if this OBJ is reasonable. Normal opening in CC: