forked from TIO-IKIM/CellViT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
train_cellvit_sweep.yaml
155 lines (144 loc) · 9.27 KB
/
train_cellvit_sweep.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Example configuration for HoverNet-Cell-Segmentation
# comment and project setup for wandb
logging:
mode: # "online" or "offline" [str]
project: # Name of project to use [str]
notes: # Notes about the run, verbose description [str]
log_comment: # Comment to add to name the local logging folder [str]
tags: # List of tags, e.g., ["baseline", "run1"] [str]
- "tag1"
- "tag2"
- "..."
wandb_dir: # Direcotry to store the wandb file. CAREFUL: Directory must exists [str]
log_dir: # Direcotry to store all logging related files and outputs [str]
level: # Level of logging must be either ["critical", "error", "warning", "info", "debug"] [str]
log_images: # If images should be logged to WandB for this run. [bool] [Optional, defaults to False]
group: # WandB group tag [str] [Optional, defaults to None]
# sweep options -> compare https://docs.wandb.ai/guides/sweeps and https://docs.wandb.ai/guides/sweeps/define-sweep-configuration
# use the same keys as shown below
# Keys are defined here: https://docs.wandb.ai/guides/sweeps/define-sweep-configuration#configuration-keys
sweep:
method: # Sweep Method [str]
name: # Sweep Name [str]
metric: # Sweep Metric [str] (https://docs.wandb.ai/guides/sweeps/define-sweep-configuration#metric)
name: # This metric must be logged, e.g. use AUC/Validation [str]
goal: # Optimization goal. Either "maximize" or "minimize" [str]
early_terminate: # Just applies for bayes method (https://docs.wandb.ai/guides/sweeps/define-sweep-configuration#early_terminate)
type: hyperband # Currently: just hyperband
#... # Other options
run_cap: # Number of trials for the sweep [int]
# Sweep parameters are defined on the according configuration section. Please be carefull to have only on "parameters" key on every level to avoid doubled key conflicts
# Examples are given below
# Documentation on parameters: https://docs.wandb.ai/guides/sweeps/define-sweep-configuration#parameters
# seeding
random_seed: 19 # Seed for numpy, pytorch etc. [int]
# hardware
gpu: # Number of GPU to run experiment on [int]
# setting paths and dataset
data:
dataset: # Name of dataset, currently supported: PanNuke, Conic. Select your dataset and the script will autoamtically select the corresponding experiment [str]
dataset_path: # Path to dataset, compare ./docs/readmes/pannuke.md for further details [str]
train_folds: [...] # List of fold Numbers to use for training [list[int]]
val_split: # Percentage of training set that should be used for validation. Either val_split or val_fold must be provided, not both. [float]
val_folds: # List of fold Numbers to use for validation [list[int]]
test_folds: # List of fold Numbers to use for final testing [list[int]]
num_nuclei_classes: # Number of different nuclei classes (including background!, e.g. 5 nuclei classes + background = 6) [int]
input_shape: # Input shape of data. [int] [Optional, defaults to 256]
# model options
model:
backbone: # Backbone Type: Options are: default, ViT256, SAM-B, SAM-L, SAM-H
pretrained_encoder: # Set path to a pretrained encoder [str]
pretrained: # Path to a pretrained model (.pt file) [str, default None]
embed_dim: # Embedding dimension for ViT - typical values are 384 (ViT-S), 768 (ViT-B), 1024 (ViT-L), 1280 (ViT-H) [int]
input_channels: # Number of input channels, usually 3 for RGB [int, default 3]
depth: # Number of Transformer Blocks to use - typical values are 12 (ViT-S), 12 (ViT-B), 24 (ViT-L), 32 (ViT-H) [int]
num_heads: # Number of attention heads for MHA - typical values are 6 (ViT-S), 12 (ViT-B), 16 (ViT-L), 16 (ViT-H) [int]
shared_decoders: # If decoder networks should be shared except for the heads. [bool] [Optional, defaults to False]
regression_loss: # If regression loss should be used for binary prediction head. [bool] [Optional, defaults to False]
# loss function settings (best shown by an example). See all implemented loss functions in base_ml.base_loss module
loss:
nuclei_binary_map: # Name of the branch. Possible branches are "nuclei_binary_map", "hv_map", "nuclei_type_map", "tissue_types". If not defined default HoverNet settings are used [str]
bce: # Name of the loss [str]
loss_fn: xentropy_loss # Loss_fn, name is defined in LOSS_DICT in base_ml.base_loss module [str]
weight: 1 # Weight parameter [int] [Optional, defaults to 1]
args: # Parameters for the loss function if necessary. Does not need to be set, can also be empty. Just given as an example here
arg1: # 1. Parameter etc. (Name must match to the initialization parameter given for the loss)
dice: # Name of the loss [str]
loss_fn: dice_loss # Loss_fn, name is defined in LOSS_DICT in base_ml.base_loss module [str]
weight: 1 # Weight parameter [int] [Optional, defaults to 1]
focaltverskyloss: # Name of the loss [str]
loss_fn: FocalTverskyLoss # Loss_fn, name is defined in LOSS_DICT in base_ml.base_loss module [str]
weight: 1 # Weight parameter [int] [Optional, defaults to 1]
# optional parameters, not implemented yet
# hv_map: another branch
# nuclei_type_map: another branch
# tissue_types: another branch
# training options
training:
############# Exemplary parameters ########################################################################################################################################
parameters:
attn_drop_rate:
min: 0.0
max: 0.15
drop_rate:
values: [0, 0.15, 0.25]
############################################################################################################################################################################
batch_size: 32
epochs: 100
unfreeze_epoch:
drop_path_rate:
############# Exemplary parameters (on a lower level) ######################################################################################################################
optimizer: AdamW
optimizer_hyperparameter:
parameters:
lr:
min: 0.00001
max: 0.01
betas:
values:
[[0.85, 0.9], [0.9, 0.999], [0.85, 0.95]]
weight_decay:
min: 0.00001
max: 0.001
############################################################################################################################################################################
early_stopping_patience:
scheduler:
scheduler_type:
# hyperparameters
sampling_strategy:
sampling_gamma:
mixed_precision:
eval_every:
# transformations, here all options are given. Remove transformations by removing them from this section
transformations:
randomrotate90: # RandomRotation90
p: # Probability [float, between 0 and 1]
horizontalflip: # HorizontalFlip
p: # Probability [float, between 0 and 1]
verticalflip: # VerticalFlip
p: # Probability [float, between 0 and 1]
downscale: # Downscaling
p: # Probability [float, between 0 and 1]
scale: # Scaling factor, maximum should be 0.5. Must be smaller than 1 [float, between 0 and 1]
blur: # Blur
p: # Probability [float, between 0 and 1]
blur_limit: # Bluring limit, maximum should be 10, recommended 10 [float]
gaussnoise: # GaussianNoise
p: # Probability [float, between 0 and 1]
var_limit: # Variance limit, maxmimum should be 50, recommended 10 [float]
colorjitter: # ColorJitter
p: # Probability [float, between 0 and 1]
scale_setting: # Scaling for contrast and brightness, recommended 0.25 [float]
scale_color: # Scaling for hue and saturation, recommended 0.1 [float]
superpixels: # SuperPixels
p: # Probability [float, between 0 and 1]
zoomblur: # ZoomBlur
p: # Probability [float, between 0 and 1]
randomsizedcrop: # RandomResizeCrop
p: # Probability [float, between 0 and 1]
elastictransform: # ElasticTransform
p: # Probability [float, between 0 and 1]
normalize: # Normalization
mean: # Mean for Normalizing, default to (0.5, 0.5, 0.5) [list[float], between 0 and 1 for each entry]
std: # STD for Normalizing, default to (0.5, 0.5, 0.5) [list[float], between 0 and 1 for each entry]
eval_checkpoint: # Either select "best_checkpoint.pth", "latest_checkpoint.pth" or one of the intermediate checkpoint names, e.g., "checkpoint_100.pth"