Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback (most recent call last): #45

Open
YangBai1109 opened this issue Jun 13, 2018 · 12 comments
Open

Traceback (most recent call last): #45

YangBai1109 opened this issue Jun 13, 2018 · 12 comments

Comments

@YangBai1109
Copy link

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
Copy link

ajithvcoder commented Jun 13, 2018

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

@Pmac23
Copy link

Pmac23 commented Jun 13, 2018

I have the same error.

@Pmac23
Copy link

Pmac23 commented Jun 13, 2018

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

@ajithvcoder
Copy link

ajithvcoder commented Jun 13, 2018

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

@sagardatascientists
Copy link

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
Copy link

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

coudl you provide your python version ? .

@ajithvcoder
Copy link

ajithvcoder commented Jun 20, 2018

@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
Copy link

sagardatascientists commented Jun 20, 2018 via email

@akkshita
Copy link

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
Copy link

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
Copy link

ShibaPrasad commented Oct 22, 2018

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants