-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[?] Confusion on how map_labels() works #4228
Labels
bug
Bug fixes
Comments
Thanks for the report @GilSeamas import fiftyone as fo
ds = fo.Dataset()
ds.add_samples(
[
fo.Sample(
filepath="/path/to/image1.png",
ground_truth=fo.Detections(
detections=[
fo.Detection(label="HUMAN"),
fo.Detection(label="HUMAN_IN_STREET"),
]
),
),
fo.Sample(
filepath="/path/to/image2.png",
ground_truth=fo.Detections(
detections=[
fo.Detection(label="HUMAN_IN_CAR"),
fo.Detection(label="HUMAN_IN_BUILDING"),
]
),
),
]
)
assert ds.values("ground_truth.detections.label") == [
['HUMAN', 'HUMAN_IN_STREET'],
['HUMAN_IN_CAR', 'HUMAN_IN_BUILDING']
]
mapping = {
"HUMAN": None,
"HUMAN_IN_STREET": "HUMAN",
"HUMAN_IN_CAR": None,
"HUMAN_IN_BUILDING": None,
}
view = ds.map_labels("ground_truth", mapping)
assert view.values("ground_truth.detections.label") == [
[None, 'HUMAN'],
[None, None]
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PROBLEM
map_labels method does not make mapping one by one, basically there is this mapping:
for example:
HUMAN: None
HUMAN_IN_STREET: HUMAN
HUMAN_IN_CAR: None
HUMAN_IN_BUILDING: None
Our database has a problem which has HUMAN label for objects that are not HUMAN_IN_STREET, but rather humans in places like CAR and BUILDING, which we are not interested in detecting.
We make the mapping above to solve that.
However, map_labels returns the following mapping
HUMAN: None
HUMAN_IN_STREET: None
HUMAN_IN_CAR: None
HUMAN_IN_BUILDING: None
since HUMAN_IN_STREET is mapped to HUMAN, and HUMAN mapped to None, in the end
HUMAN_IN_STREET: None
Code to reproduce issue
this is not necesserily a bug, because this use case is very specific but I guess this is not the expected behaviour and maybe yout would like to take a look
best regards,
Gil
The text was updated successfully, but these errors were encountered: