Trace3D icon indicating copy to clipboard operation
Trace3D copied to clipboard

Encountered illegal memory access issues when running merge_patches

Open surpoloyang opened this issue 1 year ago • 3 comments

(trace3d) surpolo@cyPC:~/3Dreconstruction/Trace3D/script$ (trace3d) surpolo@cyPC:~/3Dreconstruction/Trace3D/script$ bash replica.sh merge_patches 当前工作目录: /home/surpolo/3Dreconstruction/Trace3D Looking for config file in ./output/Bean0915-1300/cfg_args Config file found: ./output/Bean0915-1300/cfg_args Loading trained model at iteration 30000 /home/surpolo/3Dreconstruction/Trace3D/data/Bean0915-1300 Reading camera 82/82read 0 sam masks Loading Training Cameras [ INFO ] Encountered quite large input images (>1.6K pixels width), rescaling to 1.6K. If this is not desired, please explicitly specify '--resolution/-r' as 1 Loading Test Cameras Found 82 SAM mask files. 82it [00:03, 22.73it/s] Traceback (most recent call last): File "/home/surpolo/3Dreconstruction/Trace3D/merge_patches.py", line 180, in main() File "/home/surpolo/3Dreconstruction/Trace3D/merge_patches.py", line 176, in main pipeline.repair_masks(pipe, background, args.alpha_w) File "/home/surpolo/3Dreconstruction/Trace3D/merge_patches.py", line 121, in repair_masks self._repair_iteration(masks, iteration,pipe,background) File "/home/surpolo/3Dreconstruction/Trace3D/merge_patches.py", line 132, in _repair_iteration weights = self.compute_weights(masks, self.camera_stack, pipe, background, alpha_w) File "/home/surpolo/3Dreconstruction/Trace3D/merge_patches.py", line 97, in compute_weights w = torch.argmax(w, dim=-1) RuntimeError: CUDA error: an illegal memory access was encountered CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect. Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

Image

The known difference from the installation operation is that I used pip install --no-build-isolation -r requirements.txt, because I encountered an issue with torch when installing submodules.

surpoloyang avatar Nov 23 '25 11:11 surpoloyang

issue with torch when installing submodules, while i've installed torch with cuda: Traceback (most recent call last): File "/home/surpolo/anaconda3/envs/trace3d/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in main() File "/home/surpolo/anaconda3/envs/trace3d/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "/home/surpolo/anaconda3/envs/trace3d/lib/python3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 157, in get_requires_for_build_editable return hook(config_settings) File "/tmp/pip-build-env-ovmkwd7u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 473, in get_requires_for_build_editable return self.get_requires_for_build_wheel(config_settings) File "/tmp/pip-build-env-ovmkwd7u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "/tmp/pip-build-env-ovmkwd7u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-ovmkwd7u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "/tmp/pip-build-env-ovmkwd7u/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "", line 13, in ModuleNotFoundError: No module named 'torch'

surpoloyang avatar Nov 23 '25 11:11 surpoloyang

Notice that your log shows:

Loading Training Cameras
[ INFO ] Encountered quite large input images (>1.6K pixels width), rescaling to 1.6K.

This means the input images are automatically downscaled to 1600px width during loading. However, your SAM masks were generated using the original high-resolution images, so their shapes no longer match after the auto-rescaling. To avoid this mismatch, you should rescale the images before generating SAM masks.

shy2000 avatar Nov 27 '25 04:11 shy2000

I will try it.Thx! ---- Replied Message ---- From沈洪宇(hongyu @.>Date11/27/2025 12:51 @.> CcChen @.>, @.>SubjectRe: [trace-3d/Trace3D] Encountered illegal memory access issues when running merge_patches (Issue #5) shy2000 left a comment (trace-3d/Trace3D#5) Notice that your log shows: Loading Training Cameras [ INFO ] Encountered quite large input images (>1.6K pixels width), rescaling to 1.6K. This means the input images are automatically downscaled to 1600px width during loading. However, your SAM masks were generated using the original high-resolution images, so their shapes no longer match after the auto-rescaling. To avoid this mismatch, you should rescale the images before generating SAM masks. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

surpoloyang avatar Nov 27 '25 05:11 surpoloyang