diff --git a/docs/changelog.md b/docs/changelog.md index 14e92b9903..fe367eda2b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,6 +5,7 @@ **Highlights** **New Features** +- Automatically add modelzoo statistics to readthedocs ([#327](https://github.com/open-mmlab/mmaction2/pull/327)) **Improvements** - Add random seed for building filelists ([#323](https://github.com/open-mmlab/mmaction2/pull/323)) diff --git a/docs/conf.py b/docs/conf.py index 7fb619f575..3aa2ca76f4 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -72,6 +72,7 @@ def get_version(): def builder_inited_handler(app): subprocess.run(['./merge_docs.sh']) + subprocess.run(['./stat.py']) def setup(app): diff --git a/docs/index.rst b/docs/index.rst index 75c3eed97d..122c8cc151 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -20,6 +20,7 @@ Welcome to MMAction2's documentation! :maxdepth: 2 :caption: Model Zoo + modelzoo.md recognition_models.md localization_models.md @@ -32,6 +33,7 @@ Welcome to MMAction2's documentation! tutorials/data_pipeline.md tutorials/new_modules.md tutorials/export_model.md + tutorials/customize_runtime.md .. toctree:: :maxdepth: 2 diff --git a/docs/install.md b/docs/install.md index ad7d14885e..e7ef632857 100644 --- a/docs/install.md +++ b/docs/install.md @@ -65,7 +65,7 @@ If you build PyTorch from source instead of installing the prebuilt package, you c. Install mmcv, we recommend you to install the pre-build mmcv as below. ```shell -pip install mmcv-full==latest+torch1.5.0+cu101 -f http://download.openmmlab.com/mmcv/dist/index.html +pip install mmcv-full==latest+torch1.5.0+cu101 -f https://download.openmmlab.com/mmcv/dist/index.html ``` See [here](https://github.com/open-mmlab/mmcv#install-with-pip) for different versions of MMCV compatible to different PyTorch and CUDA versions. diff --git a/docs/stat.py b/docs/stat.py new file mode 100644 index 0000000000..8555089e9a --- /dev/null +++ b/docs/stat.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python +import functools as func +import glob +import re + +files = sorted(glob.glob('*_models.md')) + +stats = [] + +for f in files: + with open(f, 'r') as content_file: + content = content_file.read() + + # title + title = content.split('\n')[0].replace('#', '') + + # count papers + papers = set(x.lower().strip() + for x in re.findall(r'\btitle={(.*)}', content)) + paperlist = '\n'.join(sorted(' - ' + x for x in papers)) + + # count configs + configs = set(x.lower().strip() + for x in re.findall(r'https.*configs/.*\.py', content)) + + # count ckpts + ckpts = set(x.lower().strip() + for x in re.findall(r'https://download.*\.pth', content) + if 'mmaction' in x) + + statsmsg = f""" +## [{title}]({f}) + +* Number of checkpoints: {len(ckpts)} +* Number of configs: {len(configs)} +* Number of papers: {len(papers)} +{paperlist} + + """ + + stats.append((papers, configs, ckpts, statsmsg)) + +allpapers = func.reduce(lambda a, b: a.union(b), [p for p, _, _, _ in stats]) +allconfigs = func.reduce(lambda a, b: a.union(b), [c for _, c, _, _ in stats]) +allckpts = func.reduce(lambda a, b: a.union(b), [c for _, _, c, _ in stats]) +msglist = '\n'.join(x for _, _, _, x in stats) + +modelzoo = f""" +# Model Zoo Statistics + +* Number of checkpoints: {len(allckpts)} +* Number of configs: {len(allconfigs)} +* Number of papers: {len(allpapers)} + +{msglist} +""" + +with open('modelzoo.md', 'w') as f: + f.write(modelzoo) diff --git a/mmaction/__init__.py b/mmaction/__init__.py index 7ac11d954e..84582430b8 100644 --- a/mmaction/__init__.py +++ b/mmaction/__init__.py @@ -4,7 +4,7 @@ from .version import __version__ mmcv_minimum_version = '1.1.1' -mmcv_maximum_version = '1.2' +mmcv_maximum_version = '1.2.0' mmcv_version = digit_version(mmcv.__version__) assert (digit_version(mmcv_minimum_version) <= mmcv_version