Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Chinese doc project #787

Merged
merged 12 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ instance/

# Sphinx documentation
docs/_build/
docs_zh-CN/_build/

# PyBuilder
target/
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'


Expand Down
4 changes: 2 additions & 2 deletions docs/data_preparation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 11 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand Down Expand Up @@ -77,6 +83,11 @@ Welcome to MMPose's documentation!

api.rst

.. toctree::
:caption: Languages

language.md


Indices and tables
==================
Expand Down
3 changes: 3 additions & 0 deletions docs/language.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## <a href='https://mmpose.readthedocs.io/en/latest/'>English</a>

## <a href='https://mmpose.readthedocs.io/zh_CN/latest/'>简体中文</a>
2 changes: 2 additions & 0 deletions docs/papers/algorithms/associative_embedding.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Associative embedding: End-to-end learning for joint detection and grouping (AE)

## Introduction

<!-- [ALGORITHM] -->

<details>
Expand Down
4 changes: 2 additions & 2 deletions docs/useful_tools.md
Original file line number Diff line number Diff line change
@@ -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.

<!-- TOC -->

Expand Down
20 changes: 20 additions & 0 deletions docs_zh-CN/Makefile
Original file line number Diff line number Diff line change
@@ -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)
112 changes: 112 additions & 0 deletions docs_zh-CN/api.rst
Original file line number Diff line number Diff line change
@@ -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:
3 changes: 3 additions & 0 deletions docs_zh-CN/benchmark.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 基准测试

内容建设中……
102 changes: 102 additions & 0 deletions docs_zh-CN/collect.py
Original file line number Diff line number Diff line change
@@ -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 += [
'<hr/>', '<br/><br/>', '',
f'## <div align="center">{titlecase(dataset)} Dataset</div>', ''
]
for keyword, info in keywords.items():
keyword_strs = [titlecase(x.replace('_', ' ')) for x in keyword]
lines += [
'<br/>', '',
(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('<summary')
][0]
papername = re.sub(r'\<.*?\>', '', 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 += [
'<br/>', '',
(f'### {" + ".join(keyword_strs)}'
f' on {titlecase(dataset)}'), '', info, ''
]
if len(paperlines) > 0:
lines += [
'<hr/>', '<br/><br/>', '',
f'## <div align="center">{papername}</div>', ''
]
lines += paperlines

with open(f'papers/{section}.md', 'w') as f:
f.write('\n'.join(lines))
Loading