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

Updated EmbeddingsWriter to support multi-embedding file outputs #384

Conversation

nkaenzig
Copy link
Collaborator

@nkaenzig nkaenzig commented Apr 24, 2024

Closes #376

  • Implemented support for adding multiple embeddings to the same .pt if they share the same filename (e.g. slide_id)
  • Made EmbeddingsWriter agnostic to WSI's by replacing slide_id field extraction by generic metadata_keys
  • Refactored & updated unit tests

This helps to prevent the explosion of the number of files for slide level tasks, where you can have thousands of patch embeddings per slide. Each slide now results in a single .pt file of shape [n_patches, embedding_dim].

@nkaenzig nkaenzig marked this pull request as ready for review April 24, 2024 10:04
@nkaenzig nkaenzig self-assigned this Apr 25, 2024
Copy link
Collaborator

@roman807 roman807 left a comment

Choose a reason for hiding this comment

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

Great thanks, i think its good to merge

Copy link
Collaborator

@ioangatop ioangatop left a comment

Choose a reason for hiding this comment

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

Looks great!

@nkaenzig nkaenzig merged commit 5ce416c into 360-support-slide-level-inference Apr 26, 2024
@nkaenzig nkaenzig deleted the 376-improve-grouping-in-embeddings-writer branch April 26, 2024 11:51
roman807 added a commit that referenced this pull request Jun 24, 2024
* Add base class for WSIs & `openslide` implementation (#365)

* Add WSI dataset classes (#368)

* Add baseline `panda` workflow (#373)

* add panda config

* adjust batch size

* addressed comments

* addressed comments

* addressed comments

* Add support for grid sampling to `WsiDataset` (#377)

* Replaced cached_property in WsiDataset by LRU cache (#388)

* Updated `EmbeddingsWriter` to support multi-embedding file outputs (#384)

* Simple baseline sampler for foreground patches (#394)

* add foreground kaggle

* added random foreground sampler kaggle

* refactored sampler

* moved get_mask

* typo

* refactor sampler

* refactor sampler

* addressed comments

* addressed comments

* Fixed linting in WSI feature branch (#407)

* added openslide-python to all dependencies

* Fix input batch class name (#414)

* Add lower bound for wsi resolution level during mask generation (#412)

* Move sampler logic to `samplers` module and add unit tests (#420)

* Add `WsiClassificationDataset` (#429)

* Retrieve MPP from WSIs  (#432)

* add mpp conversion

* formatting

* addressed comments

* addressed comments

* addressed comments

* formatting

* formatting

* formatting

* updated panda config (#437)

* update WSI foreground segmentation algorithm (#456)

* Add `PANDA` dataset class (#430)

* fixed panda (#463)

* Update `EmbeddingsWriter` to store tensors as lists (#465)

* add tiffslide backend (#468)

* added panda cli unit tests (#470)

* move wsi initialization to setup method of `MultiWsiDataset` (#472)

* 459 add camelyon16 slide level task (#476)

* added panda dataset class

* clean up

* remove samples with noisy labels

* clean up table in dataset readme

* added function for stratified splits

* added unit tests

* cleanup

* addressed comments

* fixed issue with resource download

* validation fix

* updated readme

* added to mkdocs

* added image_dir to exception print

* updated root path in yaml config

* added panda to datasets overview table in docs

* added md5 hash for downloaded resources

* update init

* added camelyon16

* added camelyon16

* updated camelyon16 class

* added tests and config

* formatting

* formatting

* formatting

* formatting

* added test files

* formatting

* lint

* added target transforms

* formatting

* fixed dataset

* addressed comments

* addressed comments

* fix test

* fix test

* fixed test

* addressed comments

* updated loss

* fix annotations

* lint

---------

Co-authored-by: Nicolas Kaenzig <[email protected]>

* 475 define slide level evaluation protocol (#511)

* updated configs

* adjust patience

* addressed comments

* fixed typo

* remove prefetch factor

* update 360-aggregated-feature before PR to main (#527)

* Updated developer guide (#418)

* Update `TotalSegmentator2D` dataset to fetch all the slices (#416)

* Move metrics to CPU when using single device (#446)

* Remove total segmentator classification dataset (#450)

* updated eva logo (#454)

* updated eva logo

* renamed files

* Update actions/checkout digest to a5ac7e5 (#458)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add configuration logger (#466)

* Update `README` with paper citation (#474)

* update docs (#482)

* Update img shields of README (#480)

* Fix `torch` and `jsonargparse` versions (#483)

* update depedencies

* update

* bump micro version (#486)

* update config links (#487)

* Update paper citation format (#489)

* Update the vision dataset return types to `tv_tensors` (#478)

* Refactor embeddings writer (#461)

* fixed phikon configs (#493)

* Refactor embeddings datasets (#495)

* Add doc tests and minor fixes (#492)

* support setting download as env-variable (#514)

* updated confis and doc

* typo

* update datasets

* fixed types

* src/eva/core/callbacks/writers/embeddings/base.py

* formatting

* types

---------

Co-authored-by: Nicolas Känzig <[email protected]>
Co-authored-by: ioangatop <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Updated documentation with new datasets and leaderboard (#531)

* updated layout

* updated layout

* addressed comment

* 532 update leaderboard results with slide level tasks (#538)

* updated docs

* update leaderboard

* update docs and links

* updated configs (#539)

* updated leaderboard (#543)

---------

Co-authored-by: Nicolas Känzig <[email protected]>
Co-authored-by: Nicolas Kaenzig <[email protected]>
Co-authored-by: ioangatop <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

3 participants