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

predict.py中混淆矩阵的问题 #16

Open
MasonM0unt opened this issue Apr 19, 2024 · 2 comments
Open

predict.py中混淆矩阵的问题 #16

MasonM0unt opened this issue Apr 19, 2024 · 2 comments

Comments

@MasonM0unt
Copy link

你好!在predict.py中,混淆矩阵的初始化
conf_mat = np.zeros((num_classes, num_classes)).astype(np.int64)
写在了循环 for index, data in enumerate(dataloader): 里面
这导致了在测试时每轮batch都会将混淆矩阵归零一次,测试得到的预测数和标签数都没有累加。
同时这也导致了predict最后打印的评估指标其实是最后一轮batch的结果,而非整体的精度。
以上是我个人在运行predict.py时发现的问题,想请教一下作者在提供的代码中是否确实存在问题?谢谢!!!

@TheGameLife
Copy link

我也发现了这个问题。如果写在for循环外面,准确率降低了

@yisun98
Copy link
Owner

yisun98 commented Jun 18, 2024

可以调整至循环之外

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