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

Adding support for pyramids #129

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Adding support for pyramids #129

wants to merge 5 commits into from

Conversation

edyoshikun
Copy link
Contributor

@edyoshikun edyoshikun commented Aug 8, 2024

This PR adds the support for pyramids to address #125. This modifies the HCSDataloader()

@edyoshikun edyoshikun marked this pull request as ready for review August 15, 2024 04:48
@mattersoflight
Copy link
Member

@edyoshikun thanks - this implementation seems backward compatible with previous configs for training and prediction for virtual staining and contrastive learning tasks. Can you check with the configs we are sharing with the preprint if they need any change (e.g., explicitly setting the scale = 0)?

@ziw-liu ziw-liu added the enhancement New feature or request label Aug 15, 2024
@edyoshikun
Copy link
Contributor Author

@mattersoflight we don't need to change the previous configs because by default the Dataloader will be set to "0" the highest resolution if the parameter is not provided in the config.

For the preprint, I thought we were pointing them to viscy=0.2.0, which may or may not have this PR. If we are adding this PR as part of 0.2.0, I'll make the changes.

@talonchandler
Copy link
Contributor

I've tested the basic HCSDataModule with multiple resolution levels, and it's working well. I can load random patches at any resolution level in my pyramid. Thanks @edyoshikun.

@edyoshikun I'm happy to leave this as a branch while we test this out end to end during the course.

@ziw-liu
Copy link
Collaborator

ziw-liu commented Sep 11, 2024

The code changes look good, but we should test that training actually works before merging.

@ziw-liu ziw-liu added the translation Image translation (VS) label Sep 11, 2024
@ziw-liu ziw-liu linked an issue Sep 11, 2024 that may be closed by this pull request
@ziw-liu ziw-liu added this to the v0.4.0 milestone Mar 28, 2025
@@ -219,7 +223,7 @@ def __getitem__(self, index: int) -> Sample:
sample = {
"index": sample_index,
"source": self._stack_channels(sample_images, "source"),
"norm_meta": norm_meta,
# "norm_meta": norm_meta,
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this for?

@@ -318,6 +324,7 @@ def __init__(
augmentations: list[MapTransform] = [],
caching: bool = False,
ground_truth_masks: Path | None = None,
pyramid_resolution: str = "0",
Copy link
Collaborator

Choose a reason for hiding this comment

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

#218 used array_key for this parameter, which is a more general naming:

array_key: str = "0",

Copy link
Collaborator

@ziw-liu ziw-liu left a comment

Choose a reason for hiding this comment

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

While this might work for training, the prediction writer will get a shape mismatch error and needs to be patched too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request translation Image translation (VS)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support loading data from a specific resolution of a .zarr pyramid
4 participants