fastMRI sample in SSIM loss #4703
-
Hi, thank you for adding the SSIM loss.
In my knownledge, you mean reshape the 3D volume from Can someone explain this to me? @mersad95zd |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @Khoa-NT, thanks for your question.
If you're working on the fastMRI dataset, then no need to reshape because fastMRI's default shape is
Good point, since there are datasets where Does this address your issue? |
Beta Was this translation helpful? Give feedback.
-
I have a 2D image of batch size =128 and channel 3. What is the correct way to use the SSIMLOss from monai.losses.ssim_loss import SSIMLoss
criterion = SSIMLoss(spatial_dims=2)
loss = criterion(images, pred, data_range=images.max().unsqueeze(0))
# images.shape == pred.shape == torch.Size([128, 3, 64, 64]) In the above code, I get a
|
Beta Was this translation helpful? Give feedback.
Hi @Khoa-NT, thanks for your question.
If you're working on the fastMRI dataset, then no need to reshape because fastMRI's default shape is
(B,num_slices,W,H)
.Good point, since there are datasets where
C
varies across samples, the current implementation works withC=1
and the loss function should be called for each channel, separately. We'll correct this in the docstring.Does this address your issue?