arnab39 / FewShot_GAN-Unet3D

Tensorflow implementation of our paper: Few-shot 3D Multi-modal Medical Image Segmentation using Generative Adversarial Learning
MIT License
377 stars 82 forks source link

running python main.py --training getting error. #8

Open hassaanmahmood opened 5 years ago

hassaanmahmood commented 5 years ago

I am getting error . What can be the problem here.

`Training 1 ../data/iSEG_preprocessed/Training/T1/subject-1-T1.nii ../data/iSEG_preprocessed/Training/T2/subject-1-T2.nii ../data/iSEG_preprocessed/Training/label/subject-1-label.nii Extracting Patches from Image 1 .... Total Extracted Labelled Patches Shape: (2605, 32, 32, 32, 2) (2605, 32, 32, 32) ../data/iSEG_preprocessed/Testing/T1/subject-11-T1.nii ../data/iSEG_preprocessed/Testing/T2/subject-11-T2.nii ../data/iSEG_preprocessed/Training/label/subject-1-label.nii Processing the Image 11 .... Traceback (most recent call last): File "main.py", line 81, in tf.app.run() File "/home/hmahmood/anaconda3/envs/pi352/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run _sys.exit(main(argv)) File "main.py", line 73, in main network.train() File "/home/hmahmood/FewShot_GAN-Unet3D/proposed_model/model.py", line 223, in train data_directory=F.data_directory) File "../preprocess/preprocess.py", line 311, in init patch_shape, number_unlab_images_training)

File "../preprocess/preprocess.py", line 246, in preprocess_dynamic_unlab x=get_patches_unlab(T1_vols, T2_vols, extraction_step, patch_shape,dir) File "../preprocess/preprocess.py", line 205, in get_patches_unlab label_patches = extract_patches(label_ref, patch_shape, extraction_step) File "../preprocess/preprocess.py", line 81, in extract_patches dstride_d:(dstride_d)+patch_d] ValueError: could not broadcast input array from shape (32,32,32,1) into shape (32,32,32)`

abmBashir13 commented 4 years ago

Almost same problem here.

Training 1 ../data/iSEG_preprocessed/Training/T1/subject-1-T1.nii ../data/iSEG_preprocessed/Training/T2/subject-1-T2.nii ../data/iSEG_preprocessed/Training/label/subject-1-label.nii Traceback (most recent call last): File "main.py", line 80, in tf.app.run() File "/home/abm/.local/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/home/abm/.local/lib/python3.5/site-packages/absl/app.py", line 299, in run _run_main(main, args) File "/home/abm/.local/lib/python3.5/site-packages/absl/app.py", line 250, in _run_main sys.exit(main(argv)) File "main.py", line 73, in main network.train() File "/home/abm/codeGAN/proposed_model/model.py", line 223, in train data_directory=F.data_directory) File "../preprocess/preprocess.py", line 306, in init patch_shape,number_images_training) File "../preprocess/preprocess.py", line 164, in preprocess_dynamic_lab label_vols[(case_idx-c-1), :, :, :] = read_vol(case_idx, 'label', dir) ValueError: could not broadcast input array from shape (144,192,256,1) into shape (144,192,256)

arm-stronger commented 3 years ago

@hassaanmahmood can you share iseg2017 to me? thanks very much xsq87076396@vip.qq.com

arm-stronger commented 3 years ago

@abmBashir13 can you share iseg2017 to me? thanks very much xsq87076396@vip.qq.com

huanqingxu commented 2 years ago

'relu_slope': 0.2, 'seed': 1, 'validation_every_epoch': 1, 'volume_shape': [144, 192, 256], 'weight_decay': 0, 'x_test': '', 'x_train': '', 'x_valid': '', 'y_test': '', 'y_train': '', 'y_valid': ''}


The experiment name is unet_experiment


[INFO]: Hi, This is root. [INFO]: After the configurations are successfully processed and dirs are created. [INFO]: The pipeline of the project will begin now. Training 1 ./data/iSEG_preprocessed/Training/T1/subject-1-T1.nii (1, 144, 192, 256, 1) ./data/iSEG_preprocessed/Training/T2/subject-1-T2.nii (1, 144, 192, 256, 1) ./data/iSEG_preprocessed/Training/label/subject-1-label.nii (1, 144, 192, 256) Extracting Patches from Image 1 .... Traceback (most recent call last): File "main.py", line 31, in main() File "main.py", line 26, in main agent = agent_class(config) File "/media/lab549/CE56C94660FE3E83/semantic segmentation_xhq/code_xhq/FewShot_GAN-Unet3D-master/pytorch/agents/supervised_baseline.py", line 35, in init self.trainloader = Supervised_Dataset(self.config, "training") File "/media/lab549/CE56C94660FE3E83/semantic segmentation_xhq/code_xhq/FewShot_GAN-Unet3D-master/pytorch/datasets/dataloader.py", line 57, in init self.dataset = Supervised_Dataloader(config, phase) File "/media/lab549/CE56C94660FE3E83/semantic segmentation_xhq/code_xhq/FewShot_GAN-Unet3D-master/pytorch/datasets/dataloader.py", line 24, in init config.number_images_training) File "/media/lab549/CE56C94660FE3E83/semantic segmentation_xhq/code_xhq/FewShot_GAN-Unet3D-master/pytorch/utils/preprocess.py", line 173, in preprocess_dynamic_lab testing=testing,num_images_training=num_images_training) File "/media/lab549/CE56C94660FE3E83/semantic segmentation_xhq/code_xhq/FewShot_GAN-Unet3D-master/pytorch/utils/preprocess.py", line 111, in get_patches_lab T1_train = extract_patches(T1_vols[idx], patch_shape, extraction_step,datype="float32") File "/media/lab549/CE56C94660FE3E83/semantic segmentation_xhq/code_xhq/FewShot_GAN-Unet3D-master/pytorch/utils/preprocess.py", line 68, in extract_patches dstride_d:(dstride_d)+patch_d] ValueError: could not broadcast input array from shape (32,32,32,1) into shape (32,32,32)