snapfinger / pancreas-seg

Pancreas Segmentation in Abdominal CT Scans with Convolutional Neural Network
57 stars 18 forks source link

Model can predict image, Model return black image #4

Closed namphn closed 3 years ago

namphn commented 3 years ago

Hi Yijun, thanks for your sharing. I have prepared the data as instructed in the readme file image image

And when I run the program, I get some errors and make corrections like below: change: https://github.com/snapfinger/pancreas-seg/blob/6d640676e5b398452e2de6f992bd4dfea78ed2c8/slice.py#L65

image = np.load(image_list[i])
label = np.load(label_list[i]))

to

image = np.load(image_list[i])
label = np.array(nibabel.load(label_list[i]).dataobj)

same here: https://github.com/snapfinger/pancreas-seg/blob/6d640676e5b398452e2de6f992bd4dfea78ed2c8/testvis.py#L75

I modify variable in pipeline as below: ZMAX=160 YMAX=256 XMAX=256

model gave incorrect prediction: image

can you help me? plz!

snapfinger commented 3 years ago

Hi @namph-uet, are you using the same environment settings as the readme ones? (you can check your package versions by pip list) It's a project quite a few years ago, so these settings (e.g python 2.7) are kind of outdated, but can ensure you get the same results.

According to what you described, I guess you used a different version of at least one of the packages. The numerical operation behavior can be different in newer versions. For example, for integer divisions 20 / 15, python 2 will give 1, while python 3 will give 1.333333 This will affect your your output image.

I don't think the part you posted has an effect on the output, but you need to check the intermediate data type in your computation. Or you simply setup the environment using the same old versions.