-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request
Description
🐛 Bugs / Unexpected behaviors
Lots of off files from ModelNet40 dataset don't have the newline or space after 'OFF' at the beginning of the file.
e.g. for file monitor/train/monitor_0284.off
It begins with
OFF1046 900 0
-0.797495 -6.623700 9.540650
...
instead of
OFF
1046 900 0
-0.797495 -6.623700 9.540650
...
But the header skip logic below can not handle it
pytorch3d/pytorch3d/io/off_io.py
Lines 229 to 237 in 097b0ef
if header.lower() in (b"off\n", b"off\r\n", "off\n"): | |
header = file.readline() | |
while _is_line_empty(header): | |
header = file.readline() | |
items = header.split(b" ") | |
if len(items) and items[0].lower() in ("off", b"off"): | |
items = items[1:] |
Instructions To Reproduce the Issue:
Please include the following (depending on what the issue is):
- Any changes you made (
git diff
) or code you wrote
from pytorch3d.io import IO
mesh = IO().load_mesh(path_to_off_file)
- The exact command(s) you ran:
In order to read off file, I installed the pytorch3d from source via
pip install "git+https://github.com/facebookresearch/pytorch3d.git"
Since the last stable 0.4.0 doesn't contain 0345f86.
- What you observed (including the full logs):
Traceback (most recent call last):
File "<...>/env/lib/python3.8/site-packages/pytorch3d/io/off_io.py", line 242, in _load_off_stream
n_verts = int(items[0])
ValueError: invalid literal for int() with base 10: b'OFF150'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
[omitted stack]
File "<my_project>/src/datamodules/datasets/modelnet40_dataset.py", line 58, in off_vertex_parser
mesh = IO().load_mesh(path_to_off_file)
File "/data/daizhu/workspace/pc_mesh_transformer_pylight/conda/env/lib/python3.8/site-packages/pytorch3d/io/pluggable.py", line 124, in load_mesh
mesh = mesh_interpreter.read(
File "/data/daizhu/workspace/pc_mesh_transformer_pylight/conda/env/lib/python3.8/site-packages/pytorch3d/io/off_io.py", line 430, in read
data = _load_off_stream(f)
File "/data/daizhu/workspace/pc_mesh_transformer_pylight/conda/env/lib/python3.8/site-packages/pytorch3d/io/off_io.py", line 244, in _load_off_stream
raise ValueError("Invalid counts line: %s" % header)
ValueError: Invalid counts line: b'OFF150 92 0\n'
The above exception was the direct cause of the following exception:
File "./run.py", line 31, in <module>
main()
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/main.py", line 49, in decorated_main
_run_hydra(
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/_internal/utils.py", line 370, in _run_hydra
run_and_report(
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/_internal/utils.py", line 215, in run_and_report
raise ex
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/_internal/utils.py", line 212, in run_and_report
return func()
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/_internal/utils.py", line 371, in <lambda>
lambda: hydra.run(
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/_internal/hydra.py", line 107, in run
_ = ret.return_value
File "<my_project>/conda/env/lib/python3.8/site-packages/hydra/core/utils.py", line 207, in return_value
raise HydraJobException(
hydra.errors.HydraJobException: Error executing job with overrides: []
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingenhancementNew feature or requestNew feature or request