-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a small version of the Camelyon16 dataset (#667)
* added camelyon16 small * added camelyon16 small
- Loading branch information
Showing
1 changed file
with
134 additions
and
0 deletions.
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
configs/vision/pathology/offline/classification/camelyon16_small.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
--- | ||
trainer: | ||
class_path: eva.Trainer | ||
init_args: | ||
n_runs: &N_RUNS ${oc.env:N_RUNS, 5} | ||
default_root_dir: &OUTPUT_ROOT ${oc.env:OUTPUT_ROOT, logs/${oc.env:MODEL_NAME, dino_vits16}/offline/camelyon16} | ||
max_epochs: &MAX_EPOCHS ${oc.env:MAX_EPOCHS, 100} | ||
callbacks: | ||
- class_path: eva.callbacks.ConfigurationLogger | ||
- class_path: lightning.pytorch.callbacks.TQDMProgressBar | ||
init_args: | ||
refresh_rate: ${oc.env:TQDM_REFRESH_RATE, 1} | ||
- class_path: lightning.pytorch.callbacks.LearningRateMonitor | ||
init_args: | ||
logging_interval: epoch | ||
- class_path: lightning.pytorch.callbacks.ModelCheckpoint | ||
init_args: | ||
filename: best | ||
save_last: true | ||
save_top_k: 1 | ||
monitor: &MONITOR_METRIC ${oc.env:MONITOR_METRIC, val/BinaryAccuracy} | ||
mode: &MONITOR_METRIC_MODE ${oc.env:MONITOR_METRIC_MODE, max} | ||
- class_path: lightning.pytorch.callbacks.EarlyStopping | ||
init_args: | ||
min_delta: 0 | ||
patience: ${oc.env:PATIENCE, 10} | ||
monitor: *MONITOR_METRIC | ||
mode: *MONITOR_METRIC_MODE | ||
- class_path: eva.callbacks.ClassificationEmbeddingsWriter | ||
init_args: | ||
output_dir: &DATASET_EMBEDDINGS_ROOT ${oc.env:EMBEDDINGS_ROOT, ./data/embeddings/${oc.env:MODEL_NAME, dino_vits16}/camelyon16} | ||
save_every_n: 10_000 | ||
dataloader_idx_map: | ||
0: train | ||
1: val | ||
2: test | ||
metadata_keys: ["wsi_id"] | ||
backbone: | ||
class_path: eva.vision.models.ModelFromRegistry | ||
init_args: | ||
model_name: ${oc.env:MODEL_NAME, universal/} | ||
model_extra_kwargs: ${oc.env:MODEL_EXTRA_KWARGS, null} | ||
overwrite: false | ||
logger: | ||
- class_path: lightning.pytorch.loggers.TensorBoardLogger | ||
init_args: | ||
save_dir: *OUTPUT_ROOT | ||
name: "" | ||
model: | ||
class_path: eva.HeadModule | ||
init_args: | ||
head: | ||
class_path: eva.vision.models.networks.ABMIL | ||
init_args: | ||
input_size: ${oc.env:IN_FEATURES, 384} | ||
output_size: &NUM_CLASSES 1 | ||
projected_input_size: 128 | ||
criterion: torch.nn.BCEWithLogitsLoss | ||
optimizer: | ||
class_path: torch.optim.AdamW | ||
init_args: | ||
lr: ${oc.env:LR_VALUE, 0.001} | ||
betas: [0.9, 0.999] | ||
lr_scheduler: | ||
class_path: torch.optim.lr_scheduler.CosineAnnealingLR | ||
init_args: | ||
T_max: *MAX_EPOCHS | ||
eta_min: 0.0 | ||
metrics: | ||
common: | ||
- class_path: eva.metrics.AverageLoss | ||
- class_path: eva.metrics.BinaryClassificationMetrics | ||
data: | ||
class_path: eva.DataModule | ||
init_args: | ||
datasets: | ||
train: | ||
class_path: eva.datasets.MultiEmbeddingsClassificationDataset | ||
init_args: &DATASET_ARGS | ||
root: *DATASET_EMBEDDINGS_ROOT | ||
manifest_file: manifest.csv | ||
split: train | ||
embeddings_transforms: | ||
class_path: eva.core.data.transforms.Pad2DTensor | ||
init_args: | ||
pad_size: &N_PATCHES 500 | ||
target_transforms: | ||
class_path: eva.core.data.transforms.dtype.ArrayToFloatTensor | ||
val: | ||
class_path: eva.datasets.MultiEmbeddingsClassificationDataset | ||
init_args: | ||
<<: *DATASET_ARGS | ||
split: val | ||
test: | ||
class_path: eva.datasets.MultiEmbeddingsClassificationDataset | ||
init_args: | ||
<<: *DATASET_ARGS | ||
split: test | ||
predict: | ||
- class_path: eva.vision.datasets.Camelyon16 | ||
init_args: &PREDICT_DATASET_ARGS | ||
root: ${oc.env:DATA_ROOT, ./data/camelyon16} | ||
sampler: | ||
class_path: eva.vision.data.wsi.patching.samplers.ForegroundGridSampler | ||
init_args: | ||
max_samples: *N_PATCHES | ||
width: 224 | ||
height: 224 | ||
target_mpp: 0.25 | ||
split: train | ||
image_transforms: | ||
class_path: eva.vision.data.transforms.common.ResizeAndCrop | ||
init_args: | ||
size: ${oc.env:RESIZE_DIM, 224} | ||
mean: ${oc.env:NORMALIZE_MEAN, [0.485, 0.456, 0.406]} | ||
std: ${oc.env:NORMALIZE_STD, [0.229, 0.224, 0.225]} | ||
- class_path: eva.vision.datasets.Camelyon16 | ||
init_args: | ||
<<: *PREDICT_DATASET_ARGS | ||
split: val | ||
- class_path: eva.vision.datasets.Camelyon16 | ||
init_args: | ||
<<: *PREDICT_DATASET_ARGS | ||
split: test | ||
dataloaders: | ||
train: | ||
batch_size: &BATCH_SIZE ${oc.env:BATCH_SIZE, 32} | ||
shuffle: true | ||
val: | ||
batch_size: *BATCH_SIZE | ||
test: | ||
batch_size: *BATCH_SIZE | ||
predict: | ||
batch_size: &PREDICT_BATCH_SIZE ${oc.env:PREDICT_BATCH_SIZE, 64} |