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

evaluation using average drop / increase #30

Open
yinliu13 opened this issue Feb 13, 2023 · 4 comments
Open

evaluation using average drop / increase #30

yinliu13 opened this issue Feb 13, 2023 · 4 comments

Comments

@yinliu13
Copy link

Hi, did you include the code on Average Drop and Increase In
Confidence?

@haofanwang
Copy link
Owner

haofanwang commented Feb 14, 2023

No, but it should be easy to implement on your own. The only thing you need to do is just making out the image and conduct another forward passing. But if you meet any problem, you can post here.

@zeroXscorpion7
Copy link

Hello, I tried to implement the average drop and increase calculation by myself, but I found that the calculation result does not match with the paper, how can I fix it?

Here is my code, mask is explanation map, image is picture, net is CNN model, ind is the number of class, and tar is the model output of the original drawing in the ind class:
mask_c=np.zeros((224,224))
K=int(-0.5*np.size(mask))
MK=np.argpartition(mask.flatten(),K)[K:]
mask_c[MK//mask_c.shape[0],MK%mask_c.shape[0]]=1
means=np.zeros(3)
im_D=image.copy()
im_D[mask_c==0,:]=means
inputs=prepare_input(im_D).to(device)
output=net(inputs)
D=1-output[0][ind].cpu().data.numpy()/tar
I=0
if D<0:
I=1
Dn=np.maximum(D,0)

I don't know if my understanding is wrong, can you please check how to fix it if you can?

@Code-Zark
Copy link

您好,可以提供一下Average Increase Drop和其他指标的评估代码吗,在下感激不尽。!!!!!!

@Code-Zark
Copy link

您好,我尝试自己实现平均下降和上升计算,但发现计算结果与论文不符,请问如何修复?

这是我的代码,mask是解释图,image是图片,net是CNN模型,ind是类号,tar是ind类中原图的模型输出:mask_c=np.zeros((224,224 ) ) K=int(-0.5*np.size(mask)) MK=np.argpartition(mask.flatten(),K)[K:] mask_c[MK//mask_c.shape[0],MK%mask_c.shape [0]]=1 意味着=np.zeros(3) im_D=image.copy() im_D[mask_c==0,:]=意味着 输入=prepare_input(im_D).to(device) 输出=net(输入) D =1-输出[0][ind].cpu().data.numpy()/tar I=0 如果 D<0: I=1 Dn=np.maximum(D,0)

不知道我的理解是否有误,如果可以请您检查一下如何解决?

您好,请问您解决了吗,想和您沟通交流一下

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