Skip to content

Commit 7ac1f02

Browse files
authored
Merge 03b65ea into 6c6c127
2 parents 6c6c127 + 03b65ea commit 7ac1f02

18 files changed

+337
-86
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ We will keep up with the latest progress of the community, and support more popu
271271

272272
## Contributing
273273

274-
We appreciate all contributions to improve MMPose. Please refer to [CONTRIBUTING.md](https://mmpose.readthedocs.io/en/1.x/notes/contribution_guide.html) for the contributing guideline.
274+
We appreciate all contributions to improve MMPose. Please refer to [CONTRIBUTING.md](https://mmpose.readthedocs.io/en/1.x/contribution_guide.html) for the contributing guideline.
275275

276276
## Acknowledgement
277277

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ mim install "mmdet>=3.0.0rc6"
268268

269269
## 参与贡献
270270

271-
我们非常欢迎用户对于 MMPose 做出的任何贡献,可以参考 [贡献指南](https://mmpose.readthedocs.io/zh_CN/1.x/notes/contribution_guide.html) 文件了解更多细节。
271+
我们非常欢迎用户对于 MMPose 做出的任何贡献,可以参考 [贡献指南](https://mmpose.readthedocs.io/zh_CN/1.x/contribution_guide.html) 文件了解更多细节。
272272

273273
## 致谢
274274

docs/en/collect_projects.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) OpenMMLab. All rights reserved.
3+
import os
4+
import os.path as osp
5+
import re
6+
from glob import glob
7+
8+
9+
def _get_project_docs():
10+
"""Get all project document files.
11+
12+
Returns:
13+
list[str]: file paths
14+
"""
15+
project_root = osp.join('..', '..', 'projects')
16+
pattern = osp.sep.join(['*'] * 2) + '.md'
17+
docs = glob(osp.join(project_root, pattern))
18+
docs = [
19+
doc for doc in docs
20+
if 'example_project' not in doc and '_CN' not in doc
21+
]
22+
return docs
23+
24+
25+
def _parse_project_doc_path(fn):
26+
"""Get project name and banner from a project reference file.
27+
28+
Returns:
29+
tuple:
30+
- project_name (str)
31+
- project_banner (str)
32+
"""
33+
project_banner, project_name = None, None
34+
with open(fn, 'r', encoding='utf-8') as f:
35+
for line in f.readlines():
36+
if re.match('^( )*<img', line) and not project_banner:
37+
project_banner = line
38+
if line.startswith('# ') and not project_name:
39+
project_name = line
40+
if project_name and project_banner:
41+
break
42+
if project_name is None or project_banner is None:
43+
raise ValueError(f'Invalid paper reference file {fn}')
44+
45+
project_name = re.sub(r'^\# ', '', project_name).strip()
46+
project_banner = project_banner.strip()
47+
return project_name, project_banner
48+
49+
50+
def _get_project_intro_doc():
51+
project_intro_doc = []
52+
with open(
53+
osp.join('..', '..', 'projects', 'README.md'), 'r',
54+
encoding='utf-8') as f:
55+
for line in f.readlines():
56+
if line.startswith('# Welcome'):
57+
continue
58+
if './faq.md' in line:
59+
line = line.replace('./faq.md', '#faq')
60+
if './' in line:
61+
line = line.replace('./', '/projects/')
62+
project_intro_doc.append(line)
63+
if line.startswith('## Project List'):
64+
break
65+
return project_intro_doc
66+
67+
68+
def _get_faq_doc():
69+
faq_doc = ['\n']
70+
with open(
71+
osp.join('..', '..', 'projects', 'faq.md'), 'r',
72+
encoding='utf-8') as f:
73+
for line in f.readlines():
74+
if '#' in line:
75+
line = re.sub(r'^\#', '##', line)
76+
faq_doc.append(line)
77+
return faq_doc
78+
79+
80+
def main():
81+
82+
# Build output folders
83+
os.makedirs('projects', exist_ok=True)
84+
85+
# Collect all document contents
86+
project_doc_list = _get_project_docs()
87+
88+
project_lines = []
89+
for path in project_doc_list:
90+
name, banner = _parse_project_doc_path(path)
91+
_path = path.split(osp.sep)
92+
_rel_path = _path[_path.index('projects'):-1]
93+
url = '/' + '/'.join(_rel_path)
94+
_name = name.split(':', 1)
95+
name, description = _name[0], '' if len(
96+
_name) < 2 else f': {_name[-1]}'
97+
project_lines += [
98+
f'- **{name}**{description} [\\[github\\]]({url})', '',
99+
'<div align="center">', ' ' + banner, '</div>', '<br/>', ''
100+
]
101+
102+
project_intro_doc = _get_project_intro_doc()
103+
faq_doc = _get_faq_doc()
104+
105+
with open(
106+
osp.join('projects', 'community_projects.md'), 'w',
107+
encoding='utf-8') as f:
108+
f.write('# Projects from Community Contributors\n')
109+
f.write(''.join(project_intro_doc))
110+
f.write('\n'.join(project_lines))
111+
f.write(''.join(faq_doc))
112+
113+
114+
if __name__ == '__main__':
115+
print('collect project documents')
116+
main()

docs/en/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def get_version():
102102

103103
def builder_inited_handler(app):
104104
subprocess.run(['python', './collect_modelzoo.py'])
105+
subprocess.run(['python', './collect_projects.py'])
105106
subprocess.run(['sh', './merge_docs.sh'])
106107
subprocess.run(['python', './stats.py'])
107108

docs/en/guide_to_framework.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# A 20 Minute Guide to MMPose Framework
1+
# A 20-minute Tour to MMPose
22

33
MMPose 1.0 is built upon a brand-new framework. For developers with basic knowledge of deep learning, this tutorial provides a overview of MMPose 1.0 framework design. Whether you are **a user of the previous version of MMPose**, or **a beginner of MMPose wishing to start with v1.0**, this tutorial will show you how to build a project based on MMPose 1.0.
44

docs/en/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ You can change the documentation language at the lower-left corner of the page.
8080
dataset_zoo/3d_hand_keypoint.md
8181
dataset_zoo/dataset_tools.md
8282

83+
.. toctree::
84+
:maxdepth: 1
85+
:caption: Projects
86+
87+
projects/community_projects.md
88+
projects/projects.md
89+
8390
.. toctree::
8491
:maxdepth: 1
8592
:caption: Notes

docs/en/installation.md

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# Installation
22

3+
We recommend that users follow our best practices to install MMPose. However, the whole process is highly customizable. See [Customize Installation](#customize-installation) section for more information.
4+
35
- [Installation](#installation)
46
- [Prerequisites](#prerequisites)
5-
- [Install MMPose](#install-mmpose)
6-
- [Best Practices](#best-practices)
7-
- [Verify the installation](#verify-the-installation)
8-
- [Customize Installation](#customize-installation)
9-
- [CUDA versions](#cuda-versions)
10-
- [Install MMEngine without MIM](#install-mmengine-without-mim)
11-
- [Install MMCV without MIM](#install-mmcv-without-mim)
12-
- [Install on CPU-only platforms](#install-on-cpu-only-platforms)
13-
- [Install on Google Colab](#install-on-google-colab)
14-
- [Using MMPose with Docker](#using-mmpose-with-docker)
15-
- [Trouble shooting](#trouble-shooting)
7+
- [Best Practices](#best-practices)
8+
- [Build MMPose from source](#build-mmpose-from-source)
9+
- [Install as a Python package](#install-as-a-python-package)
10+
- [Customize Installation](#customize-installation)
11+
- [CUDA versions](#cuda-versions)
12+
- [Install MMEngine without MIM](#install-mmengine-without-mim)
13+
- [Install MMCV without MIM](#install-mmcv-without-mim)
14+
- [Install on CPU-only platforms](#install-on-cpu-only-platforms)
15+
- [Install on Google Colab](#install-on-google-colab)
16+
- [Using MMPose with Docker](#using-mmpose-with-docker)
17+
- [Verify the installation](#verify-the-installation)
18+
- [Trouble shooting](#trouble-shooting)
1619

1720
<!-- TOC -->
1821

@@ -51,13 +54,7 @@ On CPU platforms:
5154
conda install pytorch torchvision cpuonly -c pytorch
5255
```
5356

54-
## Install MMPose
55-
56-
We recommend that users follow our best practices to install MMPose. However, the whole process is highly customizable. See [Customize Installation](#customize-installation) section for more information.
57-
58-
### Best Practices
59-
60-
**Step 0.** Install [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv/tree/2.x) using [MIM](https://github.com/open-mmlab/mim).
57+
**Step 3.** Install [MMEngine](https://github.com/open-mmlab/mmengine) and [MMCV](https://github.com/open-mmlab/mmcv/tree/2.x) using [MIM](https://github.com/open-mmlab/mim).
6158

6259
```shell
6360
pip install -U openmim
@@ -71,9 +68,11 @@ Note that some of the demo scripts in MMPose require [MMDetection](https://githu
7168
mim install "mmdet>=3.0.0rc6"
7269
```
7370

74-
**Step 1.** Install MMPose.
71+
## Best Practices
7572

76-
Case A: To develop and run mmpose directly, install it from source:
73+
### Build MMPose from source
74+
75+
To develop and run mmpose directly, install it from source:
7776

7877
```shell
7978
git clone https://github.com/open-mmlab/mmpose.git -b 1.x
@@ -86,13 +85,15 @@ pip install -v -e .
8685
# thus any local modifications made to the code will take effect without reinstallation.
8786
```
8887

89-
Case B: To use mmpose as a dependency or third-party package, install it with pip:
88+
### Install as a Python package
89+
90+
To use mmpose as a dependency or third-party package, install it with pip:
9091

9192
```shell
9293
mim install "mmpose>=1.0.0rc1"
9394
```
9495

95-
### Verify the installation
96+
## Verify the installation
9697

9798
To verify that MMPose is installed correctly, you can run an inference demo with the following steps.
9899

@@ -141,9 +142,9 @@ The `demo.jpg` can be downloaded from [Github](https://raw.githubusercontent.com
141142

142143
The inference results will be a list of `PoseDataSample`, and the predictions are in the `pred_instances`, indicating the detected keypoint locations and scores.
143144

144-
### Customize Installation
145+
## Customize Installation
145146

146-
#### CUDA versions
147+
### CUDA versions
147148

148149
When installing PyTorch, you need to specify the version of CUDA. If you are not clear on which to choose, follow our recommendations:
149150

@@ -154,7 +155,7 @@ Please make sure the GPU driver satisfies the minimum version requirements. See
154155

155156
Installing CUDA runtime libraries is enough if you follow our best practices, because no CUDA code will be compiled locally. However if you hope to compile MMCV from source or develop other CUDA operators, you need to install the complete CUDA toolkit from NVIDIA's [website](https://developer.nvidia.com/cuda-downloads), and its version should match the CUDA version of PyTorch. i.e., the specified version of cudatoolkit in `conda install` command.
156157

157-
#### Install MMEngine without MIM
158+
### Install MMEngine without MIM
158159

159160
To install MMEngine with pip instead of MIM, please follow [MMEngine installation guides](https://mmengine.readthedocs.io/zh_CN/latest/get_started/installation.html).
160161

@@ -164,7 +165,7 @@ For example, you can install MMEngine by the following command.
164165
pip install mmengine
165166
```
166167

167-
#### Install MMCV without MIM
168+
### Install MMCV without MIM
168169

169170
MMCV contains C++ and CUDA extensions, thus depending on PyTorch in a complex way. MIM solves such dependencies automatically and makes the installation easier. However, it is not a must.
170171

@@ -176,13 +177,13 @@ For example, the following command install mmcv built for PyTorch 1.10.x and CUD
176177
pip install 'mmcv>=2.0.0rc1' -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10/index.html
177178
```
178179

179-
#### Install on CPU-only platforms
180+
### Install on CPU-only platforms
180181

181182
MMPose can be built for CPU only environment. In CPU mode you can train, test or inference a model.
182183

183184
However, some functionalities are missing in this mode, usually GPU-compiled ops like `Deformable Convolution`. Most models in MMPose don't depend on these ops, but if you try to train/test/infer a model containing these ops, an error will be raised.
184185

185-
#### Install on Google Colab
186+
### Install on Google Colab
186187

187188
[Google Colab](https://colab.research.google.com/) usually has PyTorch installed,
188189
thus we only need to install MMEngine, MMCV and MMPose with the following commands.
@@ -215,7 +216,7 @@ print(mmpose.__version__)
215216
Note that within Jupyter, the exclamation mark `!` is used to call external executables and `%cd` is a [magic command](https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-cd) to change the current working directory of Python.
216217
```
217218

218-
#### Using MMPose with Docker
219+
### Using MMPose with Docker
219220

220221
We provide a [Dockerfile](https://github.com/open-mmlab/mmpose/blob/master/docker/Dockerfile) to build an image. Ensure that your [docker version](https://docs.docker.com/engine/install/) >=19.03.
221222

@@ -239,7 +240,7 @@ docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmpose/data mmpose
239240
If you encounter the error message like `permission denied`, please add `sudo` at the start of the command and try it again.
240241
```
241242

242-
### Trouble shooting
243+
## Trouble shooting
243244

244-
If you have some issues during the installation, please first view the [FAQ](./notes/faq.md) page.
245+
If you have some issues during the installation, please first view the [FAQ](./faq.md) page.
245246
You may [open an issue](https://github.com/open-mmlab/mmpose/issues/new/choose) on GitHub if no solution is found.

docs/en/merge_docs.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) OpenMMLab. All rights reserved.
33

44
sed -i '$a\\n' ../../demo/docs/*_demo.md
5-
cat ../../demo/docs/*_demo.md | sed "s/#/#&/" | sed "s/md###t/html#t/g" | sed '1i\# Demo' | sed 's=](/docs/en/=](/=g' | sed 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' >demo.md
5+
cat ../../demo/docs/*_demo.md | sed "s/^## 2D\(.*\)Demo/##\1Estimation/" | sed "s/md###t/html#t/g" | sed '1i\# Demos\n' | sed 's=](/docs/en/=](/=g' | sed 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' >demos.md
66

77
# remove /docs/ for link used in doc site
88
sed -i 's=](/docs/en/=](=g' overview.md
@@ -15,6 +15,7 @@ sed -i 's=](/docs/en/=](=g' ./user_guides/*.md
1515
sed -i 's=](/docs/en/=](=g' ./advanced_guides/*.md
1616
sed -i 's=](/docs/en/=](=g' ./dataset_zoo/*.md
1717
sed -i 's=](/docs/en/=](=g' ./notes/*.md
18+
sed -i 's=](/docs/en/=](=g' ./projects/*.md
1819

1920

2021
sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' overview.md
@@ -27,3 +28,4 @@ sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' ./model_zoo_pa
2728
sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' ./user_guides/*.md
2829
sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' ./dataset_zoo/*.md
2930
sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' ./notes/*.md
31+
sed -i 's=](/=](https://github.com/open-mmlab/mmpose/tree/1.x/=g' ./projects/*.md

docs/en/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ We have prepared detailed guidelines for all types of users:
4646
4. For developers who wish to develop based on MMPose:
4747
- [Migration Guide](./migration.md)
4848
5. For researchers and developers who are willing to contribute to MMPose:
49-
- [Contribution Guide](./notes/contribution_guide.md)
49+
- [Contribution Guide](./contribution_guide.md)
5050
6. For some common issues, we provide a FAQ list:
51-
- [FAQ](./notes/faq.md)
51+
- [FAQ](./faq.md)
File renamed without changes.

0 commit comments

Comments
 (0)