HiLab-git / SSL4MIS

Semi Supervised Learning for Medical Image Segmentation, a collection of literature reviews and code implementations.
MIT License
2.19k stars 387 forks source link

RuntimeError: stack expects each tensor to be equal size, but got [1, 191, 512, 512] at entry 0 and [1, 181, 512, 512] at entry 1 #43

Closed abcxubu closed 2 years ago

abcxubu commented 2 years ago

Hi, Xiangde Recently, I want to use 'train_uncertainty_rectified_pyramid_consistency_3D.py' for the segmentation on my own data (heart CT). I have converted my own data to '.h5', as you did. I found maybe it's not suitable for me to do the RandomCrop, therefore, I abandon the RandomCrop. Then the code showed the mistake 'RuntimeError: stack expects each tensor to be equal size, but got [1, 191, 512, 512] at entry 0 and [1, 181, 512, 512] at entry 1'. I searched the Internet for answers, and I found others Resize the data in the preprocessing. However, for the heart CT, the dimension of data for person A is 191512512, and for person B maybe is 181512512, and for C is 200512512. I do not know how to resize or solve the problem. Could you give me some advice? Thanks so much. 1

BJQ123456 commented 1 year ago

Hello, how did you solve this problem? thank you

abcxubu commented 1 year ago

I solved the problem. I did the RandomCrop to make all the cases have the same size, e.g., [96, 96, 96]. I hope it helps you.

BJQ123456 commented 1 year ago

Thank you, I found the problem and solved it. I appreciate your response.