Jack-Etheredge / Brain-Tumor-Segmentation-3D-UNet-CNN

Brain tumor segmentation using a 3D UNet CNN
108 stars 56 forks source link

ImportError: cannot import name 'InstanceNormalization' #4

Open srinivasb72s1 opened 5 years ago

srinivasb72s1 commented 5 years ago

hi sir, I really thank you, sir, for sharing a wonderful work. I am trying this code on google colaboratory. I got the following error, even if I did !pip install git+https://www.github.com/farizrahman4u/keras-contrib.git

ImportError Traceback (most recent call last)

in create_convolution_block(input_layer, n_filters, batch_normalization, kernel, activation, padding, strides, instance_normalization) 17 try: ---> 18 from keras_contrib.layers.normalization import InstanceNormalization 19 except ImportError: ImportError: cannot import name 'InstanceNormalization' During handling of the above exception, another exception occurred: ImportError Traceback (most recent call last) in () 40 41 if current_layer is inputs: ---> 42 in_conv = create_convolution_block(current_layer, n_level_filters) 43 else: 44 in_conv = create_convolution_block(current_layer, n_level_filters, strides=(2, 2, 2)) in create_convolution_block(input_layer, n_filters, batch_normalization, kernel, activation, padding, strides, instance_normalization) 18 from keras_contrib.layers.normalization import InstanceNormalization 19 except ImportError: ---> 20 raise ImportError("Install keras_contrib in order to use instance normalization." 21 "\nTry: pip install git+https://www.github.com/farizrahman4u/keras-contrib.git") 22 layer = InstanceNormalization(axis=1)(layer) ImportError: Install keras_contrib in order to use instance normalization. Try: pip install git+https://www.github.com/farizrahman4u/keras-contrib.git
parvezamu commented 5 years ago

do this keras_contrib.layers.normalization.instancenormalization import InstanceNormalization

sima97 commented 4 years ago

hi please go to the unet3d folder...then go to the model folder....under model folder...you will find a file named unet.py......now at line 103....you will find this from keras_contrib.layers.normalization import InstanceNormalization plz replace it with from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization and also install it pip install git+https://www.github.com/farizrahman4u/keras-contrib.git Regards Parvez Ahmad2020-03-21 13:26:18>sima97 wrote: hi thanks for your code, i have one question why do I have this error while my path adress is correct? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

hi thanks for your codes, but in train it needs more than 25g RAM, it gave me an error that need more RAM. how can I solve it?

sima97 commented 4 years ago

Hello You mean 25 GB GPU? ... no ... I was also train it and at that time it need less than 16GB GPU ... please try the patch shape of 96 or 64 .... also please lower the batch size Thanks ----- Original Messages ----- From: sima97 notifications@github.com Sent Time: 2020-04-19 12:53:07 (Sunday) To: Jack-Etheredge / Brain-Tumor-Segmentation- 3D-UNet-CNN Brain-Tumor-Segmentation-3D-UNet-CNN@noreply.github.com Cc: "PARVEZ AHMAD" parvezamu@hust.edu.cn, Comment comment@noreply.github.com Subject: Re: [Jack-Etheredge / Brain-Tumor-Segmentation-3D-UNet-CNN] ImportError: cannot import name 'InstanceNormalization' (# 4) hi please go to the unet3d folder ... then go to the model folder .... under model folder ... you will find a file named unet.py ... now at line 103 .... you will find this from keras_contrib.layers.normalization import InstanceNormalization plz replace it with from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization and also install it pip install git + https://www.github.com/farizrahman4u/keras-contrib.git Regards Parvez Ahmad2020-03-21 13:26:18> sima97 wrote: hi thanks for your code, i have one question why do I have this error while my path adress is correct? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. hi thanks for your codes, but in train it needs more than 25g RAM, it gave me an error that need more RAM. how can I solve it? — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or unsubscribe .

hello yes It needs more than 25G, my pickle is 180M and all of them is 62G, when I want to train it the error is session crashed and it means it need more than 25 G. thank you for your reply

sima97 commented 4 years ago

Hello It there is no direct relationship between the pickle size and the GPU. Currently, in one of my experiment, the pickle size is more than 3GB....but still it is run within 16GB. If possible send me the screenshot of the error. Thanking You2020-04-22 19:02:00>sima97 wrote: Hello You mean 25 GB GPU? ... no ... I was also train it and at that time it need less than 16GB GPU ... please try the patch shape of 96 or 64 .... also please lower the batch size Thanks … ----- Original Messages ----- From: sima97 notifications@github.com Sent Time: 2020-04-19 12:53:07 (Sunday) To: Jack-Etheredge / Brain-Tumor-Segmentation- 3D-UNet-CNN Brain-Tumor-Segmentation-3D-UNet-CNN@noreply.github.com Cc: "PARVEZ AHMAD" parvezamu@hust.edu.cn, Comment comment@noreply.github.com Subject: Re: [Jack-Etheredge / Brain-Tumor-Segmentation-3D-UNet-CNN] ImportError: cannot import name 'InstanceNormalization' (# 4) hi please go to the unet3d folder ... then go to the model folder .... under model folder ... you will find a file named unet.py ... now at line 103 .... you will find this from keras_contrib.layers.normalization import InstanceNormalization plz replace it with from keras_contrib.layers.normalization.instancenormalization import InstanceNormalization and also install it pip install git + https://www.github.com/farizrahman4u/keras-contrib.git Regards Parvez Ahmad2020-03-21 13:26:18> sima97 wrote: hi thanks for your code, i have one question why do I have this error while my path adress is correct? — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe. hi thanks for your codes, but in train it needs more than 25g RAM, it gave me an error that need more RAM. how can I solve it? — You are receiving this because you commented. Reply to this email directly, view it on GitHub , or unsubscribe . hello yes It needs more than 25G, my pickle is 180M and all of them is 62G, when I want to train it the error is session crashed and it means it need more than 25 G. thank you for your reply — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

hi thank you for your replying, yes did it in colab IMG_6785

sima97 commented 4 years ago

Hi I very much appreciate your help. I use colab but it doesnt work with GPU. I resize the crap of images and make them smaller then the train starts. I use the Brats2019. best regards IMG_6784

sima97 commented 4 years ago

Hi Thanks for your consideration. I know them and I did it before I use colab, and I change in from Runtime too. no I dont have any GPU server in my home but we have in university lab but the university is closed. now I change the bach size in 1 and resize the crap image in 646464 and now train. And Could I have your email Adress? Regards