Skip to content

Geti classification labels messed up by OTX #2397

@ssainis-0131

Description

@ssainis-0131

The labels from the OTX are completely different order than what is coming in from Geti Deployment

Steps to Reproduce

  1. Create a geti classification project with multiple labels (non hierarchical) and train a model
  2. Take an image from the training data and pass it to the model and look a the prediction
  3. The prediction will be wrong.
  4. Walking through the trace of the load_inference method, you will see it is creating an _inference_conveter in the deployment object using the get_labels method on line 340 of otx/api/entities/label_schema.py

line 340 currently reads

labels = {label for group in self._groups for label in group.labels if include_empty or not `label.is_empty}

As the "set" function destroys the local order of the list it is asked to convert into a set, we get label order that is completey different from the input label list.

My proposed fix to his is

labels = [label for group in self._groups for label in group.labels if include_empty or not label.is_empty]
# remove duplicates
labels = [label for i, label in labels if label not in labels[:i]]

This should preserve the order.

I have tested this at my end. I recommend implementing it in the main code.

Environment:
Bug is independent of the environment

  • OS: Windows (but irrelevant to the bug
  • Framework version: none
  • Python version: 3.8
  • OpenVINO version: 1.2.4
  • CUDA/cuDNN version: none
  • GPU model and memory: none

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