-
Notifications
You must be signed in to change notification settings - Fork 465
Geti classification labels messed up by OTX #2397
Copy link
Copy link
Closed
Description
The labels from the OTX are completely different order than what is coming in from Geti Deployment
Steps to Reproduce
- Create a geti classification project with multiple labels (non hierarchical) and train a model
- Take an image from the training data and pass it to the model and look a the prediction
- The prediction will be wrong.
- 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels