bowang-lab / MedSAM

Segment Anything in Medical Images
https://www.nature.com/articles/s41467-024-44824-z
Apache License 2.0
2.99k stars 415 forks source link

AssertionError: image and ground truth should have the same size #106

Closed cooleel closed 1 year ago

cooleel commented 1 year ago

Got this error when I am running the demo dataset (50 abdomen CT scans) mentioned in the readme.

Looks like we need to change the default image_size when we run the command

the example command for running pre-processing should be

python pre_CT.py -i path_to_image_folder -gt path_to_gt_folder -o path_to_output --image_size 512
shengkai927 commented 1 year ago

Yes, the same error. My solution is to resize img_slice_i to 256*256 use follow code

# resize img_slice_i to 256*256
   img_slice_i = transform.resize(image_data_pre[1,:,:,], (image_size, image_size), order=3, preserve_range=True, mode='constant', anti_aliasing=False)

I've mentioned this code shown in the video but not included in pre_CT.py

JunMa11 commented 1 year ago

my bad. I did a wrong commit. It has been fixed now.