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

cannot use BinaryScore #84

Open
rEstela opened this issue Mar 4, 2022 · 3 comments
Open

cannot use BinaryScore #84

rEstela opened this issue Mar 4, 2022 · 3 comments

Comments

@rEstela
Copy link

rEstela commented Mar 4, 2022

Hi,
Thank you for this git! Is fantastic.

I'm having problems tying to use this for binary classification.

Can you show an example using it?

@keisen
Copy link
Owner

keisen commented Mar 4, 2022

@rEstela
Copy link
Author

rEstela commented Mar 4, 2022

Thank you,
This is what I was looking for. Somehow didn't see these instructions O.o

I tried to use it on a simpler example (cat and dog binary classification) and it worked!

My problem now is when i have nested models...

Model1

Model2_1

Model2_2

I used the code:

score = BinaryScore(1.0)

replace2linear = ReplaceToLinear()

gradcam = Gradcam(model,
model_modifier=replace2linear,
clone=True)

cam = gradcam(score,
x_img,
penultimate_layer=-1)

But i got the following error:

ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor(type_spec=TensorSpec(shape=(None, 141, 898, 1), dtype=tf.float32, name='conv2d_12_input'), name='conv2d_12_input', description="created by layer 'conv2d_12_input'") at layer "conv2d_12". The following previous layers were accessed without issue: []

If i do:

model2 = model2 = model.layers[1]

I have:

ValueError: output shape must be (batch_size, 1), but was (1, 64)

@IshaanShettigar
Copy link

I face the same Graph disconnected error

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

3 participants