zhixuhao / unet

unet for image segmentation
MIT License
4.57k stars 2k forks source link

Traceback (most recent call last): #45

Open YangBai1109 opened 6 years ago

YangBai1109 commented 6 years ago

Traceback (most recent call last): File "/home/panpan/Desktop/unet-master/main.py", line 15, in model = unet() File "/home/panpan/Desktop/unet-master/model.py", line 35, in unet merge6 = merge([drop4,up6], mode = 'concat', concat_axis = 3) TypeError: 'module' object is not callable 您好,我刚接触这块,基础较弱; 我不知道为什么会有这个错误,找了很多关于这个的错误,也是不可以。您能告诉我怎么修改么

ajithvcoder commented 6 years ago

@PanPan0210 try with trainUnet.ipynb . which file are you running?

Pmac23 commented 6 years ago

I have the same error.

Pmac23 commented 6 years ago

@ajithvallabai the python notebook throws the same error! any imports I am missing out?

ajithvcoder commented 6 years ago

@PanPan0210 @Pmac23 i am able to execute . check your path for files and imports . keras version

sagardatascientists commented 6 years ago

Hi I got same problem. while running model = unet().

**merge6 = merge([drop4, up6], mode='concat', concat_axis=3)

TypeError: 'module' object is not callable**

I am using keras 2.2.0 with tensorflow 1.5.0.

ajithvcoder commented 6 years ago

@sagardatascientists could you use all the merges like below code merge6 = concatenate([drop4,up6],axis=3)

coudl you provide your python version ? .

ajithvcoder commented 6 years ago

@sagardatascientists I have modified the code for concatenate() and transpose but i didnt check the accuracy rate from up6 layer to conv 10 you need to provide the following code

up6 = Conv2DTranspose(512, (2,2),strides=(2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(drop5) merge6 = concatenate([drop4,up6],axis=3) conv6 = Conv2D(512, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(merge6) conv6 = Conv2D(512, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv6)

up7 = Conv2DTranspose(256,(2,2),strides=(2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv6) merge7 =concatenate([conv3,up7],axis=3) conv7 = Conv2D(256, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(merge7) conv7 = Conv2D(256, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv7)

up8 = Conv2DTranspose(128,(2,2),strides=(2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv7) merge8 =concatenate([conv2,up8],axis=3) conv8 = Conv2D(128, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(merge8) conv8 = Conv2D(128, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv8)

up9 = Conv2DTranspose(64,(2,2),strides=(2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv8) merge9 =concatenate([conv1,up9],axis=3) conv9 = Conv2D(64, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(merge9) conv9 = Conv2D(64, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv9) conv9 = Conv2D(2, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv9) conv10 = Conv2D(1, 1, activation = 'sigmoid')(conv9)

sagardatascientists commented 6 years ago

Hello Ajit,

Yes, I already did that and it works fine. I used Python 3.6 version.

Thank you for your reply!

On Wed, Jun 20, 2018 at 7:28 PM, Ajith notifications@github.com wrote:

@sagardatascientists https://github.com/sagardatascientists could you use all the merges like below code merge6 = concatenate([drop4,up6],axis=3)

coudl you provide your python version ? .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zhixuhao/unet/issues/45#issuecomment-398651926, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ2e3EGxWEJBsaxS2ZmNqgYXWW-wZaiQks5t-fmqgaJpZM4Ul1jo .

--

With Regards,

Sagar Soni | Machine Learning Engineer

+22 109 7206

akkshita commented 6 years ago

can you please tell me what changes i need to do code while i am import data by me without fetching fro site.

because i am unable to fetch it from kaggle site in this code i have kaggle ID and password

s4384596 commented 6 years ago

I got the same problem and I solved it! It’s because my Jupyter uses python 2, while my Keras is using python 3. When I run everything in python3, it worked well.

ShibaPrasad commented 6 years ago

Hi,

I am getting the below message while running Unet. I am using pyhon 3.6 and keras - 2.1.6-tf version. Please help me.

I changed below two lines or similar lines on code

up6 = Conv2DTranspose(512, (2,2),strides=(2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(drop5) merge6 = concatenate([drop4,up6],axis=3)

But getting the same error message.

TypeError Traceback (most recent call last)

in () 8 myGene = trainGenerator(2,'./data/membrane/train','image','label', data_gen_args, save_to_dir = None) 9 ---> 10 model = unet() 11 model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor = 'loss',verbose = 1, save_best_only = True) 12 model.fit_generator(myGene,steps_per_epoch = 300, epochs = 1, callbacks = [model_checkpoint]) /project/bioinformatics/Rajaram_lab/s183574/myCopy/unet-master/model.py in unet(pretrained_weights, input_size) 32 33 #up6 = Conv2D(512, 2, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(UpSampling2D(size = (2,2))(drop5)) ---> 34 #merge6 = merge([drop4,up6], mode = 'concat', concat_axis = 3) 35 up6 = Conv2DTranspose(512, (2,2),strides = (2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(drop5) 36 merge6 = concatenate([drop4, up6],axis = 3) TypeError: 'module' object is not callable
JunoWang commented 4 years ago

Hi,

I am getting the below message while running Unet. I am using pyhon 3.6 and keras - 2.1.6-tf version. Please help me.

I changed below two lines or similar lines on code

up6 = Conv2DTranspose(512, (2,2),strides=(2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(drop5) merge6 = concatenate([drop4,up6],axis=3)

But getting the same error message.

TypeError Traceback (most recent call last) in () 8 myGene = trainGenerator(2,'./data/membrane/train','image','label', data_gen_args, save_to_dir = None) 9 ---> 10 model = unet() 11 model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor = 'loss',verbose = 1, save_best_only = True) 12 model.fit_generator(myGene,steps_per_epoch = 300, epochs = 1, callbacks = [model_checkpoint])

/project/bioinformatics/Rajaram_lab/s183574/myCopy/unet-master/model.py in unet(pretrained_weights, input_size) 32 33 #up6 = Conv2D(512, 2, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(UpSampling2D(size = (2,2))(drop5)) ---> 34 #merge6 = merge([drop4,up6], mode = 'concat', concat_axis = 3) 35 up6 = Conv2DTranspose(512, (2,2),strides = (2,2), activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(drop5) 36 merge6 = concatenate([drop4, up6],axis = 3)

TypeError: 'module' object is not callable

did you solve it? I am facing the same thing