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

实验结果精度只有7%,请教是哪里出错了? #2

Closed
noobgrow opened this issue Mar 20, 2022 · 5 comments
Closed

实验结果精度只有7%,请教是哪里出错了? #2

noobgrow opened this issue Mar 20, 2022 · 5 comments

Comments

@noobgrow
Copy link

大神您好!我使用的权重是vgg16-397923af.pth,环境是python3.9 opencv-python 4.5.5
这是运行结果,top1非常低,这是哪里出错了吗?

Number of processing images:  50000
101it [00:12,  8.36it/s]Top 1 classification accuracy: 0.07920792079207921	Top 5 classification accuracy: 0.10891089108910891	GT-known accuracy: 0.5643564356435643	top 1 localization accuracy: 0.04950495049504951	top 5 localization accuracy: 0.07920792079207921	The mean recall of top-1 class: 0.9079595817827214	The mean iou of top-1 class: 0.534435054374482	
@PengtaoJiang
Copy link
Owner

检查这个函数
contours, _ = cv2.findContours(binary_att, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
这个函数在4.5.5版本里面输出不一样,改成
_, contours, _ = cv2.findContours(binary_att, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

@noobgrow
Copy link
Author

noobgrow commented Mar 20, 2022

您好,这个函数在opencv 4.5.5中返回2个值,还有其他可能的问题吗?会不会是标签、权重或者代码计算哪里可能有问题?我用的不是caffe vgg16,是vgg16-397923af.pth,这个有影响吗?

    _,contours, _ = cv2.findContours(binary_att, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

ValueError: not enough values to unpack (expected 3, got 2)

@PengtaoJiang
Copy link
Owner

这个代码load的是caffe的模型。

@noobgrow
Copy link
Author

caffe的模型和torch model_zoo 的那个区别在哪里?我具体是改哪里可以跑vgg16-397923af.pth呢?

@PengtaoJiang
Copy link
Owner

我没有测试过torch的模型,我是按照Grad-CAM里面的setting测得caffe的模型。caffe的模型比torch的模型定位效果要好。如果需要 ,需要改test_data_loader_caffe() 成 test_data_loader() , 因为caffe模型和torch模型处理数据的方式是不一样的。

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