LXXXXR 194ab7efda
[Feature] Add bce loss for multilabel task (#130)
* add bce loss for multilabel task

* minor change

* apply class wise sum

* fix docstring

* do not apply sum over classes and fix docstring

* fix docstring

* fix weight shape

* fix weight shape

* fix docstring

* fix linting issue

Co-authored-by: Y. Xiong <xiongyuxy@gmail.com>
2021-01-11 11:05:24 +08:00

49 lines
1011 B
Python
Executable File

#!/usr/bin/env python
import glob
import os.path as osp
import re
url_prefix = 'https://github.com/open-mmlab/mmclassification/blob/master/'
files = sorted(glob.glob('../configs/*/README.md'))
stats = []
titles = []
num_ckpts = 0
num_configs = 0
for f in files:
url = osp.dirname(f.replace('../', url_prefix))
with open(f, 'r') as content_file:
content = content_file.read()
title = content.split('\n')[0].replace('# ', '')
ckpts = set(x.lower().strip()
for x in re.findall(r'\[model\]\((https?.*)\)', content))
if len(ckpts) == 0:
continue
num_ckpts += len(ckpts)
titles.append(title)
statsmsg = f"""
\t* [{title}]({url}) ({len(ckpts)} ckpts)
"""
stats.append((title, ckpts, statsmsg))
msglist = '\n'.join(x for _, _, x in stats)
modelzoo = f"""
# Model Zoo Statistics
* Number of papers: {len(set(titles))}
* Number of checkpoints: {num_ckpts}
{msglist}
"""
with open('modelzoo_statistics.md', 'w') as f:
f.write(modelzoo)