Skip to content

Bug in obj_io.py with shapenet #1368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
naifuliang opened this issue Oct 24, 2022 · 1 comment
Closed

Bug in obj_io.py with shapenet #1368

naifuliang opened this issue Oct 24, 2022 · 1 comment

Comments

@naifuliang
Copy link

naifuliang commented Oct 24, 2022

🐛 Bugs / Unexpected behaviors

Error Information:

line 635, in _load_obj
    face_material_names = np.array(material_names)[idx]  # (F,)
IndexError: index -1 is out of bounds for axis 0 with size 0

Instructions To Reproduce the Issue:

https://github.com/facebookresearch/pytorch3d/blob/main/pytorch3d/datasets/shapenet/shapenet_core.py line

        # Create an array of strings of material names for each face.
        # If faces_materials_idx == -1 then that face doesn't have a material.
        idx = faces_materials_idx.cpu().numpy()
        face_material_names = np.array(material_names)[idx]  # (F,)
        face_material_names[idx == -1] = ""

If idx ==-1, np.array(material_names)[-1] will be executed, which causes an error.

@bottler bottler changed the title Bug in obj_io.py Bug in obj_io.py with shapenet Oct 24, 2022
facebook-github-bot pushed a commit that referenced this issue Sep 13, 2024
Summary:
Make the negative index actually not an error

fixes #1368

Reviewed By: das-intensity

Differential Revision: D62177991

fbshipit-source-id: e5ed433bde1f54251c4d4b6db073c029cbe87343
@bottler
Copy link
Contributor

bottler commented Sep 13, 2024

If this was still an issue then 9acdd67 must have squashed it just now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants