Patch-based training

Hello,

I am trying to train a network on 3D scans which exceed GPU memory limitations. Is there a patch-based approach built into CLARA? ie. my images are 450x450x450 but I just want to train it on patches of the image size 200x200x200 for example and use a patch sampler to select patches for training in a way that would be good for an imbalanced segmentation (ie don’t feed in lots of patches of all background label).

Thanks!

Hi
Thanks for your interest in Clara Train.
Yes you can use our built in transforms to do cropping for you as

      {
        "name": "FastCropByPosNegRatio",
        "args": {
          "size": [128, 128, 32],
          "fields": "image",
          "label_field": "label",
          "pos": 2,
          "neg": 1,
          "batches_to_gen_at_once": 15,
          "batch_size": 2
        }
      },

This transform will crop and sample the foreground N times (2 in example above) for each Y time ( 1 in example above)
You can also use other similar transforms as per the documentation or write your own transform if you like

Hope that helps

1 Like

Thanks!
I also found ScanWindowInfer which should be able to handle inference on images too large for memory

:)

The scanning window inferer is for inference in the validation loop.
Also Please note you are referring to a very old documentation of V2 (from October 2019) we are now on V3.1 please refer to documentation https://docs.nvidia.com/clara/tlt-mi/clara-train-sdk-v3.1/index.html

Yes, I just meant that it was also useful for handling GPU memory limitations (although for inference and not training) :). I noticed the documentation was old but thanks for pointing it out- it’s just the first instance of ScanWindowInfer documentation I came across!

No problem.
Please let us know if you face any other issues.
Also please check out the notebooks that shows you lots of features in the sdk including: training, multi gpu training, AIAA, auto ML, federated learning and more