-
Dear Community, Addon, maybe the relevant issue is: How do I combine TestTimeAugmentation and sliding window inference in lightning? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 3 replies
-
Hi @jamtheim, thanks for your interest here, the input for
Hope it can help you! Thanks! |
Beta Was this translation helpful? Give feedback.
-
Dear KumoLiu, Set GPU to index 1device=torch.device("cuda:1" if torch.cuda.is_available() else "cpu") Move model to GPU 1model = model.to(torch.device(device)) Set inference functioninfFunction_here = lambda x: torch.softmax(model(x)) tt_aug = TestTimeAugmentation( Get imagesmode_tta, mean_tta, std_tta, vvc_tta = tt_aug(file, num_examples=10) Error below: 0%| | 0/10 [00:00<?, ?it/s] |
Beta Was this translation helpful? Give feedback.
-
I dont really get how the sliding windows inference is called at all, is this the root of the problem? If so, how should i fix it? |
Beta Was this translation helpful? Give feedback.
-
Dear KumoLiu, thanks for your guideance. It was a combination of wring device allocation and missing sliding window function. Below is working code:
|
Beta Was this translation helpful? Give feedback.
-
Hi again, inf_transforms = [ I cant figure out how to apply this as a standard transform before the data enters the test time augmentation module. I dont think I can put in the test time transform as I do not want it to be reversed. As stated in our previous discussion the test time augmentation takes a dictionary pair as input, thereby I cant figure out how to apply a standard transform beforehand. Thankful for your help! |
Beta Was this translation helpful? Give feedback.
Hi again,
So I got it to work as intended. But know I have run into a problem and I could need some help.
As standard before validation and inference I am doing the transform:
inf_transforms = [
LoadImaged(keys=["image", "label"]),
EnsureChannelFirstd(keys=["image"]),
ScaleIntensityRanged(
keys=["image"],
a_min=conf.model.ScaleIntensityRanged_a_min,
a_max=conf.model.ScaleIntensityRanged_a_max,
b_min=conf.model.ScaleIntensityRanged_b_min,
b_max=conf.model.ScaleIntensityRanged_b_max,
clip=conf.model.ScaleIntensityRanged_clip,
)]
I cant figure out how to apply this as a standard transform before the data enters the test time augmentation module. I dont think I can put in the test time transf…