model_params:
  model: &model CNNFinetuneModels
  model_name: &model_name densenet169
  num_classes: 6


args:
  expdir: "src"
  logdir: &logdir "./logs/rsna"
  baselogdir: "./logs/rsna"

distributed_params:
  opt_level: O1

stages:

  state_params:
    main_metric: &reduce_metric loss
    minimize_metric: True

  criterion_params:
    criterion: &criterion LogLoss
    weight: [1,1,1,1,1,2]

  data_params:
    batch_size: 32
    num_workers: 4
    drop_last: False

    image_size: &image_size [512, 512]
    train_csv: "./csv/stratified_kfold/train_0.csv.gz"
    valid_csv: "./csv/stratified_kfold/valid_0.csv.gz"
#    dataset_type: "RSNAMultiWindowsDataset"
    with_any: True
    root: "../stage_1_train_images_jpg_preprocessing/"
    image_type: "jpg"

  warmup:
    optimizer_params:
      optimizer: AdamW
      lr: 0.001

    scheduler_params:
      scheduler: MultiStepLR
      milestones: [10]
      gamma: 0.3

    state_params:
      num_epochs: 3

    callbacks_params: &callbacks_params
      loss:
        callback: CriterionCallback

      optimizer:
        callback: OptimizerCallback
        accumulation_steps: 1
      scheduler:
        callback: SchedulerCallback
        reduce_metric: *reduce_metric
      saver:
        callback: CheckpointCallback
        save_n_best: 5

  stage1:

    optimizer_params:
      optimizer: AdamW
      lr: 0.0001

    scheduler_params:
      scheduler: ReduceLROnPlateau
      patience: 1
      min_lr: 0.00001
      verbose: True
#      scheduler: OneCycleLR
#      num_steps: &num_epochs 25
#      lr_range: [0.0005, 0.00001]
#      warmup_steps: 5
#      momentum_range: [0.85, 0.95]

    state_params:
      num_epochs: 20

    callbacks_params:
      loss:
        callback: CriterionCallback

      optimizer:
        callback: OptimizerCallback
        accumulation_steps: 1
      scheduler:
        callback: SchedulerCallback
        reduce_metric: *reduce_metric
      saver:
        callback: CheckpointCallback
        save_n_best: 5

      early_stoping:
        callback: EarlyStoppingCallback
        patience: 2

monitoring_params:
  project: "Kaggle-RSNA"
  tags: [*model, *model_name, *criterion]