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

Proposal for lazy-loaded annotations. #1484

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

LinasKo
Copy link
Collaborator

@LinasKo LinasKo commented Aug 27, 2024

This branch contains a proposal for lazy-loading annotations for DetectionsDataset.

It's been tested scarcely - enough to show that memory usage does not grow when loading a large YOLO dataset. The main purpose is to have a code reference for further discussions.

Description

  • A LazyDict data structure calls a loading function when values are retrieved
  • This enables us to conceptualize a lazy_detections objects, which store masks as polygons until loaded.
  • Such polygons are placed in data along with resolution_xy
  • The dataset can take either lazy-loaded or normal Detections
  • So far, only yolo_annotations_to_detections was changed to produce lazy values.
  • The dataset can still function as before - the main different users will see is the datatype for annotations input: Union[Dict[str, Detections], LazyDict[str, Detections, Detections].

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

pytest + loaded yolo dataset with it, comparing memory use and outputs with non-lazy method.

The memory use does not grow, and the results are the same.

I did not test this thoroughly so far.

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:

* A LazyDict data structure calls a loading function when values are retrieved
* This enables us to conceptualize a `lazy_detections` objects, which store masks as polygons until loaded.
* Such polygons are placed in `data` along with `resolution_xy`
* The dataset can take either lazy-loaded or normal Detections
* So far, only `yolo_annotations_to_detections` was changed to produce lazy values.
* The dataset can still function as before - the main different users will see is the datatype for annotations input: `Union[Dict[str, Detections], LazyDict[str, Detections, Detections]`.
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.

1 participant