amanbasu / 3d-prostate-segmentation

Segmentation of prostate from MRI scans
GNU General Public License v3.0
44 stars 13 forks source link

How to reproduce results #5

Closed bhralzz closed 4 years ago

bhralzz commented 4 years ago

Please guide how to reproduce results step by step, such as : where to place dataset, the order of file running and so on. tnx for your help

amanbasu commented 4 years ago
  1. Download the date from this link.
  2. Follow the resizing.py file to bring the data in appropriate shape.
  3. Divide the formatted data into train, val, and test folders.
  4. Run train.py giving actual path to data on line 17, 28, 34.
amanbasu commented 4 years ago

Hi @harrislin2018,

As mentioned in the resizing.py file, did you make the below changes before executing it?

new_size = [144,144,50]             
interp = sitk.sitkNearestNeighbour  # for labels
# interp = sitk.sitkLinear            # for input features

for file in sorted(glob.glob('train/Case*_segmentation.mhd')):
    # uncomment when resizing input images
#     file = file.replace('_segmentation', '')
    img = sitk.ReadImage(file)
    reshaped = resample(img, new_size, interp)
    sitk.WriteImage(reshaped, file)
    print(file, end='\r')

Also, I can see that the error is on line 268 of train.py tf.summary.image('labels', labels[:, :, :, 32:33, 0], max_outputs=2,collections=['val'])

Please ensure that the shape of input image and labels are appropriate before proceeding.

Stacktrace:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to reshape is a tensor with 2073600 values, but the requested shape requires a multiple of 1048576
[[node Reshape_1 (defined at /Desktop/DataScience/VNet/3d-prostate-segmentation-master/train.py:268) ]]