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

[Ai-1263] darwin py converts polygon annotations incorrectly #686

Merged

Conversation

ChristofferEdlund
Copy link
Contributor

Problem

Darwin-py's converter to V1 format from V2 converts polygons incorrectly, since all annotations used by gust utilizes V1 format (at least for now, we should migrate) the annotations become faulty for our models.

Affected annotation types are polygon and complex_polygon.

What is wrong?

Tags such as bounding_box gets places inside of the polygon tag in the dictionary.

How it should look like:

correct_darwin_v1_annotation_dict = {
  "polygon" : {"path" : x, y ....}
  "bounding_box" : {"x":x, "y": y, ...}
  "tag" : {...}
}

How it currently is exported as:


wrong_darwin_v1_annotation_dict = {
  "polygon" : {
        "path" : x, y ....}
        "bounding_box" : {"x":x, "y": y, ...}
         "tag" : {...}
  }
}

Why does this matter? The dataloaders now have to infer the bounding_box from polygons, but the data is already there.

Solution

Update the darwin_v_1_0.py to better handle the conversion

Changelog

  • Fixed bug in to-darwin-v1-convertion of annotations. Will affect darwin convert darwin_1_0 v7_dataset_folder target_folder

@linear
Copy link

linear bot commented Oct 13, 2023

AI-1263 Darwin-py converts polygon annotations incorrectly

Darwin-py's converter to V1 format from V2 converts polygons incorrectly, since all annotations used by gust utilizes V1 format (at least for now, we should migrate) the annotations become faulty for our models.

Affected annotation types are polygon and complex_polygon.

What is wrong?

Tags such as bounding_box gets places inside of the polygon tag in the dictionary.

How it should look like:

correct_darwin_v1_annotation_dict = {
  "polygon" : {"path" : x, y ....}
  "bounding_box" : {"x":x, "y": y, ...}
  "tag" : {...}
}

How it currently is exported as:

worng_darwin_v1_annotation_dict = {
  "polygon" : {
        "path" : x, y ....}
        "bounding_box" : {"x":x, "y": y, ...}
         "tag" : {...}
  }
}

Why does this matter? The dataloaders now have to infer the bounding_box from polygons, but the data is already there.

Copy link
Contributor Author

@ChristofferEdlund ChristofferEdlund left a comment

Choose a reason for hiding this comment

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

Manual testing has been done. Downloaded v2 datasets, converted to V1 and tested to use our torch dataloaders for the following classes.

  • tag
  • bounding_box
  • polygon

else:
return {annotation_class.annotation_type: data}
v1_data = {}
polygon_annotation_mappings = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the use of a mapping, stylistically.

Copy link
Contributor Author

@ChristofferEdlund ChristofferEdlund left a comment

Choose a reason for hiding this comment

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

Added a bunch of tests for the converter.

The log for the main darwin-py can be seen here (they did not pass the new tests)

darwin_test_fails_log.txt

@owencjones owencjones merged commit 9c5808e into master Oct 17, 2023
13 checks passed
@ChristofferEdlund ChristofferEdlund deleted the ai-1263-darwin-py-converts-polygon-annotations-incorrectly branch October 17, 2023 08:39
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.

2 participants