lindawangg / COVID-Net

COVID-Net Open Source Initiative
Other
1.15k stars 478 forks source link

GSInquire/Gradcams #113

Open Electro1111 opened 3 years ago

Electro1111 commented 3 years ago

Hello,

I am attempting to run gradcams on the COVIDNet-CXR4-A model but to do so I need the name of the last convolutional layer. I was wondering if you had access to the name of the tensor. I found the last conv2d name in the metafile in order to be:

'conv2d_203/convolution:0'

but the shape of this tensor is

Tensor("conv2d_203/convolution:0", shape=(?, 13, 13, 216), dtype=float32)

Which doesn't seem to make much sense. Any advice or guidance would be appreciated.

haydengunraj commented 3 years ago

Hi @Electro1111 ,

As long as that's the last convolutional layer, it should be correct. The shape seems fine, as it's (batch size, height, width, channels). There is some good discussion of Grad-CAM in issue #64 that you may find helpful.

Electro1111 commented 3 years ago

Hi @haydengunraj That issue was very helpful! However, it is still not clear from that issue which layers are the final convolutional layers in the model from doing the printouts. many of them have unclear names like:

CXR3-B replica_1/model_1/conv5_block3_3_conv/convolution:0 replica_1/model_1/conv5_block3_3_conv/BiasAdd:0 replica_1/model_1/conv5_block3_out/add:0

and I am not sure wether to use the convolution layer or the add layer for example.

according to that discussion for CXR-A should be:

replica_1/model_1/conv_7b/convolution:0

but there are other ones that come after that one like: replica_1/model_1/conv_7b_ac/Relu:0

Any advice on how to confidently identify the final conv layers would be very helpful.