update stat to classify papers
@@ -4,6 +4,8 @@ import glob
import os.path as osp
import re
+import numpy as np
+
config_dpaths = sorted(glob.glob('../configs/**'))
stats = []
@@ -23,13 +25,15 @@ for config_dpath in config_dpaths:
_ckpts = set(x.lower().strip()
for x in re.findall(r'https://download.*\.pth', content)
if 'mmediting' in x)
- _papers = set(x.lower().strip()
- for x in re.findall(r'\btitle\s*=\s*{(.*)}', content))
+ _papers = set(
+ (papertype, paper.lower().strip())
+ for (papertype, paper) in re.findall(
+ r'\[([A-Z]+?)\].*?\btitle\s*=\s*{(.*?)}', content, re.DOTALL))
ckpts = ckpts.union(_ckpts)
papers = papers.union(_papers)
- paperlist = '\n'.join(sorted(' - ' + x for x in papers))
+ paperlist = '\n'.join(sorted(f' - [{t}] {x}' for t, x in papers))
statsmsg = f"""
### {title.title()}
@@ -46,12 +50,18 @@ allpapers = func.reduce(lambda a, b: a.union(b), [p for p, _, _ in stats])
allckpts = func.reduce(lambda a, b: a.union(b), [c for _, c, _ in stats])
msglist = '\n'.join(x for _, _, x in stats)
+papertypes, papercounts = np.unique([t for t, _ in allpapers],
+ return_counts=True)
+countstr = '\n'.join(
+ [f' - {t}: {c}' for t, c in zip(papertypes, papercounts)])
+
modelzoo_statsmsg = f"""
# Model Zoo
## Model Zoo Statistics
* Number of checkpoints: {len(allckpts)}
* Number of papers: {len(allpapers)}
+{countstr}
{msglist}
"""
