Skip to content

RuntimeError: CUDA error: an illegal memory access was encountered #39

@mountain-shui

Description

@mountain-shui

I am using your save_obj function, expecting to save the .obj as well as its texture generated from your model.

I get the following error:

(venv) H:\workSpace\pythonCode\Texformer-master>python demo.py --img_path demo_imgs/img.png --seg_path demo_imgs/seg.png
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\modules\container.py:597: UserWarning: Setting attributes on ParameterDict is not supported.
warnings.warn("Setting attributes on ParameterDict is not supported.")
H:\workSpace\pythonCode\Texformer-master\transformers\net_utils.py:83: UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\functional.py:4004: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
"Default grid_sample and affine_grid behavior has changed "
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]

(venv) H:\workSpace\pythonCode\Texformer-master>python demo.py --img_path demo_imgs/img.png --seg_path demo_imgs/seg.png
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\modules\container.py:597: UserWarning: Setting attributes on ParameterDict is not supported.
warnings.warn("Setting attributes on ParameterDict is not supported.")
H:\workSpace\pythonCode\Texformer-master\transformers\net_utils.py:83: UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It cu
rrently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
dim_t = self.temperature ** (2 * (dim_t // 2) / self.num_pos_feats)
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\nn\functional.py:4004: UserWarning: Default grid_sample and affine_grid behavior has changed to align_corners=False since 1.3.0. Please specify align_corners=True if the old behavior is desired. See the documentation of grid_sample for details.
"Default grid_sample and affine_grid behavior has changed "
H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ..\aten\src\ATen\native\TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Error in create_texture_image: an illegal memory access was encountered
Error in create_texture_image_boundary: an illegal memory access was encountered
Traceback (most recent call last):
File "demo.py", line 182, in
demo.run_demo(args)
File "H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "demo.py", line 146, in run_demo
rendered_img, _, _ = self.renderer.render(self.pred_vertices, self.pred_cam_t, uvmap)
File "H:\workSpace\pythonCode\Texformer-master\NMR\neural_render_test.py", line 128, in render
nr.save_obj("myTest" + str(self.count), tempVerts, tempFaces, textures=tex_tensor)
File "H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\neural_renderer_pytorch-1.1.3-py3.7-win-amd64.egg\neural_renderer\save_obj.py", line 48, in save_obj
texture_image, vertices_textures = create_texture_image(textures)
File "H:\workSpace\pythonCode\Texformer-master\venv\lib\site-packages\neural_renderer_pytorch-1.1.3-py3.7-win-amd64.egg\neural_renderer\save_obj.py", line 30, in create_texture_image
vertices[:, :, 0] /= (image.shape[1] - 1)
RuntimeError: CUDA error: an illegal memory access was encountered

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions