File tree 3 files changed +52
-0
lines changed
3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 11
11
# documentation root, use os.path.abspath to make it absolute, like shown here.
12
12
#
13
13
import os
14
+ import subprocess
14
15
import sys
15
16
16
17
sys .path .insert (0 , os .path .abspath ('..' ))
@@ -77,3 +78,11 @@ def get_version():
77
78
# relative to this directory. They are copied after the builtin static files,
78
79
# so a file named "default.css" will overwrite the builtin "default.css".
79
80
html_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!
7
7
install.md
8
8
getting_started.md
9
9
config.md
10
+ modelzoo_statistics.md
10
11
model_zoo.md
11
12
12
13
.. 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