File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1111# documentation root, use os.path.abspath to make it absolute, like shown here.
1212#
1313import os
14+ import subprocess
1415import sys
1516
1617sys .path .insert (0 , os .path .abspath ('..' ))
@@ -77,3 +78,11 @@ def get_version():
7778# relative to this directory. They are copied after the builtin static files,
7879# so a file named "default.css" will overwrite the builtin "default.css".
7980html_static_path = ['_static' ]
81+
82+
83+ def builder_inited_handler (app ):
84+ subprocess .run (['./stat.py' ])
85+
86+
87+ def setup (app ):
88+ app .connect ('builder-inited' , builder_inited_handler )
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Welcome to MMSegmenation's documentation!
77 install.md
88 getting_started.md
99 config.md
10+ modelzoo_statistics.md
1011 model_zoo.md
1112
1213.. toctree ::
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+ import glob
3+ import os .path as osp
4+ import re
5+
6+ url_prefix = 'https://github.com/open-mmlab/mmsegmentation/blob/master/'
7+
8+ files = sorted (glob .glob ('../configs/*/README.md' ))
9+
10+ stats = []
11+ titles = []
12+ num_ckpts = 0
13+
14+ for f in files :
15+ url = osp .dirname (f .replace ('../' , url_prefix ))
16+
17+ with open (f , 'r' ) as content_file :
18+ content = content_file .read ()
19+
20+ title = content .split ('\n ' )[0 ].replace ('#' , '' )
21+ titles .append (title )
22+ ckpts = set (x .lower ().strip ()
23+ for x in re .findall (r'https?://download.*\.pth' , content )
24+ if 'mmsegmentation' in x )
25+ num_ckpts += len (ckpts )
26+ statsmsg = f"""
27+ \t * [{ title } ]({ url } ) ({ len (ckpts )} ckpts)
28+ """
29+ stats .append ((title , ckpts , statsmsg ))
30+
31+ msglist = '\n ' .join (x for _ , _ , x in stats )
32+
33+ modelzoo = f"""
34+ # Model Zoo Statistics
35+
36+ * Number of papers: { len (titles )}
37+ * Number of checkpoints: { num_ckpts }
38+ { msglist }
39+ """
40+
41+ with open ('modelzoo_statistics.md' , 'w' ) as f :
42+ f .write (modelzoo )
You can’t perform that action at this time.
0 commit comments