Skip to content

Bug in obj_io.py with shapenet #1368

Closed
Closed
@naifuliang

Description

@naifuliang

🐛 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions