SlicerIGT / aigt

Deep learning software modules for image-guided medical procedures
http://www.slicerigt.org
BSD 3-Clause "New" or "Revised" License
61 stars 43 forks source link

Support transforms that are only applied on the training data #45

Closed ungi closed 1 year ago

ungi commented 1 year ago

Some transforms should be used for both training and validation data, like resize and normalization. But some transforms like noise, crop, rotation, should only be applied to the training data.

chriscyyeung commented 1 year ago

What do you think about something like this in the config file?

transforms:
  general:
    # Basic transforms, do not modify
    - name: "Transposed"
      params:
        keys: ["image", "label"]
        indices: [2, 0, 1]
    - name: "ToTensord"
    - name: "EnsureTyped"
      params:
        keys: ["image", "label"]
        dtype: "float32"

    # Add additional transforms here
    - name: "Resized"
      params:
        keys: ["image", "label"]
        spatial_size: [128, 128]
  train:
    - name: "RandGaussianNoised"
      params:
        keys: ["image"]
        prob: 0.15
        mean: 0.0
        std: 0.1

The general transforms would be applied to both training and validation images while the train transforms are only applied to the training data.

ungi commented 1 year ago

Looks good to me. Thanks!