Hi,
I’m having an issue with @MONAI Resized transformation where is does not rescale some samples to the given shape.
All volumes and corresponding masks are stored in a list of dictionaries (just like in the provided examples) and their original shapes are either (284,284,32), (320,320,32) or (640,640,32).
I’m using the Resized transform to make them (128,128,32), however, despite the majority being resized to that shape, some of them get resized to wrong values such as (128,127,32). This happens to random samples each time the transformations are applied.
My current hypothesis is that since the list of dicts contains multiple dicts with the same key in value for different ‘image’ keys it might be affecting the compose, but I’m not sure if that is the reason, as nothing points to that in the docs.
Below I will add both a snippet from the list of dicts and the transformations:
[EDIT]
I can confirm this issue is happening due to repetition of the image key,value pairs in the list of dicts.
Using only 1 mask per volume removes this repetition and works as intended.
Is this behaviour intended?
[Input]
    for i in range(5):
    print(train_files[i])
[Output]
    {'image': './data/0062_T2WAx.nii.gz', 'label': './data/0062_t2wax_mask.nii.gz'}
    {'image': './data/0062_T2WAx.nii.gz', 'label': './data/0062_t2wax_mask2.nii.gz'}
    {'image': './data/0154_T2WAx.nii.gz', 'label': './data/0154_t2wax_mask.nii.gz'}
    {'image': './data/0154_T2WAx.nii.gz', 'label': './data/0154_t2wax_mask2.nii.gz'}
    {'image': './data/0033_T2WAx.nii.gz', 'label': './data/0033_t2wax_mask.nii.gz'}


[Input]

train_transforms = Compose(
    [
        LoadImaged(keys=["image", "label"]),
        AddChanneld(keys=["image", "label"]),
        Resized(keys=["image", "label"], spatial_size=(128, 128, 32), mode=('trilinear', 'nearest')),
        CropForegroundd(keys=["image", "label"], source_key="image"),
        ToTensord(keys=["image", "label"]),
    ]
)

train_ds = Dataset(data=train_files, transform=train_transforms)
train_loader = DataLoader(train_ds, batch_size=1, shuffle=True, num_workers=4)

for check_data in train_loader:
    image, label = (check_data["image"][0][0], check_data["label"][0][0])
    print(f"image shape: {image.shape}, label shape: {label.shape}")

[Output]
# ' added on output for visibility
(...)
image shape: torch.Size([128, 128, 32]), label shape: torch.Size([128, 128, 32])
image shape: torch.Size([128, 128, 32]), label shape: torch.Size([128, 128, 32])
image shape: torch.Size([128, '127', 32]), label shape: torch.Size([128, '127', 32])
image shape: torch.Size([128, 128, 32]), label shape: torch.Size([128, 128, 32])
(...)