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-1477]-darwin-v2-export-fix #721

Merged
merged 76 commits into from
Dec 12, 2023
Merged

Conversation

ChristofferEdlund
Copy link
Contributor

@ChristofferEdlund ChristofferEdlund commented Nov 14, 2023

Problem

Recent changes to darwin introduced local datasets loading of only darwin_v2 format.

When converting video datasets to images by using the split function split_video_annotations

def split_video_annotations(self, release_name: str = "latest") -> None:

there are usage of a darwin export will not generate v2 annotations, instead it generates this json (assumably v1)

def build_image_annotation(annotation_file: dt.AnnotationFile) -> Dict[str, Any]:

    return {
        "annotations": annotations,
        "image": {
            "filename": annotation_file.filename,
            "height": annotation_file.image_height,
            "width": annotation_file.image_width,
            "url": annotation_file.image_url,
        },
    }

Leading to our dataloaders not being able to load any data that has been converted from video now that v2 format is enforced.

Solution

Updating the darwin v2 export function build_image_annotation to generate valid v2 image annotations.
It's only used in that one place above currently so changing it should fix our problem and not introduce any unwanted issues.

Changelog

  • Updated split_video_annotations convertion so it generates valid per-image darwin v2 annotations.
  • Added option to select if one wants to load empty annotations in LocalDataset with keep_empty_annotations arg (default is False)

Copy link

linear bot commented Nov 14, 2023

darwin/exporter/formats/darwin.py Show resolved Hide resolved
tests/darwin/dataset/remote_dataset_test.py Outdated Show resolved Hide resolved
darwin/utils/utils.py Outdated Show resolved Hide resolved
@ChristofferEdlund ChristofferEdlund changed the title [Ai 1410]-darwin-v2-export-fix [Ai-1410]-darwin-v2-export-fix Nov 16, 2023
…le to use all or only non empty annotations to local dataset class
Copy link
Contributor

@Nathanjp91 Nathanjp91 left a comment

Choose a reason for hiding this comment

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

Some stuff to look at.

darwin/dataset/remote_dataset_v2.py Show resolved Hide resolved
darwin/datatypes.py Outdated Show resolved Hide resolved
darwin/exporter/formats/coco.py Outdated Show resolved Hide resolved
darwin/exporter/formats/darwin.py Outdated Show resolved Hide resolved
darwin/torch/dataset.py Show resolved Hide resolved
darwin/importer/importer.py Outdated Show resolved Hide resolved
darwin/datatypes.py Outdated Show resolved Hide resolved
@Nathanjp91 Nathanjp91 changed the title [Ai-1410]-darwin-v2-export-fix [Ai-1477]-darwin-v2-export-fix Dec 5, 2023
Copy link

linear bot commented Dec 5, 2023

@Nathanjp91 Nathanjp91 merged commit 4c54f5d into master Dec 12, 2023
16 checks passed
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.

7 participants