-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/new data #6
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # @package _global_ | ||
|
|
||
| dataset: | ||
| name: mou_2_224 | ||
| mpp: 0.97 | ||
| tile_extent: 224 | ||
| level: 2 | ||
| uris: | ||
| train: "mlflow-artifacts:/3/3f3ab8b587234175951e1a018015cef8/artifacts/mou_2_224_train" | ||
| val: "mlflow-artifacts:/3/3f3ab8b587234175951e1a018015cef8/artifacts/mou_2_224_val" | ||
| test: "mlflow-artifacts:/3/3f3ab8b587234175951e1a018015cef8/artifacts/mou_2_224_test" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # @package _global_ | ||
|
|
||
| dataset: | ||
| name: mou_3_224 | ||
| mpp: 1.94 | ||
| tile_extent: 224 | ||
| level: 3 | ||
| uris: | ||
| train: "mlflow-artifacts:/3/e0f0170be75241d095446a33202edb95/artifacts/mou_3_224_train" | ||
| val: "mlflow-artifacts:/3/e0f0170be75241d095446a33202edb95/artifacts/mou_3_224_val" | ||
| test: "mlflow-artifacts:/3/e0f0170be75241d095446a33202edb95/artifacts/mou_3_224_test" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # @package _global_ | ||
|
|
||
| defaults: | ||
| - /data/tiled/mou_2_224 | ||
| - /preprocessing/tile_encoder/virchow2 | ||
| - _self_ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # @package _global_ | ||
|
|
||
| defaults: | ||
| - /data/tiled/mou_3_224 | ||
| - /preprocessing/tile_encoder/virchow2 | ||
| - _self_ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,6 +69,14 @@ def save_embeddings( | |
| df.to_parquet(embeddings_path, index=False, engine="pyarrow") | ||
|
|
||
|
|
||
| def resolve_dataset_uris(config: DictConfig) -> list[str]: | ||
| """Resolve tiled dataset URIs from Hydra config.""" | ||
| if config.dataset.get("uris") is not None: | ||
| return [str(uri) for uri in config.dataset.uris.values()] | ||
|
|
||
| raise ValueError("Embeddings preprocessing requires `dataset.uris`.") | ||
|
Comment on lines
+72
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current implementation of
Consider a more robust implementation that handles both mapping and list types for def resolve_dataset_uris(config: DictConfig) -> list[str]:
"""Resolve tiled dataset URIs from Hydra config."""
dataset = config.get("dataset", {})
if (uris := dataset.get("uris")) is not None:
return [str(v) for v in (uris.values() if hasattr(uris, "values") else uris)]
if (path := dataset.get("path")) is not None:
return [str(path)]
raise ValueError("Embeddings preprocessing requires `dataset.uris` or `dataset.path`.") |
||
|
|
||
|
|
||
| @with_cli_args(["+preprocessing=embeddings"]) | ||
| @hydra.main( | ||
| config_path="../configs", | ||
|
|
@@ -83,7 +91,7 @@ def main(config: DictConfig, logger: MLFlowLogger) -> None: | |
| tile_encoder = tile_encoder.to(device) | ||
|
|
||
| dataset = SlideDataset( | ||
| uris=[config.dataset.path], | ||
| uris=resolve_dataset_uris(config), | ||
| transforms=A.Compose( | ||
| [A.Normalize(mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225))] | ||
| ), | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filename
mou_3_2024.yamlappears to contain a typo. Based on the dataset namemou_3_224and the companion filemou_2_224.yaml, it should likely be namedmou_3_224.yaml.