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

Proplem with deconv_length from keras.utils.conv_utils #26

Open
MehdiMahdaviara opened this issue May 19, 2022 · 0 comments
Open

Proplem with deconv_length from keras.utils.conv_utils #26

MehdiMahdaviara opened this issue May 19, 2022 · 0 comments

Comments

@MehdiMahdaviara
Copy link

I'm trying to evaluate the performance of the code for segmentation of my 2D CT images. However, there is problem for loading deconv_length from keras.utils.conv_utils or even tensorflow.keras.utils. I googled the problem and replaced the "deconv_length" by "deconv_output_length". Again, an error occurs for the following line:

deconv_cap_1_1 = DeconvCapsuleLayer(kernel_size=4, num_capsule=8, num_atoms=32, upsamp_type='deconv', scaling=2, routings=3, padding='same', name='deconv_cap_1_1')(conv_cap_4_1)

Exception has occurred: AssertionError
Exception encountered when calling layer "deconv_cap_1_1" (type DeconvCapsuleLayer).

in user code:

File "d:\My_Codes\New_Cheng\segcapsnet\capsule_layers.py", line 250, in call  *
    out_height = deconv_output_length(self.input_height, self.scaling, self.kernel_size, self.padding)
File "C:\Users\ASUS\anaconda3\lib\site-packages\keras\utils\conv_utils.py", line 177, in deconv_output_length  **
    assert padding in {'same', 'valid', 'full'}

AssertionError: 

Call arguments received:
• input_tensor=tf.Tensor(shape=(None, 64, 64, 8, 32), dtype=float32)
• training=None
File "C:\Users\ASUS\AppData\Local\Temp_autograph_generated_filekx3mg4bh.py", line 63, in tf__call
ag
_.if_stmt(ag__.ld(self).upsamp_type == 'resize', if_body_1, else_body_1, get_state_1, set_state_1, ('outputs',), 1)
File "C:\Users\ASUS\AppData\Local\Temp_autograph_generated_filekx3mg4bh.py", line 55, in else_body_1
ag
_.if_stmt(ag__.ld(self).upsamp_type == 'subpix', if_body, else_body, get_state, set_state, ('outputs',), 1)
File "C:\Users\ASUS\AppData\Local\Temp_autograph_generated_filekx3mg4bh.py", line 45, in else_body
out_height = ag
_.converted_call(ag__.ld(deconv_output_length), (ag__.ld(self).input_height, ag__.ld(self).scaling, ag__.ld(self).kernel_size, ag__.ld(self).padding), None, fscope)

During handling of the above exception, another exception occurred:

During handling of the above exception, another exception occurred:

File "D:\My_Codes\New_Cheng\segcapsnet\capsnet.py", line 53, in CapsNetR3
deconv_cap_1_1 = DeconvCapsuleLayer(kernel_size=4, num_capsule=8, num_atoms=32, upsamp_type='deconv',
File "D:\My_Codes\New_Cheng\utils\model_helper.py", line 29, in create_model
model_list = CapsNetR3(input_shape, args.num_class, enable_decoder)
File "D:\My_Codes\New_Cheng\main.py", line 98, in main
model_list = create_model(args=args, input_shape=net_input_shape, enable_decoder=True)
File "D:\My_Codes\New_Cheng\main.py", line 284, in
main(arguments)

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

1 participant