mmdetection中在cocoapi打印每个类别指标

mmdetection版本:2.25.2

改变源代码并格式化输出

代码参考文章:COCO评估输出指定某类AP或者输出每个类别AP结果
mmdetection中,在使用cocoAPI测试模型时,打印出每个类别的指标并格式化输出,训练时验证可用(要是介意改变源码就看看不改源码的方式):
双击shift搜索 summarize 找到 cocoeval.py 下的 _summarize() 函数,将代码做如下更改:

def _summarize( ap=1, iouThr=None, areaRng='all', maxDets=100 ):
     p = self.params
     iStr = ' {:<18} {} @[ IoU={:<9} | area={:>6s} | maxDets={:>4d} ] = {:<8.3f}'
     titleStr = 'Average Precision' if ap == 1 else 'Average Recall'
     typeStr = '(AP)' if ap==1 else '(AR)'
     iouStr = '{:0.2f}:{:0.2f}'.format(p.iouThrs[0], p.iouThrs[-1]) \
         if iouThr is None else '{:0.2f}'.format(iouThr)

     aind = [i for i, aRng in enumerate(p.areaRngLbl) if aRng == areaRng]
     mind = [i for i, mDet in enumerate(p.maxDets) if mDet == maxDets]
     if ap == 1:
         # dimension of precision: [TxRxKxAxM]
         s = self.eval['precision']
         # IoU
         if iouThr is not None:
             t = np.where(iouThr == p.iouThrs)[0]
             s = s[t]
         s = s
  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值