Skip to content
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

Fix LFW format #19

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Fix LFW format #19

wants to merge 3 commits into from

Conversation

sizov-kirill
Copy link

Summary

Resolves cvat-ai/cvat#5100

How to test

Checklist

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below)
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT

@yasakova-anastasia
Copy link

We don't get any annotations when we import if we only export points. This is true? It's correct in terms of format, but I'm not sure that it's good for CVAT. Maybe generalize this format? We can save both points and labels if we only have points. That is, when importing such a dataset, we will add extra labels, but the points will not disappear.

@sizov-kirill
Copy link
Author

sizov-kirill commented Dec 5, 2022

We don't get any annotations when we import if we only export points. This is true? It's correct in terms of format, but I'm not sure that it's good for CVAT. Maybe generalize this format? We can save both points and labels if we only have points. That is, when importing such a dataset, we will add extra labels, but the points will not disappear.

Yes, it's true. If we have only points annotations exported dataset in LFW format will be empty.

I didn't choose the solution you suggested for the following reasons:

  1. If user annotated one image with few Point objects that have different labels it's not clear how to represent such information in LFW format, because in LFW landmarks are described with the following format <img> <points> so we don't have any opportunity to set corresponding between specific point and specific label
  2. If during export we try to add Tags that aren't represented in original annotations it's not clear which labels we should to add. Probably if we have points on image that all have one label it's not problem. But if we have points with different label on the same image it's not clear which label we should chose for Label object. Of course we can add multiply Labels for one image , but format doesn't assume such usage.

But I understand that this is not an obvious question and it is difficult to find only one "correct" solution.

@zhiltsov-max How do you think?

@yasakova-anastasia
Copy link

Could you please update the Changelog?

I also think the documentation needs to be updated.

Comment on lines +148 to +171
source_dataset = Dataset.from_iterable(
[
DatasetItem(
id="name0_0001",
subset="test",
media=Image(data=np.ones((2, 5, 3))),
annotations=[
Points([0, 4, 3, 3, 2, 2, 1, 0, 3, 0], label=0),
],
),
],
categories=["name0"],
)

target_dataset = Dataset.from_iterable(
[
DatasetItem(
id="name0_0001",
subset="test",
media=Image(data=np.ones((2, 5, 3))),
),
],
categories=["name0"],
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this behavior in the test is right. From the format viewpoint, the input annotations are incomplete, and it doesn't seem we can adequately support such cases in the format, so the best approach would be either to complete the missing annotations, if possible, or raise a clear error message otherwise.

My considerations on this specific case with CVAT export are here. Let's try to make the format clearly usable from CVAT, Datumaro seem to be correct at this point.

Copy link

sonarcloud bot commented Jun 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Impossible import annotations with points in LFW 1.0 format
3 participants