Input size error when using unet3dLayers with valid convolutional padding

6 visualizaciones (últimos 30 días)
I am working on training a 3D Unet for a multi-class segmentation problem. For the most part, I have followed the 3D Brain Tumor Segmentation example found on MathWorks for patch-based training. I was experimenting with using different patch sizes and there seems to be discrepancy between what the 'unet3dLayers' documentation says and what Matlab actually allows in terms of patch sizes. According to the documentation, when using valid convolutional padding the formula for allowed patch height size (which is the same for width and depth) is as follows:
are multiples of , where D is encoder depth and is the filter size.
Using default values for EncoderDepth and FilterSize (both values defaults are 3), unless I'm making a math error I get that height can be 36, 44, 52, 60, 68, 76, 84, 92, etc. However, when I run 'unet3dLayers' with a inputPatchSize of [36 36 36 1], Matlab gives me the following error: "The input size is constrained by valid convolution and depth of the encoder/decoder networks. You can specify input size as [92 92 92 1] instead of [36 36 36 1]." What am I getting wrong here?

Respuesta aceptada

praguna manvi
praguna manvi el 1 de Oct. de 2024
Editada: praguna manvi el 1 de Oct. de 2024
As I understand it, you are trying to compute “unet3Dlayers on a patch of size [36, 36, 36, 1], which results in the error "input size is constrained by valid convolution and depth of the encoder/decoder networks". Although mathematically patch sizes 36, 44, 52, ..., 92 would work for unet3Dlayers, considering the encoder’s down-sampling factor and its divisibility, there is an additional check along for the input patch size .
The documentation excludes mentioning the final down-sampling factor of the last encoder section, which we could verify while debugging the function as:
2^(EncoderDepth + 1 - 2) * (FilterSize - 1)
Using the about factor size, there is this additional check for:
input_patch_size > 2^(EncoderDepth + 1 - 2) * (FilterSize 1) + encoder_down_sampling_factor
Due to this reason, the function expects [92, 92, 92, 1] sized patch for the provided parameter values, which is greater than combined down-sampling factors.
Since R2024a, unet3D has been introduced, which can be used instead of unet3Dlayers.
Refer to the documentation link below:
Hope this helps!

Más respuestas (0)

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by