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)
except Exception as e:
pass