Skip to content

Predicted labels are off by 1 #636

Description

@leoll2

Description

When I run inference with my segmentation model through ModelAPI v0.4.6, all the predicted labels are wrong and seemingly off-by-1 w.r.t. the order of labels encoded in the model .xml.

Steps to reproduce

  1. Download this demo archive - it contains a model, sample image and demo code to reproduce the bug
  2. View the pyproject.toml -> it's configured to download the latest version of MAPI from develop
  3. Run uv run demo.py
  4. View the predictions (result.jpg)
  5. Now re-open pyproject.toml and comment out L23 (# openvino-model-api = { git = ...): this change will force uv to source the official version of MAPI released in Pypi (0.4.5)
  6. Run uv run demo.py
  7. View the predictions (result.jpg)

When running on the official 0.4.5 (step 6), all predictions and their labels seem correct.

Image

Conversely, when doing inference with the latest unreleased MAPI (step 3), all labels are wrong.

Image

From the model.xml we can see the order of the labels:

<label_ids value="None 0 1 2 3 4 5 6 7 8" />
<labels value="getitune_empty_lbl Ball Hoop Human_Ref Period Player Shot_Clock Team_Name Team_Points Time_Left" />

If we compare this order to what we see in the image:

  • Ball corresponds to label_ids=0, but it's predicted as the empty label (label_ids=None)
  • Hoop corresponds to label_ids=1, but it's predicted as the ball (label_ids=0)
  • Human ref corresponds to label_ids=2, but it's predicted as hoop (label_ids=1)
  • and so on

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