Amshaker / unetr_plus_plus

[IEEE TMI-2024] UNETR++: Delving into Efficient and Accurate 3D Medical Image Segmentation
Apache License 2.0
340 stars 32 forks source link

How to calculate the input_size according to the data shape? #50

Open Overflowu7 opened 1 year ago

Overflowu7 commented 1 year ago

I see the input_size is different in the different datasets. For example, the input_size in adac is : class UnetrPPEncoder(nn.Module): def init(self, input_size=[16 40 40, 8 20 20, 4 10 10, 2 5 5],dims=[32, 64, 128, 256], proj_size =[64,64,64,32], depths=[3, 3, 3, 3], num_heads=4, spatial_dims=3, in_channels=1, dropout=0.0, transformer_dropout_rate=0.1 ,kwargs): super().init() and I check the shape of the acdc is [216,256,10].So i'm confused because the shape of data always miss match the embedding size like this: File "/home/unetrpp/transformerblock.py", line 60, in forward x = x + self.pos_embed RuntimeError: The size of tensor a (27648) must match the size of tensor b (25600) at non-singleton dimension 1 Can you tell me how to solve this problem??

Amshaker commented 1 year ago

Hi @Overflowu7 ,

Yes, the shape of data for ACDC is 16 40 40 for the first stage.

How do you get the shape of the acdc is [216,256,10]?