ellisdg / 3DUnetCNN

Pytorch 3D U-Net Convolution Neural Network (CNN) designed for medical image segmentation
MIT License
1.9k stars 653 forks source link

Running predict.py #243

Closed selamgit closed 3 years ago

selamgit commented 4 years ago

After successfully trained the model using my own dataset (i used train_isensee2017.py, model isensee_2017_model.h5 already created, number of label during training was 1).

I run predict.py

Traceback (most recent call last): File "predict.py", line 26, in main() File "predict.py", line 22, in main output_dir=prediction_dir) File "/tf/3DUnetCNN/unet3d/prediction.py", line 163, in run_validation_cases threshold=threshold, overlap=overlap, permute=permute) File "/tf/3DUnetCNN/unet3d/prediction.py", line 124, in run_validation_case image = nib.Nifti1Image(test_data[0, i], affine) IndexError: index 1 is out of bounds for axis 1 with size 1 Closing remaining open files:/tf/3DUnetCNN/brats/brats_data.h5...done

How to fix it ?

selamgit commented 4 years ago

Since I was using train_isensee2017, config should be changed in predict as well, its fixed like below:

in predict.py

change: from train import config

to: from train_isensee2017 import config

TliliFadhila commented 4 years ago

the training is taking 2 days from me and still running with the last instruction: Please use Model.fit, which supports generators. is there a problem, if not how much time it took from you?

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you have questions, feel free to join the Slack group or email me at davidgellis2@gmail.com.