Skip to content

Commit 89574a6

Browse files
committed
monai v1.2 api
Signed-off-by: Wenqi Li <wenqil@nvidia.com>
1 parent 934c447 commit 89574a6

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

monailabel/monaivista/lib/model/vista_point_2pt5/trainer_2pt5d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ def val_epoch(model, loader, epoch, acc_func, args, iterative=False, post_label=
768768
not_nans_total += not_nans
769769

770770
acc, not_nans = acc_sum_total / not_nans_total, not_nans_total
771-
f_name = batch_data["image_meta_dict"]["filename_or_obj"]
771+
f_name = batch_data["image"].meta["filename_or_obj"]
772772
print(f"Rank: {args.rank}, Case: {f_name}, Acc: {acc:.4f}, N_prompts: {int(not_nans)} ")
773773

774774
acc = torch.tensor(acc).cuda(args.rank)

training/trainer_2pt5d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def val_epoch(model, loader, epoch, acc_func, args, iterative=False, post_label=
466466
not_nans_total += not_nans
467467

468468
acc, not_nans = acc_sum_total / not_nans_total, not_nans_total
469-
f_name = batch_data["image_meta_dict"]["filename_or_obj"]
469+
f_name = batch_data["image"].meta["filename_or_obj"]
470470
print(f"Rank: {args.rank}, Case: {f_name}, Acc: {acc:.4f}, N_prompts: {int(not_nans)} ")
471471

472472
acc = torch.tensor(acc).cuda(args.rank)

training/utils/data_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_loader(args):
101101

102102
train_transform = transforms.Compose(
103103
[
104-
LoadImaged(keys=["image", "label"]),
104+
LoadImaged(keys=["image", "label"], image_only=True),
105105
EnsureChannelFirstd(keys=["image", "label"]),
106106
Orientationd(keys=["image", "label"], axcodes="RAS"),
107107
Spacingd(keys=["image", "label"], pixdim=(1.5, 1.5, 1.5), mode=("bilinear", "nearest")),
@@ -114,7 +114,7 @@ def get_loader(args):
114114

115115
val_transform = transforms.Compose(
116116
[
117-
LoadImaged(keys=["image", "label"]),
117+
LoadImaged(keys=["image", "label"], image_only=True),
118118
EnsureChannelFirstd(keys=["image", "label"]),
119119
Orientationd(keys=["image", "label"], axcodes="RAS"),
120120
Spacingd(keys=["image", "label"], pixdim=(1.5, 1.5, 1.5), mode=("bilinear", "nearest")),

0 commit comments

Comments
 (0)