uni-medical / SAM-Med3D

SAM-Med3D: An Efficient General-purpose Promptable Segmentation Model for 3D Volumetric Medical Image
Apache License 2.0
427 stars 56 forks source link

window_unpartition3D output shape goes wrong in case window_size is tuple #42

Closed prakashjayy closed 3 months ago

prakashjayy commented 4 months ago

I have edited the code on my local such that window_size is tuple instead of int. since the input size of shape (Dp, Hp, Wp). the output shape also should be of the same. The following line should be re-written as

https://github.com/uni-medical/SAM-Med3D/blob/a5227965b78b5cf74010df32877b96d21f5b4b45/segment_anything/modeling/image_encoder3D.py#L323

x = x.permute(0, 1, 4, 2, 5, 3, 6, 7).contiguous().view(B, Hp, Wp, Dp, -1)

to

x = x.permute(0, 1, 4, 2, 5, 3, 6, 7).contiguous().view(B, Dp, Hp, Wp, -1)
blueyo0 commented 3 months ago

Thx for the bug report. Will fix it in the next patch.