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

想请问一下如何计算accuracy? #5

Open
marsggbo opened this issue Jul 8, 2019 · 3 comments
Open

想请问一下如何计算accuracy? #5

marsggbo opened this issue Jul 8, 2019 · 3 comments

Comments

@marsggbo
Copy link

marsggbo commented Jul 8, 2019

首先感谢你的注释,中文的看起来舒服多了。另外是这样的,我现在在做疾病分类,但是有的病灶只占了图像很小一部分,所以我现在需要用目标检测来提高图像分类准确率。我目前的想法是比如说一张图片预测出了很多box,那么我就按照置信度选择前10个box来得出最终这张图片的类别,比如看10个box觉得多数预测称了A类,那么就预测这张图片属于A类。

我现在用的是faster_rcnn_x101_64x4d这个模型,然后问题是我不太清楚模型输出是个什么东西。比如我在tools/test.py

def single_gpu_test(model, data_loader, show=False):
    model.eval()
    results = []
    dataset = data_loader.dataset
    prog_bar = mmcv.ProgressBar(len(dataset))
    for i, data in enumerate(data_loader):
        with torch.no_grad():
            result = model(return_loss=False, rescale=not show, **data)
        results.append(result)

        if show:
            model.module.show_result(data, result, dataset.img_norm_cfg)

        batch_size = data['img'][0].size(0)
        for _ in range(batch_size):
            prog_bar.update()
    return results

那个result我调试发现输出是个list,好像每次长度都为10,每个元素是一个tensor,维度是 n*5, 这个n不固定,可能是0,1,也可能是8。就想请问一下这里输出的是什么?或者有什么简单的办法可以计算最终的分类准确率?谢谢

@ming71
Copy link
Owner

ming71 commented Jul 9, 2019

result是前向传播结果,比如检测任务就是xywhc维度为5,另一个是检测的物体数

@marsggbo
Copy link
Author

marsggbo commented Jul 9, 2019 via email

@ming71
Copy link
Owner

ming71 commented Jul 10, 2019

感谢,明白了。还有个问题想问一下,就是为什么在第一epoch训练的时候,输出的日志显示accuracy就有90%以上?

---原始邮件--- 发件人: "ming71"[email protected] 发送时间: 2019年7月9日(星期二) 上午9:20 收件人: "ming71/mmdetection-annotated"[email protected]; 抄送: "marsggbo"[email protected];"Author"[email protected]; 主题: Re: [ming71/mmdetection-annotated] 想请问一下如何计算accuracy? (#5) result是前向传播结果,比如检测任务就是xywhc维度为5,另一个是检测的物体数 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

应该是你训练的类是模型预训练包含的,所以精度高

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