mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
Add Sdk Doxygen document. (#2157)
* doxygen c api * fix ci * update en doc * update zh doc
This commit is contained in:
parent
a8775d2cf1
commit
264de4ddbc
3
.gitignore
vendored
3
.gitignore
vendored
@ -169,3 +169,6 @@ csrc/mmdeploy/preprocess/elena/cuda_kernel/*
|
||||
|
||||
# c#
|
||||
demo/csharp/*/Properties
|
||||
|
||||
# doxygen
|
||||
docs/cppapi/docs
|
||||
|
2817
docs/cppapi/Doxyfile
Normal file
2817
docs/cppapi/Doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,7 @@
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pytorch_sphinx_theme
|
||||
@ -48,6 +49,7 @@ release = __version__
|
||||
# ones.
|
||||
|
||||
extensions = [
|
||||
'breathe',
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.napoleon',
|
||||
'sphinx.ext.viewcode',
|
||||
@ -58,6 +60,20 @@ extensions = [
|
||||
'sphinxcontrib.mermaid'
|
||||
] # yapf: disable
|
||||
|
||||
breathe_default_project = 'mmdeployapi'
|
||||
breathe_projects = {'mmdeployapi': '../cppapi/docs/xml'}
|
||||
|
||||
|
||||
def generate_doxygen_xml(app):
|
||||
try:
|
||||
folder = '../cppapi'
|
||||
retcode = subprocess.call('cd %s; doxygen' % folder, shell=True)
|
||||
if retcode < 0:
|
||||
sys.stderr.write('doxygen terminated by signal %s' % (-retcode))
|
||||
except Exception as e:
|
||||
sys.stderr.write('doxygen execution failed: %s' % e)
|
||||
|
||||
|
||||
autodoc_mock_imports = ['tensorrt']
|
||||
|
||||
autosectionlabel_prefix_document = True
|
||||
@ -211,6 +227,8 @@ copybutton_prompt_is_regexp = True
|
||||
|
||||
|
||||
def setup(app):
|
||||
# Add hook for building doxygen xml when needed
|
||||
app.connect('builder-inited', generate_doxygen_xml)
|
||||
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')
|
||||
|
@ -28,6 +28,12 @@ You can switch between Chinese and English documents in the lower-left corner of
|
||||
02-how-to-run/quantize_model.md
|
||||
02-how-to-run/useful_tools.md
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: SDK Usage
|
||||
|
||||
sdk_usage/index.rst
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Benchmark
|
||||
|
30
docs/en/sdk_usage/c/classifier.rst
Normal file
30
docs/en/sdk_usage/c/classifier.rst
Normal file
@ -0,0 +1,30 @@
|
||||
====================
|
||||
classifier.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_classification_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_classifier_t
|
||||
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_get_result
|
52
docs/en/sdk_usage/c/common.rst
Normal file
52
docs/en/sdk_usage/c/common.rst
Normal file
@ -0,0 +1,52 @@
|
||||
====================
|
||||
common.h
|
||||
====================
|
||||
|
||||
|
||||
.. doxygenenum:: mmdeploy_pixel_format_t
|
||||
|
||||
.. doxygenenum:: mmdeploy_data_type_t
|
||||
|
||||
.. doxygenenum:: mmdeploy_status_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_device_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_profiler_t
|
||||
|
||||
.. doxygenstruct:: mmdeploy_mat_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_rect_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_point_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_value_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_context_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_value_copy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_value_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_device_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_device_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_profiler_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_profiler_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_create_by_device
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_add
|
||||
|
||||
.. doxygenfunction:: mmdeploy_common_create_input
|
33
docs/en/sdk_usage/c/detector.rst
Normal file
33
docs/en/sdk_usage/c/detector.rst
Normal file
@ -0,0 +1,33 @@
|
||||
====================
|
||||
detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_instance_mask_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_get_result
|
59
docs/en/sdk_usage/c/executor.rst
Normal file
59
docs/en/sdk_usage/c/executor.rst
Normal file
@ -0,0 +1,59 @@
|
||||
====================
|
||||
executor.h
|
||||
====================
|
||||
|
||||
.. doxygentypedef:: mmdeploy_then_fn_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_then_fn_v2_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_then_fn_v3_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_sender_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_scheduler_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_let_value_fn_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_inline
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_system_pool
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_create_thread_pool
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_create_thread
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_dynamic_batch
|
||||
|
||||
.. doxygenfunction:: mmdeploy_scheduler_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_sender_copy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_sender_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_just
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_schedule
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_transfer_just
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_transfer
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_on
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_then
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_let_value
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_split
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_when_all
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_ensure_started
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_start_detached
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_sync_wait
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_sync_wait_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_execute
|
11
docs/en/sdk_usage/c/model.rst
Normal file
11
docs/en/sdk_usage/c/model.rst
Normal file
@ -0,0 +1,11 @@
|
||||
====================
|
||||
model.h
|
||||
====================
|
||||
|
||||
.. doxygentypedef:: mmdeploy_model_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_model_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_model_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_model_destroy
|
16
docs/en/sdk_usage/c/pipeline.rst
Normal file
16
docs/en/sdk_usage/c/pipeline.rst
Normal file
@ -0,0 +1,16 @@
|
||||
====================
|
||||
pipeline.h
|
||||
====================
|
||||
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pipeline_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_create_v3
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_create_from_model
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_destroy
|
31
docs/en/sdk_usage/c/pose_detector.rst
Normal file
31
docs/en/sdk_usage/c/pose_detector.rst
Normal file
@ -0,0 +1,31 @@
|
||||
====================
|
||||
pose_detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_pose_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pose_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply_bbox
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_get_result
|
29
docs/en/sdk_usage/c/pose_tracker.rst
Normal file
29
docs/en/sdk_usage/c/pose_tracker.rst
Normal file
@ -0,0 +1,29 @@
|
||||
====================
|
||||
pose_tracker.h
|
||||
====================
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pose_tracker_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pose_tracker_state_t
|
||||
|
||||
.. doxygenstruct:: mmdeploy_pose_tracker_param_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_pose_tracker_target_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_default_params
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_create_state
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_destroy_state
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_release_result
|
29
docs/en/sdk_usage/c/rotated_detector.rst
Normal file
29
docs/en/sdk_usage/c/rotated_detector.rst
Normal file
@ -0,0 +1,29 @@
|
||||
====================
|
||||
rotated_detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_rotated_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_rotated_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_get_result
|
29
docs/en/sdk_usage/c/segmentor.rst
Normal file
29
docs/en/sdk_usage/c/segmentor.rst
Normal file
@ -0,0 +1,29 @@
|
||||
====================
|
||||
segmentor.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_segmentation_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_segmentor_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_get_result
|
35
docs/en/sdk_usage/c/text_detector.rst
Normal file
35
docs/en/sdk_usage/c/text_detector.rst
Normal file
@ -0,0 +1,35 @@
|
||||
====================
|
||||
text_detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_text_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_text_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_get_result
|
||||
|
||||
.. doxygentypedef:: mmdeploy_text_detector_continue_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply_async_v3
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_continue_async
|
35
docs/en/sdk_usage/c/text_recognizer.rst
Normal file
35
docs/en/sdk_usage/c/text_recognizer.rst
Normal file
@ -0,0 +1,35 @@
|
||||
====================
|
||||
text_recognizer.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_text_recognition_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_text_recognizer_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_bbox
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_async_v3
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_continue_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_get_result
|
31
docs/en/sdk_usage/c/video_recognizer.rst
Normal file
31
docs/en/sdk_usage/c/video_recognizer.rst
Normal file
@ -0,0 +1,31 @@
|
||||
====================
|
||||
video_recognizer.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_video_recognition_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_video_sample_info_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_video_recognizer_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_get_result
|
21
docs/en/sdk_usage/c_api.rst
Normal file
21
docs/en/sdk_usage/c_api.rst
Normal file
@ -0,0 +1,21 @@
|
||||
====================
|
||||
C API Reference
|
||||
====================
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
c/common
|
||||
c/executor
|
||||
c/model
|
||||
c/pipeline
|
||||
c/classifier
|
||||
c/detector
|
||||
c/pose_detector
|
||||
c/pose_tracker
|
||||
c/rotated_detector
|
||||
c/segmentor
|
||||
c/text_detector
|
||||
c/text_recognizer
|
||||
c/video_recognizer
|
18
docs/en/sdk_usage/index.rst
Normal file
18
docs/en/sdk_usage/index.rst
Normal file
@ -0,0 +1,18 @@
|
||||
========================
|
||||
SDK Documentation
|
||||
========================
|
||||
|
||||
Setup & Usage
|
||||
--------------
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
quick_start
|
||||
|
||||
|
||||
API Reference
|
||||
--------------
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
c_api
|
83
docs/en/sdk_usage/quick_start.md
Normal file
83
docs/en/sdk_usage/quick_start.md
Normal file
@ -0,0 +1,83 @@
|
||||
# Quick Start
|
||||
|
||||
In terms of model deployment, most ML models require some preprocessing steps on the input data and postprocessing steps on the output to get structured output. MMDeploy sdk provides a lot of pre-processing and post-processing process. When you convert and deploy a model, you can enjoy the convenience brought by mmdeploy sdk.
|
||||
|
||||
## Model Conversion
|
||||
|
||||
You can refer to [convert model](../02-how-to-run/convert_model.md) for more details.
|
||||
|
||||
After model conversion with `--dump-info`, the structure of model directory (tensorrt model) is as follows. If you convert to other backend, the structure will be slightly different. The two images are for quick conversion validation.
|
||||
|
||||
```bash
|
||||
├── deploy.json
|
||||
├── detail.json
|
||||
├── pipeline.json
|
||||
├── end2end.onnx
|
||||
├── end2end.engine
|
||||
├── output_pytorch.jpg
|
||||
└── output_tensorrt.jpg
|
||||
```
|
||||
|
||||
The files related to sdk are:
|
||||
|
||||
- deploy.json // model information.
|
||||
- pipeline.json // inference information.
|
||||
- end2end.engine // model file for tensort, will be different for other backends.
|
||||
|
||||
SDK can read the model directory directly or you can pack the related files to zip archive for better distribution or encryption. To read the zip file, the sdk should build with `-DMMDEPLOY_ZIP_MODEL=ON`
|
||||
|
||||
## SDK Inference
|
||||
|
||||
Generally speaking, there are three steps to inference a model.
|
||||
|
||||
- Create a pipeline
|
||||
- Load the data
|
||||
- Model inference
|
||||
|
||||
We use `classifier` as an example to show these three steps.
|
||||
|
||||
### Create a pipeline
|
||||
|
||||
#### Load model from disk
|
||||
|
||||
```cpp
|
||||
|
||||
std::string model_path = "/data/resnet"; // or "/data/resnet.zip" if build with `-DMMDEPLOY_ZIP_MODEL=ON`
|
||||
mmdeploy_model_t model;
|
||||
mmdeploy_model_create_by_path(model_path, &model);
|
||||
|
||||
mmdeploy_classifier_t classifier{};
|
||||
mmdeploy_classifier_create(model, "cpu", 0, &classifier);
|
||||
```
|
||||
|
||||
#### Load model from memory
|
||||
|
||||
```cpp
|
||||
std::string model_path = "/data/resnet.zip"
|
||||
std::ifstream ifs(model_path, std::ios::binary); // /path/to/zipmodel
|
||||
ifs.seekg(0, std::ios::end);
|
||||
auto size = ifs.tellg();
|
||||
ifs.seekg(0, std::ios::beg);
|
||||
std::string str(size, '\0'); // binary data, should decrypt if it's encrypted
|
||||
ifs.read(str.data(), size);
|
||||
|
||||
mmdeploy_model_t model;
|
||||
mmdeploy_model_create(str.data(), size, &model);
|
||||
|
||||
mmdeploy_classifier_t classifier{};
|
||||
mmdeploy_classifier_create(model, "cpu", 0, &classifier);
|
||||
```
|
||||
|
||||
### Load the data
|
||||
|
||||
```cpp
|
||||
cv::Mat img = cv::imread(image_path);
|
||||
```
|
||||
|
||||
### Model inference
|
||||
|
||||
```cpp
|
||||
mmdeploy_classification_t* res{};
|
||||
int* res_count{};
|
||||
mmdeploy_classifier_apply(classifier, &mat, 1, &res, &res_count);
|
||||
```
|
@ -12,6 +12,7 @@
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import pytorch_sphinx_theme
|
||||
@ -48,6 +49,7 @@ release = __version__
|
||||
# ones.
|
||||
|
||||
extensions = [
|
||||
'breathe',
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.doctest',
|
||||
'sphinx.ext.napoleon',
|
||||
@ -58,6 +60,19 @@ extensions = [
|
||||
'sphinx_copybutton',
|
||||
'sphinxcontrib.mermaid'
|
||||
] # yapf: disable
|
||||
breathe_default_project = 'mmdeployapi'
|
||||
breathe_projects = {'mmdeployapi': '../cppapi/docs/xml'}
|
||||
|
||||
|
||||
def generate_doxygen_xml(app):
|
||||
try:
|
||||
folder = '../cppapi'
|
||||
retcode = subprocess.call('cd %s; doxygen' % folder, shell=True)
|
||||
if retcode < 0:
|
||||
sys.stderr.write('doxygen terminated by signal %s' % (-retcode))
|
||||
except Exception as e:
|
||||
sys.stderr.write('doxygen execution failed: %s' % e)
|
||||
|
||||
|
||||
autodoc_mock_imports = ['tensorrt']
|
||||
|
||||
@ -212,6 +227,8 @@ copybutton_prompt_is_regexp = True
|
||||
|
||||
|
||||
def setup(app):
|
||||
# Add hook for building doxygen xml when needed
|
||||
app.connect('builder-inited', generate_doxygen_xml)
|
||||
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')
|
||||
|
@ -28,6 +28,12 @@
|
||||
02-how-to-run/quantize_model.md
|
||||
02-how-to-run/useful_tools.md
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: SDK 使用
|
||||
|
||||
sdk_usage/index.rst
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Benchmark
|
||||
|
30
docs/zh_cn/sdk_usage/c/classifier.rst
Normal file
30
docs/zh_cn/sdk_usage/c/classifier.rst
Normal file
@ -0,0 +1,30 @@
|
||||
====================
|
||||
classifier.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_classification_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_classifier_t
|
||||
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_classifier_get_result
|
52
docs/zh_cn/sdk_usage/c/common.rst
Normal file
52
docs/zh_cn/sdk_usage/c/common.rst
Normal file
@ -0,0 +1,52 @@
|
||||
====================
|
||||
common.h
|
||||
====================
|
||||
|
||||
|
||||
.. doxygenenum:: mmdeploy_pixel_format_t
|
||||
|
||||
.. doxygenenum:: mmdeploy_data_type_t
|
||||
|
||||
.. doxygenenum:: mmdeploy_status_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_device_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_profiler_t
|
||||
|
||||
.. doxygenstruct:: mmdeploy_mat_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_rect_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_point_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_value_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_context_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_value_copy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_value_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_device_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_device_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_profiler_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_profiler_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_create_by_device
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_context_add
|
||||
|
||||
.. doxygenfunction:: mmdeploy_common_create_input
|
33
docs/zh_cn/sdk_usage/c/detector.rst
Normal file
33
docs/zh_cn/sdk_usage/c/detector.rst
Normal file
@ -0,0 +1,33 @@
|
||||
====================
|
||||
detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_instance_mask_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_detector_get_result
|
59
docs/zh_cn/sdk_usage/c/executor.rst
Normal file
59
docs/zh_cn/sdk_usage/c/executor.rst
Normal file
@ -0,0 +1,59 @@
|
||||
====================
|
||||
executor.h
|
||||
====================
|
||||
|
||||
.. doxygentypedef:: mmdeploy_then_fn_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_then_fn_v2_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_then_fn_v3_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_sender_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_scheduler_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_let_value_fn_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_inline
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_system_pool
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_create_thread_pool
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_create_thread
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_dynamic_batch
|
||||
|
||||
.. doxygenfunction:: mmdeploy_scheduler_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_sender_copy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_sender_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_just
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_schedule
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_transfer_just
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_transfer
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_on
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_then
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_let_value
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_split
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_when_all
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_ensure_started
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_start_detached
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_sync_wait
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_sync_wait_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_executor_execute
|
11
docs/zh_cn/sdk_usage/c/model.rst
Normal file
11
docs/zh_cn/sdk_usage/c/model.rst
Normal file
@ -0,0 +1,11 @@
|
||||
====================
|
||||
model.h
|
||||
====================
|
||||
|
||||
.. doxygentypedef:: mmdeploy_model_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_model_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_model_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_model_destroy
|
16
docs/zh_cn/sdk_usage/c/pipeline.rst
Normal file
16
docs/zh_cn/sdk_usage/c/pipeline.rst
Normal file
@ -0,0 +1,16 @@
|
||||
====================
|
||||
pipeline.h
|
||||
====================
|
||||
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pipeline_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_create_v3
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_create_from_model
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pipeline_destroy
|
31
docs/zh_cn/sdk_usage/c/pose_detector.rst
Normal file
31
docs/zh_cn/sdk_usage/c/pose_detector.rst
Normal file
@ -0,0 +1,31 @@
|
||||
====================
|
||||
pose_detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_pose_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pose_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply_bbox
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_detector_get_result
|
29
docs/zh_cn/sdk_usage/c/pose_tracker.rst
Normal file
29
docs/zh_cn/sdk_usage/c/pose_tracker.rst
Normal file
@ -0,0 +1,29 @@
|
||||
====================
|
||||
pose_tracker.h
|
||||
====================
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pose_tracker_t
|
||||
|
||||
.. doxygentypedef:: mmdeploy_pose_tracker_state_t
|
||||
|
||||
.. doxygenstruct:: mmdeploy_pose_tracker_param_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_pose_tracker_target_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_default_params
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_create_state
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_destroy_state
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_pose_tracker_release_result
|
29
docs/zh_cn/sdk_usage/c/rotated_detector.rst
Normal file
29
docs/zh_cn/sdk_usage/c/rotated_detector.rst
Normal file
@ -0,0 +1,29 @@
|
||||
====================
|
||||
rotated_detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_rotated_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_rotated_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_rotated_detector_get_result
|
29
docs/zh_cn/sdk_usage/c/segmentor.rst
Normal file
29
docs/zh_cn/sdk_usage/c/segmentor.rst
Normal file
@ -0,0 +1,29 @@
|
||||
====================
|
||||
segmentor.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_segmentation_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_segmentor_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_segmentor_get_result
|
35
docs/zh_cn/sdk_usage/c/text_detector.rst
Normal file
35
docs/zh_cn/sdk_usage/c/text_detector.rst
Normal file
@ -0,0 +1,35 @@
|
||||
====================
|
||||
text_detector.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_text_detection_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_text_detector_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_get_result
|
||||
|
||||
.. doxygentypedef:: mmdeploy_text_detector_continue_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_apply_async_v3
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_detector_continue_async
|
35
docs/zh_cn/sdk_usage/c/text_recognizer.rst
Normal file
35
docs/zh_cn/sdk_usage/c/text_recognizer.rst
Normal file
@ -0,0 +1,35 @@
|
||||
====================
|
||||
text_recognizer.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_text_recognition_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_text_recognizer_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_bbox
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_apply_async_v3
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_continue_async
|
||||
|
||||
.. doxygenfunction:: mmdeploy_text_recognizer_get_result
|
31
docs/zh_cn/sdk_usage/c/video_recognizer.rst
Normal file
31
docs/zh_cn/sdk_usage/c/video_recognizer.rst
Normal file
@ -0,0 +1,31 @@
|
||||
====================
|
||||
video_recognizer.h
|
||||
====================
|
||||
|
||||
.. doxygenstruct:: mmdeploy_video_recognition_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygenstruct:: mmdeploy_video_sample_info_t
|
||||
:members:
|
||||
:undoc-members:
|
||||
|
||||
.. doxygentypedef:: mmdeploy_video_recognizer_t
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create_by_path
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_apply
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_release_result
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_destroy
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_create_input
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_apply_v2
|
||||
|
||||
.. doxygenfunction:: mmdeploy_video_recognizer_get_result
|
21
docs/zh_cn/sdk_usage/c_api.rst
Normal file
21
docs/zh_cn/sdk_usage/c_api.rst
Normal file
@ -0,0 +1,21 @@
|
||||
====================
|
||||
C API Reference
|
||||
====================
|
||||
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
c/common
|
||||
c/executor
|
||||
c/model
|
||||
c/pipeline
|
||||
c/classifier
|
||||
c/detector
|
||||
c/pose_detector
|
||||
c/pose_tracker
|
||||
c/rotated_detector
|
||||
c/segmentor
|
||||
c/text_detector
|
||||
c/text_recognizer
|
||||
c/video_recognizer
|
18
docs/zh_cn/sdk_usage/index.rst
Normal file
18
docs/zh_cn/sdk_usage/index.rst
Normal file
@ -0,0 +1,18 @@
|
||||
========================
|
||||
SDK 使用说明
|
||||
========================
|
||||
|
||||
安装 & 使用方法
|
||||
----------------
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
quick_start
|
||||
|
||||
|
||||
API Reference
|
||||
----------------
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
||||
c_api
|
83
docs/zh_cn/sdk_usage/quick_start.md
Normal file
83
docs/zh_cn/sdk_usage/quick_start.md
Normal file
@ -0,0 +1,83 @@
|
||||
# 快速开始
|
||||
|
||||
大多数 ML 模型除了推理外,需要对输入数据进行一些预处理,并对输出进行一些后处理步骤,以获得结构化输出。 MMDeploy sdk 提供了常见的预处理和后处理步骤。 当您使用 MMDeploy 进行模型转换后,您可以直接使用mmdeploy sdk 进行推理。
|
||||
|
||||
## 模型转换
|
||||
|
||||
可参考 [convert model](../02-how-to-run/convert_model.md) 获得更多信息.
|
||||
|
||||
转模型时通过增加 `--dump-info` 参数得到如下的目录结构(tensorrt)。 如果转换为其他后端,结构会略有不同。其中两个图片为不同后端推理结果
|
||||
|
||||
```bash
|
||||
├── deploy.json
|
||||
├── detail.json
|
||||
├── pipeline.json
|
||||
├── end2end.onnx
|
||||
├── end2end.engine
|
||||
├── output_pytorch.jpg
|
||||
└── output_tensorrt.jpg
|
||||
```
|
||||
|
||||
和SDK相关的文件有:
|
||||
|
||||
- deploy.json // 模型信息.
|
||||
- pipeline.json // pipeline信息,包括前处理、模型以及后处理.
|
||||
- end2end.engine // 模型文件
|
||||
|
||||
SDK 可以直接读取模型目录,也可以读取相关文件打包成 zip 压缩包。 要读取 zip 文件,sdk 在编译时要设置 `-DMMDEPLOY_ZIP_MODEL=ON`
|
||||
|
||||
## SDK 推理
|
||||
|
||||
一般来讲,模型推理包含以下三个部分。
|
||||
|
||||
- 创建 pipeline
|
||||
- 读取数据
|
||||
- 模型推理
|
||||
|
||||
以下使用 `classifier` 作为例子来展示三个步骤.
|
||||
|
||||
### 创建 pipeline
|
||||
|
||||
#### 从硬盘中加载模型
|
||||
|
||||
```cpp
|
||||
|
||||
std::string model_path = "/data/resnet"; // or "/data/resnet.zip" if build with `-DMMDEPLOY_ZIP_MODEL=ON`
|
||||
mmdeploy_model_t model;
|
||||
mmdeploy_model_create_by_path(model_path, &model);
|
||||
|
||||
mmdeploy_classifier_t classifier{};
|
||||
mmdeploy_classifier_create(model, "cpu", 0, &classifier);
|
||||
```
|
||||
|
||||
#### 从内存中加载模型
|
||||
|
||||
```cpp
|
||||
std::string model_path = "/data/resnet.zip"
|
||||
std::ifstream ifs(model_path, std::ios::binary); // /path/to/zipmodel
|
||||
ifs.seekg(0, std::ios::end);
|
||||
auto size = ifs.tellg();
|
||||
ifs.seekg(0, std::ios::beg);
|
||||
std::string str(size, '\0'); // binary data, should decrypt if it's encrypted
|
||||
ifs.read(str.data(), size);
|
||||
|
||||
mmdeploy_model_t model;
|
||||
mmdeploy_model_create(str.data(), size, &model);
|
||||
|
||||
mmdeploy_classifier_t classifier{};
|
||||
mmdeploy_classifier_create(model, "cpu", 0, &classifier);
|
||||
```
|
||||
|
||||
### 读取数据
|
||||
|
||||
```cpp
|
||||
cv::Mat img = cv::imread(image_path);
|
||||
```
|
||||
|
||||
### 模型推理
|
||||
|
||||
```cpp
|
||||
mmdeploy_classification_t* res{};
|
||||
int* res_count{};
|
||||
mmdeploy_classifier_apply(classifier, &mat, 1, &res, &res_count);
|
||||
```
|
@ -1,3 +1,4 @@
|
||||
breathe
|
||||
h5py
|
||||
mmcv
|
||||
mmengine
|
||||
|
Loading…
x
Reference in New Issue
Block a user