diff --git a/.gitignore b/.gitignore index 17676d67e9..7aef781c08 100644 --- a/.gitignore +++ b/.gitignore @@ -66,6 +66,7 @@ instance/ # Sphinx documentation docs/_build/ +docs_zh-CN/_build/ # PyBuilder target/ @@ -119,6 +120,10 @@ docs/topics/ docs/papers/*.md docs/datasets.md docs/modelzoo.md +docs_zh-CN/topics/ +docs_zh-CN/papers/*.md +docs_zh-CN/datasets.md +docs_zh-CN/modelzoo.md # Pytorch *.pth diff --git a/docs/conf.py b/docs/conf.py index 00c5f8f23b..971b84b780 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -19,7 +19,7 @@ # -- Project information ----------------------------------------------------- project = 'MMPose' -copyright = '2020, MMPose Authors' +copyright = '2020-2021, OpenMMLab' author = 'MMPose Authors' # The full version, including alpha/beta/rc tags @@ -70,6 +70,8 @@ def get_version(): # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = [] +language = 'en' + master_doc = 'index' diff --git a/docs/data_preparation.md b/docs/data_preparation.md index 9a8af64f71..0c691f532d 100644 --- a/docs/data_preparation.md +++ b/docs/data_preparation.md @@ -9,5 +9,5 @@ MMPose supports multiple tasks. Please follow the corresponding guidelines for d - [3D Hand Keypoint](tasks/3d_hand_keypoint.md) - [2D Face Keypoint](tasks/2d_face_keypoint.md) - [2D WholeBody Keypoint](tasks/2d_wholebody_keypoint.md) -- [2D Fashion Landmark Detection](tasks/2d_fashion_landmark.md) -- [2D Animal Keypoint Detection](tasks/2d_animal_keypoint.md) +- [2D Fashion Landmark](tasks/2d_fashion_landmark.md) +- [2D Animal Keypoint](tasks/2d_animal_keypoint.md) diff --git a/docs/index.rst b/docs/index.rst index f7b5dbb558..6b93779f29 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,10 @@ Welcome to MMPose's documentation! ================================== +You can change the documentation language at the lower-left corner of the page. + +您可以在页面左下角切换文档语言。 + .. toctree:: :maxdepth: 2 @@ -20,7 +24,9 @@ Welcome to MMPose's documentation! tasks/2d_hand_keypoint.md tasks/2d_fashion_landmark.md tasks/2d_animal_keypoint.md + tasks/3d_body_keypoint.md tasks/3d_body_mesh.md + tasks/3d_hand_keypoint.md .. toctree:: :maxdepth: 2 @@ -77,6 +83,11 @@ Welcome to MMPose's documentation! api.rst +.. toctree:: + :caption: Languages + + language.md + Indices and tables ================== diff --git a/docs/language.md b/docs/language.md new file mode 100644 index 0000000000..a0a6259bee --- /dev/null +++ b/docs/language.md @@ -0,0 +1,3 @@ +## English + +## 简体中文 diff --git a/docs/papers/algorithms/associative_embedding.md b/docs/papers/algorithms/associative_embedding.md index acbe431e3f..c8fc68b8b8 100644 --- a/docs/papers/algorithms/associative_embedding.md +++ b/docs/papers/algorithms/associative_embedding.md @@ -1,5 +1,7 @@ # Associative embedding: End-to-end learning for joint detection and grouping (AE) +## Introduction +
diff --git a/docs/useful_tools.md b/docs/useful_tools.md index 07382c7656..3c7ffb3be1 100644 --- a/docs/useful_tools.md +++ b/docs/useful_tools.md @@ -1,6 +1,6 @@ -Apart from training/testing scripts, We provide lots of useful tools under the `tools/` directory. +# Useful Tools Link -## Useful Tools Link +Apart from training/testing scripts, We provide lots of useful tools under the `tools/` directory. diff --git a/docs_zh-CN/Makefile b/docs_zh-CN/Makefile new file mode 100644 index 0000000000..d4bb2cbb9e --- /dev/null +++ b/docs_zh-CN/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs_zh-CN/api.rst b/docs_zh-CN/api.rst new file mode 100644 index 0000000000..ca005a3d38 --- /dev/null +++ b/docs_zh-CN/api.rst @@ -0,0 +1,112 @@ +API Documentation +================= + +mmpose.apis +------------- +.. automodule:: mmpose.apis + :members: + + +mmpose.core +------------- +evaluation +^^^^^^^^^^^ +.. automodule:: mmpose.core.evaluation + :members: + +fp16 +^^^^^^^^^^^ +.. automodule:: mmpose.core.fp16 + :members: + + +utils +^^^^^^^^^^^ +.. automodule:: mmpose.core.utils + :members: + + +post_processing +^^^^^^^^^^^^^^^^ +.. automodule:: mmpose.core.post_processing + :members: + + +mmpose.models +--------------- +backbones +^^^^^^^^^^^ +.. automodule:: mmpose.models.backbones + :members: + +necks +^^^^^^^^^^^ +.. automodule:: mmpose.models.necks + :members: + +detectors +^^^^^^^^^^^ +.. automodule:: mmpose.models.detectors + :members: + +heads +^^^^^^^^^^^^^^^ +.. automodule:: mmpose.models.heads + :members: + +losses +^^^^^^^^^^^ +.. automodule:: mmpose.models.losses + :members: + +misc +^^^^^^^^^^^ +.. automodule:: mmpose.models.misc + :members: + +mmpose.datasets +----------------- +.. automodule:: mmpose.datasets + :members: + +datasets +^^^^^^^^^^^ +.. automodule:: mmpose.datasets.datasets.top_down + :members: + +.. automodule:: mmpose.datasets.datasets.bottom_up + :members: + +pipelines +^^^^^^^^^^^ +.. automodule:: mmpose.datasets.pipelines + :members: + +.. automodule:: mmpose.datasets.pipelines.loading + :members: + +.. automodule:: mmpose.datasets.pipelines.shared_transform + :members: + +.. automodule:: mmpose.datasets.pipelines.top_down_transform + :members: + +.. automodule:: mmpose.datasets.pipelines.bottom_up_transform + :members: + +.. automodule:: mmpose.datasets.pipelines.mesh_transform + :members: + +.. automodule:: mmpose.datasets.pipelines.pose3d_transform + :members: + +samplers +^^^^^^^^^^^ +.. automodule:: mmpose.datasets.samplers + :members: + + +mmpose.utils +--------------- +.. automodule:: mmpose.utils + :members: diff --git a/docs_zh-CN/benchmark.md b/docs_zh-CN/benchmark.md new file mode 100644 index 0000000000..0de8844a4a --- /dev/null +++ b/docs_zh-CN/benchmark.md @@ -0,0 +1,3 @@ +# 基准测试 + +内容建设中…… diff --git a/docs_zh-CN/collect.py b/docs_zh-CN/collect.py new file mode 100755 index 0000000000..0ce335ce94 --- /dev/null +++ b/docs_zh-CN/collect.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python +import os +import re +from glob import glob + +from titlecase import titlecase + +os.makedirs('topics', exist_ok=True) +os.makedirs('papers', exist_ok=True) + +# Step 1: get subtopics: a mix of topic and task +minisections = [x.split('/')[-2:] for x in glob('../configs/*/*')] +alltopics = sorted(list(set(x[0] for x in minisections))) +subtopics = [] +for t in alltopics: + data = [x[1].split('_') for x in minisections if x[0] == t] + valid_ids = [] + for i in range(len(data[0])): + if len(set(x[i] for x in data)) > 1: + valid_ids.append(i) + if len(valid_ids) > 0: + subtopics.extend([ + f"{titlecase(t)}({','.join([d[i].title() for i in valid_ids])})", + t, '_'.join(d) + ] for d in data) + else: + subtopics.append([titlecase(t), t, '_'.join(data[0])]) + +contents = {} +for subtopic, topic, task in sorted(subtopics): + # Step 2: get all datasets + datasets = sorted( + list( + set( + x.split('/')[-2] + for x in glob(f'../configs/{topic}/{task}/*/*/')))) + contents[subtopic] = {d: {} for d in datasets} + for dataset in datasets: + # Step 3: get all settings: algorithm + backbone + trick + for file in glob(f'../configs/{topic}/{task}/*/{dataset}/*.md'): + keywords = (file.split('/')[-3], + *file.split('/')[-1].split('_')[:-1]) + with open(file, 'r') as f: + contents[subtopic][dataset][keywords] = f.read() + +# Step 4: write files by topic +for subtopic, datasets in contents.items(): + lines = [f'# {subtopic}', ''] + for dataset, keywords in datasets.items(): + if len(keywords) == 0: + continue + lines += [ + '
', '

', '', + f'##
{titlecase(dataset)} Dataset
', '' + ] + for keyword, info in keywords.items(): + keyword_strs = [titlecase(x.replace('_', ' ')) for x in keyword] + lines += [ + '
', '', + (f'### {" + ".join(keyword_strs)}' + f' on {titlecase(dataset)}'), '', info, '' + ] + + with open(f'topics/{subtopic.lower()}.md', 'w') as f: + f.write('\n'.join(lines)) + +# Step 5: write files by paper +allfiles = [x.split('/')[-2:] for x in glob('../docs/papers/*/*.md')] +sections = sorted(list(set(x[0] for x in allfiles))) +for section in sections: + lines = [f'# {titlecase(section)}', ''] + files = [f for s, f in allfiles if s == section] + for file in files: + with open(f'../docs/papers/{section}/{file}', 'r') as f: + keyline = [ + line for line in f.readlines() if line.startswith('', '', keyline).strip() + paperlines = [] + for subtopic, datasets in contents.items(): + for dataset, keywords in datasets.items(): + keywords = {k: v for k, v in keywords.items() if keyline in v} + if len(keywords) == 0: + continue + for keyword, info in keywords.items(): + keyword_strs = [ + titlecase(x.replace('_', ' ')) for x in keyword + ] + paperlines += [ + '
', '', + (f'### {" + ".join(keyword_strs)}' + f' on {titlecase(dataset)}'), '', info, '' + ] + if len(paperlines) > 0: + lines += [ + '
', '

', '', + f'##
{papername}
', '' + ] + lines += paperlines + + with open(f'papers/{section}.md', 'w') as f: + f.write('\n'.join(lines)) diff --git a/docs_zh-CN/conf.py b/docs_zh-CN/conf.py new file mode 100644 index 0000000000..c29635c69e --- /dev/null +++ b/docs_zh-CN/conf.py @@ -0,0 +1,85 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import subprocess +import sys + +sys.path.insert(0, os.path.abspath('..')) + +# -- Project information ----------------------------------------------------- + +project = 'MMPose' +copyright = '2020-2021, OpenMMLab' +author = 'MMPose Authors' + +# The full version, including alpha/beta/rc tags +version_file = '../mmpose/version.py' + + +def get_version(): + with open(version_file, 'r') as f: + exec(compile(f.read(), version_file, 'exec')) + return locals()['__version__'] + + +release = get_version() + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', + 'recommonmark', 'sphinx_markdown_tables' +] + +autodoc_mock_imports = ['json_tricks', 'mmpose.version'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# -- Options for HTML output ------------------------------------------------- +source_suffix = { + '.rst': 'restructuredtext', + '.md': 'markdown', +} + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = [] + +language = 'zh_CN' + +master_doc = 'index' + + +def builder_inited_handler(app): + subprocess.run(['./collect.py']) + subprocess.run(['./merge_docs.sh']) + subprocess.run(['./stats.py']) + + +def setup(app): + app.connect('builder-inited', builder_inited_handler) diff --git a/docs_zh-CN/data_preparation.md b/docs_zh-CN/data_preparation.md new file mode 100644 index 0000000000..ee91f6f1f5 --- /dev/null +++ b/docs_zh-CN/data_preparation.md @@ -0,0 +1,13 @@ +# 准备数据集 + +MMPose支持多种姿态估计任务,对应的数据集准备方法请参考下列文档。 + +- [2D人体关键点](tasks/2d_body_keypoint.md) +- [3D人体关键点](tasks/3d_body_keypoint.md) +- [3D人体网格模型](tasks/3d_body_mesh.md) +- [2D手部关键点](tasks/2d_hand_keypoint.md) +- [3D手部关键点](tasks/3d_hand_keypoint.md) +- [2D人脸关键点](tasks/2d_face_keypoint.md) +- [2D全身人体关键点](tasks/2d_wholebody_keypoint.md) +- [2D服装关键点](tasks/2d_fashion_landmark.md) +- [2D动物关键点](tasks/2d_animal_keypoint.md) diff --git a/docs_zh-CN/faq.md b/docs_zh-CN/faq.md new file mode 100644 index 0000000000..0bb8e6cf16 --- /dev/null +++ b/docs_zh-CN/faq.md @@ -0,0 +1,3 @@ +# 常见问题 + +内容建设中…… diff --git a/docs_zh-CN/getting_started.md b/docs_zh-CN/getting_started.md new file mode 100644 index 0000000000..4decfd47bd --- /dev/null +++ b/docs_zh-CN/getting_started.md @@ -0,0 +1,3 @@ +# 开始使用MMPose + +内容建设中…… diff --git a/docs_zh-CN/imgs/acc_curve.png b/docs_zh-CN/imgs/acc_curve.png new file mode 100644 index 0000000000..e6b8efb6e1 Binary files /dev/null and b/docs_zh-CN/imgs/acc_curve.png differ diff --git a/docs_zh-CN/imgs/qq_group_qrcode.jpg b/docs_zh-CN/imgs/qq_group_qrcode.jpg new file mode 100644 index 0000000000..417347449f Binary files /dev/null and b/docs_zh-CN/imgs/qq_group_qrcode.jpg differ diff --git a/docs_zh-CN/imgs/zhihu_qrcode.jpg b/docs_zh-CN/imgs/zhihu_qrcode.jpg new file mode 100644 index 0000000000..c745fb027f Binary files /dev/null and b/docs_zh-CN/imgs/zhihu_qrcode.jpg differ diff --git a/docs_zh-CN/index.rst b/docs_zh-CN/index.rst new file mode 100644 index 0000000000..114cdbc4a6 --- /dev/null +++ b/docs_zh-CN/index.rst @@ -0,0 +1,94 @@ +欢迎来到 MMPose 中文文档! +================================== + +您可以在页面左下角切换文档语言。 + +You can change the documentation language at the lower-left corner of the page. + +.. toctree:: + :maxdepth: 2 + + install.md + getting_started.md + demo.md + benchmark.md + +.. toctree:: + :maxdepth: 2 + :caption: 数据集 + + datasets.md + tasks/2d_body_keypoint.md + tasks/2d_wholebody_keypoint.md + tasks/2d_face_keypoint.md + tasks/2d_hand_keypoint.md + tasks/2d_fashion_landmark.md + tasks/2d_animal_keypoint.md + tasks/3d_body_keypoint.md + tasks/3d_body_mesh.md + tasks/3d_hand_keypoint.md + +.. toctree:: + :maxdepth: 2 + :caption: 模型池 + + modelzoo.md + topics/animal.md + topics/body(2d,kpt,img).md + topics/body(3d,kpt,img).md + topics/body(3d,kpt,vid).md + topics/body(3d,mesh,img).md + topics/face.md + topics/fashion.md + topics/hand(2d).md + topics/hand(3d).md + topics/wholebody.md + +.. toctree:: + :maxdepth: 2 + :caption: 模型池(按论文整理) + + papers/algorithms.md + papers/backbones.md + papers/datasets.md + papers/techniques.md + +.. toctree:: + :maxdepth: 2 + :caption: 教程 + + tutorials/0_config.md + tutorials/1_finetune.md + tutorials/2_new_dataset.md + tutorials/3_data_pipeline.md + tutorials/4_new_modules.md + tutorials/5_export_model.md + tutorials/6_customize_runtime.md + +.. toctree:: + :maxdepth: 2 + :caption: 常用工具 + + useful_tools.md + +.. toctree:: + :maxdepth: 2 + :caption: Notes + + faq.md + +.. toctree:: + :caption: API文档 + + api.rst + +.. toctree:: + :caption: 语言 + + Language.md + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` diff --git a/docs_zh-CN/install.md b/docs_zh-CN/install.md new file mode 100644 index 0000000000..9b7824adcf --- /dev/null +++ b/docs_zh-CN/install.md @@ -0,0 +1,3 @@ +## 安装 + +内容建设中…… diff --git a/docs_zh-CN/language.md b/docs_zh-CN/language.md new file mode 100644 index 0000000000..a0a6259bee --- /dev/null +++ b/docs_zh-CN/language.md @@ -0,0 +1,3 @@ +## English + +## 简体中文 diff --git a/docs_zh-CN/make.bat b/docs_zh-CN/make.bat new file mode 100644 index 0000000000..922152e96a --- /dev/null +++ b/docs_zh-CN/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs_zh-CN/merge_docs.sh b/docs_zh-CN/merge_docs.sh new file mode 100755 index 0000000000..4c5ec15292 --- /dev/null +++ b/docs_zh-CN/merge_docs.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +sed -i '$a\\n' ../demo/docs/*_demo.md +cat ../demo/docs/*_demo.md | sed "s/#/#&/" | sed "s/md###t/html#t/g" | sed '1i\# 示例' | sed 's/](\/docs\//](/g' | sed 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' >demo.md + + # remove /docs_zh-CN/ for link used in doc site +sed -i 's/](\/docs_zh-CN\//](/g' ./tutorials/*.md +sed -i 's/](\/docs_zh-CN\//](/g' ./tasks/*.md +sed -i 's/](\/docs_zh-CN\//](/g' ./papers/*.md +sed -i 's/](\/docs_zh-CN\//](/g' ./topics/*.md +sed -i 's/](\/docs_zh-CN\//](/g' data_preparation.md +sed -i 's/](\/docs_zh-CN\//](/g' getting_started.md +sed -i 's/](\/docs_zh-CN\//](/g' install.md +sed -i 's/](\/docs_zh-CN\//](/g' benchmark.md +# sed -i 's/](\/docs_zh-CN\//](/g' changelog.md +sed -i 's/](\/docs_zh-CN\//](/g' faq.md + +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' ./tutorials/*.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' ./tasks/*.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' ./papers/*.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' ./topics/*.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' data_preparation.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' getting_started.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' install.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' benchmark.md +# sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' changelog.md +sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/master/=g' faq.md diff --git a/docs_zh-CN/stats.py b/docs_zh-CN/stats.py new file mode 100755 index 0000000000..d585672eb5 --- /dev/null +++ b/docs_zh-CN/stats.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python +import functools as func +import glob +import re +from os.path import basename, splitext + +import numpy as np +import titlecase + + +def anchor(name): + return re.sub(r'-+', '-', re.sub(r'[^a-zA-Z0-9]', '-', + name.strip().lower())).strip('-') + + +# Count algorithms + +files = sorted(glob.glob('topics/*.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( + (papertype, titlecase.titlecase(paper.lower().strip())) + for (papertype, paper) in re.findall( + r'\s*\n.*?\btitle\s*=\s*{(.*?)}', + content, re.DOTALL)) + # paper links + revcontent = '\n'.join(list(reversed(content.splitlines()))) + paperlinks = {} + for _, p in papers: + print(p) + paperlinks[p] = ', '.join( + ((f'[{paperlink} ⇨]' + f'(topics/{splitext(basename(f))[0]}.html#{anchor(paperlink)})') + for paperlink in re.findall( + rf'\btitle\s*=\s*{{\s*{p}\s*}}.*?\n### (.*?)\s*[,;]?\s*\n', + revcontent, re.DOTALL | re.IGNORECASE))) + print(' ', paperlinks[p]) + paperlist = '\n'.join( + sorted(f' - [{t}] {x} ({paperlinks[x]})' for t, x in papers)) + # count configs + configs = set(x.lower().strip() + for x in re.findall(r'.*configs/.*\.py', content)) + + # count ckpts + ckpts = set(x.lower().strip() + for x in re.findall(r'https://download.*\.pth', content) + if 'mmpose' in x) + + statsmsg = f""" +## [{title}]({f}) + +* 模型权重文件数量: {len(ckpts)} +* 配置文件数量: {len(configs)} +* 论文数量: {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]) + +# Summarize + +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 = f""" +# 概览 + +* 模型权重文件数量: {len(allckpts)} +* 配置文件数量: {len(allconfigs)} +* 论文数量: {len(allpapers)} +{countstr} + +已支持的数据集详细信息请见 [数据集](datasets.md). + +{msglist} + +""" + +with open('modelzoo.md', 'w') as f: + f.write(modelzoo) + +# Count datasets + +files = sorted(glob.glob('tasks/*.md')) +# files = sorted(glob.glob('docs/tasks/*.md')) + +datastats = [] + +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( + (papertype, titlecase.titlecase(paper.lower().strip())) + for (papertype, paper) in re.findall( + r'\s*\n.*?\btitle\s*=\s*{(.*?)}', + content, re.DOTALL)) + # paper links + revcontent = '\n'.join(list(reversed(content.splitlines()))) + paperlinks = {} + for _, p in papers: + print(p) + paperlinks[p] = ', '.join( + (f'[{p} ⇨](tasks/{splitext(basename(f))[0]}.html#{anchor(p)})' + for p in re.findall( + rf'\btitle\s*=\s*{{\s*{p}\s*}}.*?\n## (.*?)\s*[,;]?\s*\n', + revcontent, re.DOTALL | re.IGNORECASE))) + print(' ', paperlinks[p]) + paperlist = '\n'.join( + sorted(f' - [{t}] {x} ({paperlinks[x]})' for t, 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 'mmpose' in x) + + statsmsg = f""" +## [{title}]({f}) + +* 论文数量: {len(papers)} +{paperlist} + + """ + + datastats.append((papers, configs, ckpts, statsmsg)) + +alldatapapers = func.reduce(lambda a, b: a.union(b), + [p for p, _, _, _ in datastats]) + +# Summarize + +msglist = '\n'.join(x for _, _, _, x in stats) +datamsglist = '\n'.join(x for _, _, _, x in datastats) +papertypes, papercounts = np.unique([t for t, _ in alldatapapers], + return_counts=True) +countstr = '\n'.join( + [f' - {t}: {c}' for t, c in zip(papertypes, papercounts)]) + +modelzoo = f""" +# 概览 + +* 论文数量: {len(alldatapapers)} +{countstr} + +已支持的算法详细信息请见 [模型池](modelzoo.md). + +{datamsglist} +""" + +with open('datasets.md', 'w') as f: + f.write(modelzoo) diff --git a/docs_zh-CN/tasks/2d_animal_keypoint.md b/docs_zh-CN/tasks/2d_animal_keypoint.md new file mode 100644 index 0000000000..3149533047 --- /dev/null +++ b/docs_zh-CN/tasks/2d_animal_keypoint.md @@ -0,0 +1,3 @@ +# 2D动物关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/2d_body_keypoint.md b/docs_zh-CN/tasks/2d_body_keypoint.md new file mode 100644 index 0000000000..3da95780e2 --- /dev/null +++ b/docs_zh-CN/tasks/2d_body_keypoint.md @@ -0,0 +1,3 @@ +# 2D人体关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/2d_face_keypoint.md b/docs_zh-CN/tasks/2d_face_keypoint.md new file mode 100644 index 0000000000..81655de425 --- /dev/null +++ b/docs_zh-CN/tasks/2d_face_keypoint.md @@ -0,0 +1,3 @@ +# 2D人脸关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/2d_fashion_landmark.md b/docs_zh-CN/tasks/2d_fashion_landmark.md new file mode 100644 index 0000000000..25b7fd7c64 --- /dev/null +++ b/docs_zh-CN/tasks/2d_fashion_landmark.md @@ -0,0 +1,3 @@ +# 2D服装关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/2d_hand_keypoint.md b/docs_zh-CN/tasks/2d_hand_keypoint.md new file mode 100644 index 0000000000..61c3eb3fa4 --- /dev/null +++ b/docs_zh-CN/tasks/2d_hand_keypoint.md @@ -0,0 +1,3 @@ +# 2D手部关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/2d_wholebody_keypoint.md b/docs_zh-CN/tasks/2d_wholebody_keypoint.md new file mode 100644 index 0000000000..23495ded14 --- /dev/null +++ b/docs_zh-CN/tasks/2d_wholebody_keypoint.md @@ -0,0 +1,3 @@ +# 2D全身人体关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/3d_body_keypoint.md b/docs_zh-CN/tasks/3d_body_keypoint.md new file mode 100644 index 0000000000..6ed59ffec7 --- /dev/null +++ b/docs_zh-CN/tasks/3d_body_keypoint.md @@ -0,0 +1,3 @@ +# 3D人体关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/3d_body_mesh.md b/docs_zh-CN/tasks/3d_body_mesh.md new file mode 100644 index 0000000000..24d364803e --- /dev/null +++ b/docs_zh-CN/tasks/3d_body_mesh.md @@ -0,0 +1,3 @@ +# 3D人体网格模型数据集 + +内容建设中…… diff --git a/docs_zh-CN/tasks/3d_hand_keypoint.md b/docs_zh-CN/tasks/3d_hand_keypoint.md new file mode 100644 index 0000000000..b0843a9f8f --- /dev/null +++ b/docs_zh-CN/tasks/3d_hand_keypoint.md @@ -0,0 +1,3 @@ +# 3D手部关键点数据集 + +内容建设中…… diff --git a/docs_zh-CN/tutorials/0_config.md b/docs_zh-CN/tutorials/0_config.md new file mode 100644 index 0000000000..7413f02220 --- /dev/null +++ b/docs_zh-CN/tutorials/0_config.md @@ -0,0 +1,3 @@ +# 教程 0: 模型配置文件 + +内容建设中…… diff --git a/docs_zh-CN/tutorials/1_finetune.md b/docs_zh-CN/tutorials/1_finetune.md new file mode 100644 index 0000000000..da218fa583 --- /dev/null +++ b/docs_zh-CN/tutorials/1_finetune.md @@ -0,0 +1,3 @@ +# 教程 1: 模型微调 + +内容建设中…… diff --git a/docs_zh-CN/tutorials/2_new_dataset.md b/docs_zh-CN/tutorials/2_new_dataset.md new file mode 100644 index 0000000000..98c1cfc565 --- /dev/null +++ b/docs_zh-CN/tutorials/2_new_dataset.md @@ -0,0 +1,3 @@ +# 教程 2: 增加新的数据集 + +内容建设中…… diff --git a/docs_zh-CN/tutorials/3_data_pipeline.md b/docs_zh-CN/tutorials/3_data_pipeline.md new file mode 100644 index 0000000000..288db0f05e --- /dev/null +++ b/docs_zh-CN/tutorials/3_data_pipeline.md @@ -0,0 +1,3 @@ +# 教程 3: 数据预处理流水线 + +内容建设中…… diff --git a/docs_zh-CN/tutorials/4_new_modules.md b/docs_zh-CN/tutorials/4_new_modules.md new file mode 100644 index 0000000000..df72bd579e --- /dev/null +++ b/docs_zh-CN/tutorials/4_new_modules.md @@ -0,0 +1,3 @@ +# 教程 4: 增加新的模块 + +内容建设中…… diff --git a/docs_zh-CN/tutorials/5_export_model.md b/docs_zh-CN/tutorials/5_export_model.md new file mode 100644 index 0000000000..9c3252dd2e --- /dev/null +++ b/docs_zh-CN/tutorials/5_export_model.md @@ -0,0 +1,3 @@ +# 教程 5: 导出模型到ONNX + +内容建设中…… diff --git a/docs_zh-CN/tutorials/6_customize_runtime.md b/docs_zh-CN/tutorials/6_customize_runtime.md new file mode 100644 index 0000000000..979ba8a95e --- /dev/null +++ b/docs_zh-CN/tutorials/6_customize_runtime.md @@ -0,0 +1,3 @@ +# 教程 6: 自定义运行时设置 + +内容建设中…… diff --git a/docs_zh-CN/useful_tools.md b/docs_zh-CN/useful_tools.md new file mode 100644 index 0000000000..a85f7a1e45 --- /dev/null +++ b/docs_zh-CN/useful_tools.md @@ -0,0 +1,3 @@ +# 常用工具 + +内容建设中……