understanding batches on tutorial example #4509
-
Hello I have simple question that I can not understand in: Till this moment I mostly use single image in a batch and all was well, now I want to use multiple images in batches. And now I do not understand first in tutorial we have batch size 2 - but in line
We access it as a dictionary not as list of dictionaries - also we put it into 3d model in , so neither it is list nor 4d images
As far as I understand the idea of the batch it should have 4 dimensions (first with size equal to number of batches next 3 as defined in RandCropByPosNegLabeld) so Unet with
should not work. Yet all works, thanks to your work :), so where is my mistake in understanding? Thanks for time reading it! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The default collate function will combine elements of the same key. In this way, you'll have a single dictionary, and each value in that dictionary will be a batch. So |
Beta Was this translation helpful? Give feedback.
The default collate function will combine elements of the same key. In this way, you'll have a single dictionary, and each value in that dictionary will be a batch. So
batch["image"]
will be atorch.Tensor
, but will now have the shapeB,C,H,W,[D]
. The addedB
is the size of the batch, so in your example will be2
.