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

KeyError: 'zeropadding2d' #119

Open
hoda213 opened this issue Feb 18, 2021 · 1 comment
Open

KeyError: 'zeropadding2d' #119

hoda213 opened this issue Feb 18, 2021 · 1 comment

Comments

@hoda213
Copy link

hoda213 commented Feb 18, 2021

Hello,
I am trying to apply deeplift on my image dataset with densenet121 model but I get error:
my code is:

import deeplift
from deeplift.layers import NonlinearMxtsMode
from deeplift.conversion import kerasapi_conversion as kc
from tensorflow.keras.layers import ZeroPadding2D,BatchNormalization,Conv2D,Concatenate
saved_model_file='model.h5'

Three different models, one each for RevealCancel, Gradient and GuidedBackprop
revealcancel_model = kc.convert_model_from_saved_files(
h5_file=saved_model_file,
nonlinear_mxts_mode=NonlinearMxtsMode.RevealCancel)
grad_model = kc.convert_model_from_saved_files(
h5_file=saved_model_file,
nonlinear_mxts_mode=NonlinearMxtsMode.Gradient)
guided_backprop_model = kc.convert_model_from_saved_files(
h5_file=saved_model_file,
nonlinear_mxts_mode=NonlinearMxtsMode.GuidedBackprop)

and my error is:
KeyError: 'zeropadding2d'

KeyError Traceback (most recent call last)
in ()
14 guided_backprop_model = kc.convert_model_from_saved_files(
15 h5_file=saved_model_file,
---> 16 nonlinear_mxts_mode=NonlinearMxtsMode.GuidedBackprop)

3 frames
/usr/local/lib/python3.6/dist-packages/deeplift/conversion/kerasapi_conversion.py in convert_model_from_saved_files(h5_file, json_file, yaml_file, **kwargs)
411 layer_config["config"]["weights"] = layer_weights
412
--> 413 return model_conversion_function(model_config=model_config, **kwargs)
414
415

/usr/local/lib/python3.6/dist-packages/deeplift/conversion/kerasapi_conversion.py in convert_functional_model(model_config, nonlinear_mxts_mode, verbose, dense_mxts_mode, conv_mxts_mode, maxpool_deeplift_mode, layer_overrides, custom_conversion_funcs)
835 maxpool_deeplift_mode=maxpool_deeplift_mode,
836 layer_overrides=layer_overrides,
--> 837 custom_conversion_funcs=custom_conversion_funcs)
838
839 for output_layer in converted_model_container.output_layers:

/usr/local/lib/python3.6/dist-packages/deeplift/conversion/kerasapi_conversion.py in functional_container_conversion(config, name, verbose, nonlinear_mxts_mode, dense_mxts_mode, conv_mxts_mode, maxpool_deeplift_mode, layer_overrides, custom_conversion_funcs, outer_inbound_node_infos, node_id_to_deeplift_layers, node_id_to_input_node_info, name_to_deeplift_layer)
588 else:
589 conversion_function = layer_name_to_conversion_function(
--> 590 layer_config["class_name"])
591
592 #We need to deal with the case of shared layers, i.e. the same

/usr/local/lib/python3.6/dist-packages/deeplift/conversion/kerasapi_conversion.py in layer_name_to_conversion_function(layer_name)
345 # lowercase to create resistance to capitalization changes
346 # was a problem with previous Keras versions
--> 347 return name_dict[layer_name.lower()]
348
349

I would be grateful if you have any idea to solve it

@NGD1L
Copy link

NGD1L commented Apr 23, 2024

Hello,i meet this trouble too!Do you solve it?

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

2 participants