Skip to content

IndexError in model.eval due to dataset/model ontology index mismatch #346

@Saitejabojja07

Description

@Saitejabojja07

While running tutorial_image_segmentation.ipynb
(https://github.com/JdeRobot/DetectionMetrics/blob/master/examples/tutorial_image_segmentation.ipynb),
I encountered an IndexError: index out of range during model.eval().

After debugging, it appears that:

  • lut_ontology is built using model ontology indices (contiguous)
  • During model.eval, it is accessed as lut_ontology[label]
  • However, label comes from the dataset ontology, which contains non-contiguous and larger class indices

This mismatch causes out-of-bounds indexing when dataset labels exceed the LUT size.

Observed Error

IndexError: index 33 is out of bounds for dimension 0 with size 20

Root Cause

The LUT assumes aligned or contiguous class indices, but dataset ontology indices differ from model ontology indices.

Additional Observation

This issue is only observed when running the notebook on Google Colab.
When running the same notebook in a local environment, it completes without any errors.

Image

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