mmdet整理所有模型的coco指标

config_dir = '/home/yons/workplace/python/mmdetection-2.11.0-hjr/configs'
import glob
md_paths = glob.glob(config_dir+'/*/*.md')
print(len(md_paths))

log_urls = []

def Find(string):
    regex = r'http[\S]*.json'
    url = re.findall(regex,string)  
    return url
    
for md_path in md_paths:
    f = open(md_path, "r",  encoding="utf-8")
    readfile = f.read()
    f.close() 
    urls = Find(readfile)
    for url in urls:
        if url.endswith('log.json'):
            log_urls.append(url)

log_urls = list(set(log_urls))
log_urls = [url for url in log_urls if url.find('lvis') == -1 and url.find('pascal_voc') == -1 and url.find('cityscapes') == -1]

print(len(log_urls))

from nncv import multiprocess_run
from urllib.request import urlretrieve
import os
def process(url):
    if len(url.split('/')[-1]) <= 25:
        dst = os.path.join('/home/yons/tmp/mmdet', url.split('/')[-2]+'_'+ url.split('/')[-1])
    else:
        dst = os.path.join('/home/yons/tmp/mmdet', url.split('/')[-1])
    urlretrieve(url, dst)
multiprocess_run(process, log_urls)

json_log_names = os.listdir('/home/yons/tmp/mmdet')

for x in json_log_names:
    json_log = os.path.join('/home/yons/tmp/mmdet', x)
    if x.find('rpn') != -1 or x.find('coco-person') !=-1:
        continue
   
    try:
         with open(json_log, 'r') as log_file:
            d = json.loads(log_file.readlines()[-1])
            mAP = d["bbox_mAP"]
            mAP_s = d["bbox_mAP_s"]
            if mAP_s > 0.28:
                print(mAP_s, json_log)
            # if mAP > 0.5:
            #    print(mAP, json_log)
    except Exception as e:
        pass
        # print(json_log)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值