[Docs]: Add sphinx document (#109)

* Add document structure

* better zh_cn document

* add build example, update requirement

* add readme

* add usage

* fix end of file

* fix codebase names, add TODO
This commit is contained in:
q.yao 2021-10-09 14:10:42 +08:00 committed by GitHub
parent 21f2b047a1
commit 1d47688b32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 1050 additions and 134 deletions

1
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1 @@
We appreciate all contributions to improve MMDeploy. Please refer to [CONTRIBUTING.md](https://github.com/open-mmlab/mmcv/blob/master/CONTRIBUTING.md) in MMCV for more details about the contributing guideline.

2
.gitignore vendored
View File

@ -65,6 +65,8 @@ instance/
# Sphinx documentation
docs/_build/
docs_zh_CN/_build/
src/pytorch-sphinx-theme/
# PyBuilder
target/

View File

@ -1,2 +1,2 @@
[settings]
known_third_party = h5py,mmcls,mmcv,mmdet,mmedit,mmocr,mmseg,ncnn,numpy,onnx,onnxruntime,packaging,pyppl,pytest,setuptools,tensorrt,torch
known_third_party = h5py,m2r,mmcls,mmcv,mmdet,mmedit,mmocr,mmseg,ncnn,numpy,onnx,onnxruntime,packaging,pyppl,pytest,pytorch_sphinx_theme,recommonmark,setuptools,sphinx,tensorrt,torch

9
.readthedocs.yml Normal file
View File

@ -0,0 +1,9 @@
version: 2
formats: all
python:
version: 3.7
install:
- requirements: requirements/runtime.txt
- requirements: requirements/docs.txt

106
README.md
View File

@ -1,59 +1,67 @@
# MMDeployment
## Introduction
English | [简体中文](README_zh-CN.md)
MMDeploy is an open-source deep learning model deployment toolset. It is
a part of the [OpenMMLab](https://openmmlab.com/) project.
### Major features
- **OpenMMLab model support**
Models in OpenMMLab can be deployed with this project. Such as MMClassification, MMDetection, etc.
- **Multiple inference engine support**
Models can be export and inference with different backend. Such as ONNX Runtime, TensorRT, etc.
- **Model rewrite**
Modules and functions used in models can be rewrited to meet the demond of different backend. It is easy to add new model support.
## License
This project is released under the [Apache 2.0 license](LICENSE).
## Codebase and Backend support
Supported codebase:
- [x] MMClassification
- [x] MMDetection
- [x] MMSegmentation
- [x] MMEditing
- [x] MMOCR
Supported backend:
- [x] ONNX Runtime
- [x] TensorRT
- [x] PPL
- [x] ncnn
## Installation
- Build backend ops
Please refer to [build.md](docs/build.md) for installation.
- update submodule
## Getting Started
```bash
git submodule update --init
```
Please read [how_to_convert_model.md](docs/tutorials/how_to_convert_model.md) for the basic usage of MMDeploy. There are also tutorials for [how to create config](docs/tutorials/how_to_create_config.md), [how to support new model](docs/tutorials/how_to_support_new_model.md) and [how to test model](docs/tutorials/how_to_test_model.md).
- Build with onnxruntime support
Please refer to [FAQ](docs/faq.md) for frequently asked questions.
```bash
mkdir build
cd build
cmake -DBUILD_ONNXRUNTIME_OPS=ON -DONNXRUNTIME_DIR=${PATH_TO_ONNXRUNTIME} ..
make -j10
```
## Contributing
- Build with tensorrt support
We appreciate all contributions to improve MMDeploy. Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md) for the contributing guideline.
```bash
mkdir build
cd build
cmake -DBUILD_TENSORRT_OPS=ON -DTENSORRT_DIR=${PATH_TO_TENSORRT} ..
make -j10
```
## Projects in OpenMMLab
- Build with ncnn support
```bash
mkdir build
cd build
cmake -DBUILD_NCNN_OPS=ON -DNCNN_DIR=${PATH_TO_NCNN} ..
make -j10
```
- Or you can add multiple flags to build multiple backend ops.
- Setup project
```bash
python setup.py develop
```
## Usage
```bash
python ./tools/deploy.py \
${DEPLOY_CFG_PATH} \
${MODEL_CFG_PATH} \
${MODEL_CHECKPOINT_PATH} \
${INPUT_IMG} \
--work-dir ${WORK_DIR} \
--device ${DEVICE} \
--log-level INFO
```
- [MMCV](https://github.com/open-mmlab/mmcv): OpenMMLab foundational library for computer vision.
- [MIM](https://github.com/open-mmlab/mim): MIM Installs OpenMMLab Packages.
- [MMClassification](https://github.com/open-mmlab/mmclassification): OpenMMLab image classification toolbox and benchmark.
- [MMDetection](https://github.com/open-mmlab/mmdetection): OpenMMLab detection toolbox and benchmark.
- [MMDetection3D](https://github.com/open-mmlab/mmdetection3d): OpenMMLab's next-generation platform for general 3D object detection.
- [MMSegmentation](https://github.com/open-mmlab/mmsegmentation): OpenMMLab semantic segmentation toolbox and benchmark.
- [MMAction2](https://github.com/open-mmlab/mmaction2): OpenMMLab's next-generation action understanding toolbox and benchmark.
- [MMTracking](https://github.com/open-mmlab/mmtracking): OpenMMLab video perception toolbox and benchmark.
- [MMPose](https://github.com/open-mmlab/mmpose): OpenMMLab pose estimation toolbox and benchmark.
- [MMEditing](https://github.com/open-mmlab/mmediting): OpenMMLab image and video editing toolbox.
- [MMOCR](https://github.com/open-mmlab/mmocr): A Comprehensive Toolbox for Text Detection, Recognition and Understanding.
- [MMGeneration](https://github.com/open-mmlab/mmgeneration): OpenMMLab image and video generative models toolbox.

3
README_zh-CN.md Normal file
View File

@ -0,0 +1,3 @@
## 介绍
[English](README.md) | 简体中文

19
docs/Makefile Normal file
View File

@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
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)

7
docs/_static/css/readthedocs.css vendored Normal file
View File

@ -0,0 +1,7 @@
.header-logo {
/* TODO: add background-image */
/* background-image: url("../image/mmcv-logo.png"); */
background-size: 85px 40px;
height: 40px;
width: 85px;
}

24
docs/api.rst Normal file
View File

@ -0,0 +1,24 @@
apis
-------
.. automodule:: mmdeploy.apis
:members:
apis/tensorrt
-------------
.. automodule:: mmdeploy.apis.tensorrt
:members:
apis/onnxruntime
----------------
.. automodule:: mmdeploy.apis.onnxruntime
:members:
apis/ncnn
---------
.. automodule:: mmdeploy.apis.ncnn
:members:
apis/ppl
--------
.. automodule:: mmdeploy.apis.ppl
:members:

3
docs/backends/ncnn.md Normal file
View File

@ -0,0 +1,3 @@
## ncnn Support
### Installation

View File

@ -0,0 +1,3 @@
## ONNX Runtime Support
### Installation

3
docs/backends/ppl.md Normal file
View File

@ -0,0 +1,3 @@
## PPL Support
### Installation

28
docs/backends/tensorrt.md Normal file
View File

@ -0,0 +1,28 @@
## TensorRT Support
### Installation
#### Install TensorRT
Please install TensorRT 8 follow [install-guide](https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html).
#### Build custom ops
Some custom ops are created to support models in OpenMMLab, the custom ops can be build as follow:
```bash
cd ${MMDEPLOY_DIR}
mkdir build
cd build
cmake -DBUILD_TENSORRT_OPS=ON ..
make -j$(nproc)
```
If you haven't install TensorRT in default path, Please add `-DTENSORRT_DIR` flag in cmake.
```bash
cmake -DBUILD_TENSORRT_OPS=ON -DTENSORRT_DIR=${TENSORRT_DIR} ..
make -j$(nproc)
```
### Convert model

22
docs/build.md Normal file
View File

@ -0,0 +1,22 @@
## Build MMdeploy
### Build backend support
Update third-party libraries.
```bash
git submodule update --init
```
Build the inference engine extension libraries you need.
- [ONNX Runtime](ops/onnxruntime.md)
- [TensorRT](backends/tensorrt.md)
- [ncnn](backends/ncnn.md)
- [PPL](backends/ppl.md)
### Install mmdeploy
```bash
pip install -e .
```

1
docs/codebases/mmcls.md Normal file
View File

@ -0,0 +1 @@
## MMClassification Support

1
docs/codebases/mmdet.md Normal file
View File

@ -0,0 +1 @@
## MMDetection Support

1
docs/codebases/mmedit.md Normal file
View File

@ -0,0 +1 @@
## MMEditing Support

1
docs/codebases/mmocr.md Normal file
View File

@ -0,0 +1 @@
## MMOCR Support

1
docs/codebases/mmseg.md Normal file
View File

@ -0,0 +1 @@
## MMSegmentation Support

286
docs/conf.py Normal file
View File

@ -0,0 +1,286 @@
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- 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 sys
import pytorch_sphinx_theme
from m2r import MdInclude
from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder
sys.path.insert(0, os.path.abspath('..'))
version_file = '../mmdeploy/version.py'
with open(version_file, 'r') as f:
exec(compile(f.read(), version_file, 'exec'))
__version__ = locals()['__version__']
# -- Project information -----------------------------------------------------
project = 'mmdeploy'
copyright = '2021-2024, OpenMMLab'
author = 'MMDeploy Authors'
# The short X.Y version
version = __version__
# The full version, including alpha/beta/rc tags
release = __version__
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# 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',
'sphinx.ext.autosectionlabel',
'sphinx_markdown_tables',
'myst_parser',
'sphinx_copybutton',
] # yapf: disable
autosectionlabel_prefix_document = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# 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']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'sphinx_rtd_theme'
html_theme = 'pytorch_sphinx_theme'
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
# TODO: Add log_url
# 'logo_url': 'https://mmocr.readthedocs.io/en/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/grimoire/deploy_prototype'
},
{
'name':
'Projects',
'children': [
{
'name': 'MMAction2',
'url': 'https://github.com/open-mmlab/mmaction2',
},
{
'name': 'MMClassification',
'url': 'https://github.com/open-mmlab/mmclassification',
},
{
'name': 'MMDetection',
'url': 'https://github.com/open-mmlab/mmdetection',
},
{
'name': 'MMDetection3D',
'url': 'https://github.com/open-mmlab/mmdetection3d',
},
{
'name': 'MMEditing',
'url': 'https://github.com/open-mmlab/mmediting',
},
{
'name': 'MMGeneration',
'url': 'https://github.com/open-mmlab/mmgeneration',
},
{
'name': 'MMOCR',
'url': 'https://github.com/open-mmlab/mmocr',
},
{
'name': 'MMPose',
'url': 'https://github.com/open-mmlab/mmpose',
},
{
'name': 'MMSegmentation',
'url': 'https://github.com/open-mmlab/mmsegmentation',
},
{
'name': 'MMTracking',
'url': 'https://github.com/open-mmlab/mmtracking',
},
]
},
{
'name':
'OpenMMLab',
'children': [
{
'name': 'Homepage',
'url': 'https://openmmlab.com/'
},
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/'
},
{
'name': 'Twitter',
'url': 'https://twitter.com/OpenMMLab'
},
{
'name': 'Zhihu',
'url': 'https://zhihu.com/people/openmmlab'
},
]
},
]
}
# 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 = ['_static']
html_css_files = ['css/readthedocs.css']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'mmdeploydoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'mmdeploy.tex', 'mmdeploy Documentation',
'MMDeploy Contributors', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'mmdeploy', 'mmdeploy Documentation', [author], 1)]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'mmdeploy', 'mmdeploy Documentation', author, 'mmdeploy',
'One line description of project.', 'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# set priority when building html
StandaloneHTMLBuilder.supported_image_types = [
'image/svg+xml', 'image/gif', 'image/png', 'image/jpeg'
]
# -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_is_regexp = True
def setup(app):
app.add_config_value('no_underscore_emphasis', False, 'env')
app.add_config_value('m2r_parse_relative_links', False, 'env')
app.add_config_value('m2r_anonymous_references', False, 'env')
app.add_config_value('m2r_disable_inline_math', False, 'env')
app.add_directive('mdinclude', MdInclude)
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents',
'enable_eval_rst': True,
}, True)
app.add_transform(AutoStructify)

1
docs/faq.md Normal file
View File

@ -0,0 +1 @@
## Frequently Asked Questions

64
docs/index.rst Normal file
View File

@ -0,0 +1,64 @@
Welcome to MMDeploy's documentation!
====================================
You can switch between Chinese and English documents in the lower-left corner of the layout.
.. toctree::
:maxdepth: 1
:caption: Get Started
build.md
.. toctree::
:maxdepth: 1
:caption: Tutorials
tutorials/how_to_convert_model.md
tutorials/how_to_create_config.md
tutorials/how_to_test_model.md
tutorials/how_to_support_new_model.md
.. toctree::
:maxdepth: 1
:caption: OpenMMLab Support
codebases/mmcls.md
codebases/mmdet.md
codebases/mmseg.md
codebases/mmedit.md
codebases/mmocr.md
.. toctree::
:maxdepth: 1
:caption: Backend Support
backends/onnxruntime.md
backends/tensorrt.md
backends/ncnn.md
backends/ppl.md
.. toctree::
:maxdepth: 1
:caption: Custom Ops
ops/onnxruntime.md
ops/tensorrt.md
ops/ncnn.md
.. toctree::
:maxdepth: 1
:caption: FAQ
faq.md
.. toctree::
:maxdepth: 1
:caption: API Reference
api.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

35
docs/make.bat Normal file
View File

@ -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%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd

View File

@ -1,84 +0,0 @@
# How to Deploy ncnn Models in deploy_prototype
This tutorial is based on Linux systems like Ubuntu-16.04.
Before starting this tutorial, you should make sure that the prerequisites mentioned by `deploy_prototype/README.md` are prepared.
## Preparation
- Download VulkanTools for the compilation of ncnn.
```bash
wget https://sdk.lunarg.com/sdk/download/1.2.176.1/linux/vulkansdk-linux-x86_64-1.2.176.1.tar.gz?Human=true -O vulkansdk-linux-x86_64-1.2.176.1.tar.gz
tar -xf vulkansdk-linux-x86_64-1.2.176.1.tar.gz
export VULKAN_SDK=$(pwd)/1.2.176.1/x86_64
- Prepare ncnn Framework
- Download ncnn source code of tag 20210507
```bash
git clone -b 20210507 git@github.com:Tencent/ncnn.git
```
- <font color=red>Make install</font> ncnn library
```bash
cd ncnn
mkdir build
cmake -DNCNN_VULKAN=ON -DNCNN_SYSTEM_GLSLANG=ON -DNCNN_BUILD_EXAMPLES=ON -DNCNN_PYTHON=ON -DNCNN_BUILD_TOOLS=ON -DNCNN_BUILD_BENCHMARK=ON -DNCNN_BUILD_TESTS=ON ..
make install
```
- Install pyncnn module
```bash
cd ncnn/python
pip install .
```
- Build ncnn backend ops of deploy_prototype
```bash
cd deploy_prototype
mkdir build
cd build
cmake -DBUILD_NCNN_OPS=ON -DNCNN_DIR=${PATH_TO_NCNN}/ncnn ..
```
The `${PATH_TO_NCNN}` refers as the root directory of ncnn source code.
- Install mmdeploy module
```bash
cd deploy_prototype
python setup.py develop
```
Or you will fail on
```
No module named mmdeploy
```
## FAQs
1. When running ncnn models for inference with custom ops, it fails and shows the error message like:
```
TypeError: register mm custom layers(): incompatible function arguments. The following argument types are supported:
1.(ar0: ncnn:Net) -> int
Invoked with: <ncnn.ncnn.Net object at 0x7f7fc4038bb0>
```
This is because of the failure to bind ncnn C++ library to pyncnn. You should build pyncnn from C++ ncnn source code, but not by `pip install`
2. When run the tools/deploy.py, it fails:
```
Undefined symbol: __cpu_model
```
This is a bug of gcc-5, you should update to `gcc >= 6`
## Performance Test
### MMCls
This table shows the performance of mmclassification models deployed on ncnn.
Dataset: ImageNet `val` dataset.
| Model | Top-1(%) | Top-5(%) |
|-------|----------|----------|
| MobileNetV2| 71.86 (71.86) | 90.42 (90.42) |
| ResNet | 69.88 (70.07) | 89.34 (89.44) |
| ResNeXt | 78.61 (78.71) | 94.17 (94.12) |
The data in the parentheses is the inference result from pytorch.
(According to: [mmcls model_zoo docs](https://github.com/open-mmlab/mmclassification/blob/master/docs/model_zoo.md))

1
docs/ops/ncnn.md Normal file
View File

@ -0,0 +1 @@
## ncnn Ops

3
docs/ops/onnxruntime.md Normal file
View File

@ -0,0 +1,3 @@
## ONNX Runtime Ops
### Installation

1
docs/ops/tensorrt.md Normal file
View File

@ -0,0 +1 @@
## TensorRT Ops

View File

@ -0,0 +1,12 @@
## How to convert model
```bash
python ./tools/deploy.py \
${DEPLOY_CFG_PATH} \
${MODEL_CFG_PATH} \
${MODEL_CHECKPOINT_PATH} \
${INPUT_IMG} \
--work-dir ${WORK_DIR} \
--device ${DEVICE} \
--log-level INFO
```

View File

@ -0,0 +1 @@
## How to create config

View File

@ -0,0 +1 @@
## How to support new model

View File

@ -0,0 +1 @@
## How to test model

19
docs_zh_CN/Makefile Normal file
View File

@ -0,0 +1,19 @@
# Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line.
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)

1
docs_zh_CN/_static Symbolic link
View File

@ -0,0 +1 @@
../docs/_static

24
docs_zh_CN/api.rst Normal file
View File

@ -0,0 +1,24 @@
apis
-------
.. automodule:: mmdeploy.apis
:members:
apis/tensorrt
-------------
.. automodule:: mmdeploy.apis.tensorrt
:members:
apis/onnxruntime
----------------
.. automodule:: mmdeploy.apis.onnxruntime
:members:
apis/ncnn
---------
.. automodule:: mmdeploy.apis.ncnn
:members:
apis/ppl
--------
.. automodule:: mmdeploy.apis.ppl
:members:

View File

@ -0,0 +1 @@
## ncnn 支持

View File

@ -0,0 +1 @@
## ONNX Runtime 支持

View File

@ -0,0 +1 @@
## PPL 支持

View File

@ -0,0 +1 @@
## TensorRT 支持

1
docs_zh_CN/build.md Normal file
View File

@ -0,0 +1 @@
## 安装 MMdeploy

View File

@ -0,0 +1 @@
## MMClassification 支持

View File

@ -0,0 +1 @@
## MMDetection 支持

View File

@ -0,0 +1 @@
## MMEditing 支持

View File

@ -0,0 +1 @@
## MMOCR 支持

View File

@ -0,0 +1 @@
## MMSegmentation 支持

286
docs_zh_CN/conf.py Normal file
View File

@ -0,0 +1,286 @@
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- 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 sys
import pytorch_sphinx_theme
from m2r import MdInclude
from recommonmark.transform import AutoStructify
from sphinx.builders.html import StandaloneHTMLBuilder
sys.path.insert(0, os.path.abspath('..'))
version_file = '../mmdeploy/version.py'
with open(version_file, 'r') as f:
exec(compile(f.read(), version_file, 'exec'))
__version__ = locals()['__version__']
# -- Project information -----------------------------------------------------
project = 'mmdeploy'
copyright = '2021-2024, OpenMMLab'
author = 'MMDeploy Authors'
# The short X.Y version
version = __version__
# The full version, including alpha/beta/rc tags
release = __version__
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# 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',
'sphinx.ext.autosectionlabel',
'sphinx_markdown_tables',
'myst_parser',
'sphinx_copybutton',
] # yapf: disable
autosectionlabel_prefix_document = True
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
source_suffix = {
'.rst': 'restructuredtext',
'.md': 'markdown',
}
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'zh_CN'
# 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']
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# html_theme = 'sphinx_rtd_theme'
html_theme = 'pytorch_sphinx_theme'
html_theme_path = [pytorch_sphinx_theme.get_html_theme_path()]
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
# TODO: Add log_url
# 'logo_url': 'https://mmocr.readthedocs.io/en/latest/',
'menu': [
{
'name': 'GitHub',
'url': 'https://github.com/grimoire/deploy_prototype'
},
{
'name':
'算法库',
'children': [
{
'name': 'MMAction2',
'url': 'https://github.com/open-mmlab/mmaction2',
},
{
'name': 'MMClassification',
'url': 'https://github.com/open-mmlab/mmclassification',
},
{
'name': 'MMDetection',
'url': 'https://github.com/open-mmlab/mmdetection',
},
{
'name': 'MMDetection3D',
'url': 'https://github.com/open-mmlab/mmdetection3d',
},
{
'name': 'MMEditing',
'url': 'https://github.com/open-mmlab/mmediting',
},
{
'name': 'MMGeneration',
'url': 'https://github.com/open-mmlab/mmgeneration',
},
{
'name': 'MMOCR',
'url': 'https://github.com/open-mmlab/mmocr',
},
{
'name': 'MMPose',
'url': 'https://github.com/open-mmlab/mmpose',
},
{
'name': 'MMSegmentation',
'url': 'https://github.com/open-mmlab/mmsegmentation',
},
{
'name': 'MMTracking',
'url': 'https://github.com/open-mmlab/mmtracking',
},
]
},
{
'name':
'OpenMMLab',
'children': [
{
'name': '官网',
'url': 'https://openmmlab.com/'
},
{
'name': 'GitHub',
'url': 'https://github.com/open-mmlab/'
},
{
'name': '推特',
'url': 'https://twitter.com/OpenMMLab'
},
{
'name': '知乎',
'url': 'https://zhihu.com/people/openmmlab'
},
]
},
]
}
# 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 = ['_static']
html_css_files = ['css/readthedocs.css']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'mmdeploydoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'mmdeploy.tex', 'mmdeploy Documentation',
'MMDeploy Contributors', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, 'mmdeploy', 'mmdeploy Documentation', [author], 1)]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'mmdeploy', 'mmdeploy Documentation', author, 'mmdeploy',
'One line description of project.', 'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# set priority when building html
StandaloneHTMLBuilder.supported_image_types = [
'image/svg+xml', 'image/gif', 'image/png', 'image/jpeg'
]
# -- Extension configuration -------------------------------------------------
# Ignore >>> when copying code
copybutton_prompt_text = r'>>> |\.\.\. '
copybutton_prompt_is_regexp = True
def setup(app):
app.add_config_value('no_underscore_emphasis', False, 'env')
app.add_config_value('m2r_parse_relative_links', False, 'env')
app.add_config_value('m2r_anonymous_references', False, 'env')
app.add_config_value('m2r_disable_inline_math', False, 'env')
app.add_directive('mdinclude', MdInclude)
app.add_config_value('recommonmark_config', {
'auto_toc_tree_section': 'Contents',
'enable_eval_rst': True,
}, True)
app.add_transform(AutoStructify)

1
docs_zh_CN/faq.md Normal file
View File

@ -0,0 +1 @@
## 常见问题

64
docs_zh_CN/index.rst Normal file
View File

@ -0,0 +1,64 @@
欢迎来到 MMDeploy 的中文文档!
====================================
您可以在页面左下角切换中英文文档。
.. toctree::
:maxdepth: 1
:caption: 安装指南
build.md
.. toctree::
:maxdepth: 1
:caption: 教程
tutorials/how_to_convert_model.md
tutorials/how_to_create_config.md
tutorials/how_to_test_model.md
tutorials/how_to_support_new_model.md
.. toctree::
:maxdepth: 1
:caption: OpenMMLab 算法库支持
codebases/mmcls.md
codebases/mmdet.md
codebases/mmseg.md
codebases/mmedit.md
codebases/mmocr.md
.. toctree::
:maxdepth: 1
:caption: 推理引擎支持
backends/onnxruntime.md
backends/tensorrt.md
backends/ncnn.md
backends/ppl.md
.. toctree::
:maxdepth: 1
:caption: 自定义算子支持
ops/onnxruntime.md
ops/tensorrt.md
ops/ncnn.md
.. toctree::
:maxdepth: 1
:caption: 常见问题
faq.md
.. toctree::
:maxdepth: 1
:caption: API 文档
api.rst
Indices and tables
==================
* :ref:`genindex`
* :ref:`search`

35
docs_zh_CN/make.bat Normal file
View File

@ -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%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd

1
docs_zh_CN/ops/ncnn.md Normal file
View File

@ -0,0 +1 @@
## ncnn 算子

View File

@ -0,0 +1 @@
## ONNX Runtime 算子

View File

@ -0,0 +1 @@
## TensorRT 算子

View File

@ -0,0 +1 @@
## 如何转换模型

View File

@ -0,0 +1 @@
## 如何设置config文件

View File

@ -0,0 +1 @@
## 如何添加新模型支持

View File

@ -0,0 +1 @@
## 如何测试模型精度

10
requirements/docs.txt Normal file
View File

@ -0,0 +1,10 @@
docutils==0.16.0
m2r
myst-parser
opencv-python
-e git+https://github.com/open-mmlab/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
recommonmark
sphinx==4.0.2
sphinx-copybutton
sphinx_markdown_tables
torch