nnUNet icon indicating copy to clipboard operation
nnUNet copied to clipboard

number of patch sizes

Open wxr521314 opened this issue 2 years ago • 4 comments

Hi, My data is in 3D. I want to know how many patches my data is divided into. My patch_size is 24x320x320. Can I understand that 24 represents the number of data layers? However, some of my data is less than 24 layers, how to do this?

Best wish!

wxr521314 avatar Jan 11 '22 02:01 wxr521314

24 represents the patch size in the first dimension. If your first dimension consists of layers then yes that's the layers. If the number of slices/layers is less than 24 nnU-Net will just pad the images. No problem with that.

nnU-Net does not explicitly create patches from your data. It just loads random locations during training.

Best, Fabian

FabianIsensee avatar Jan 12 '22 18:01 FabianIsensee

So my data has only one patch to input into the prediction network?

wxr521314 avatar Jan 13 '22 03:01 wxr521314

During preprocessing each image is processed as one, it is not divided into patches. During training, an infinite number of random (!) patches is cropped from the preprocessed image. Patches are never created and stored explicitly. This would be a waste of disk space due to redundant saving of some partsof the images

FabianIsensee avatar Jan 13 '22 06:01 FabianIsensee

From what I read in the article, nnUNet starts with a median patch size at the target spacing then slowly reduces the patch size to meet the GPU requirements as well as a minimum batch size of 2. I wonder how it is possible the final patch size has (several) dimension(s) larger than those of the initial median shape? For example, Figure SN3.1 in the supplementary material shows that for 3D full res model, the median patch size @ target spacing is 18x237x208 and the final chosen patch is 20x256x224. Can you help me explain this choice @FabianIsensee? Best, Tuan

TuanDTr avatar Apr 22 '22 12:04 TuanDTr

Hey @beantr96, this is because the patch size must be a multiple of 2**num_pool. So if we want to pool 4 times along that axis, we cannot have 18 because that would result in a non-integer filter map size in the bottleneck. So we increase the patch size to the closest value that fulfills this requirement. Best, Fabian

FabianIsensee avatar Aug 23 '22 08:08 FabianIsensee