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

[Bug Report] - Error in true_divide -> All ResnetV2 Keras Models #130

Open
Meywether opened this issue May 4, 2020 · 4 comments
Open

[Bug Report] - Error in true_divide -> All ResnetV2 Keras Models #130

Meywether opened this issue May 4, 2020 · 4 comments

Comments

@Meywether
Copy link

Meywether commented May 4, 2020

Dear Sicara,
thanks for this great easy-to-use library.
I do have to mention a bug in your script if I am using one of the ResnetV2 Models:
Starting with a small modified version of your provided example, tf-explain throws following error by using:

  • ResNet50V2
  • ResNet101V2
  • ResNet152V2

The "V1" Versions are working properly. -> Tested with all three variants!

The script throws following error:

image

Thanks in advance!
Best regards
Meywether

Attached: My version of your provided example:

image

@RaphaelMeudec
Copy link
Collaborator

@Meywether This might be due to heatmap.min being equal to heatmap.max. You might want to remove the last softmax layer of the Resnet to prevent this from happening.

@nishantagarwal
Copy link

@Meywether This might be due to heatmap.min being equal to heatmap.max. You might want to remove the last softmax layer of the Resnet to prevent this from happening.

@RaphaelMeudec is right here. Even I had the same issue. I resolved it by removing the last layer from my pre-trained model.

@Meywether
Copy link
Author

Hello @RaphaelMeudec and @nishantagarwal ,
thanks for your response.

model = tf.keras.applications.resnet_v2.ResNet50V2(weights="imagenet", include_top=False) - is not working

So I created a second model by using:
model2 = Model(model.input, model.layers[-2].output)

model2.summary() shows me that the props layer is gone, but still getting the same error

I thought that model2 = Model(model.input, model.layers[-1].output) should be enough but in my case the Dense probs layer was still in my model.

May I ask you to provide me a code snippet ?

Best regards

Meywether

@Ram-WD
Copy link

Ram-WD commented Sep 13, 2021

I have the same problem as @Meywether , with a custom keras model with multi output ( segmentation and classification).

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

4 participants