Skip to content

Commit

Permalink
[Doc] Add English version of serving/ and java/andriod/. (PaddlePaddl…
Browse files Browse the repository at this point in the history
…e#963)

* 第一次提交

* 补充一处漏翻译

* deleted:    docs/en/quantize.md

* Update one translation

* Update en version

* Update one translation in code

* Standardize one writing

* Standardize one writing

* Update some en version

* Fix a grammer problem

* Update en version for api/vision result

* Merge branch 'develop' of https://github.com/charl-u/FastDeploy into develop

* Checkout the link in README in vision_results/ to the en documents

* Modify a title

* Add link to serving/docs/

* Finish translation of demo.md

* Update english version of serving/docs/

* Update title of readme

* Update some links

* Modify a title

* Update some links

* Update en version of java android README

* Modify some titles

* Modify some titles

* Modify some titles
  • Loading branch information
charl-u authored Dec 24, 2022
1 parent 1e36856 commit b7d2c0d
Show file tree
Hide file tree
Showing 18 changed files with 1,615 additions and 367 deletions.
1 change: 0 additions & 1 deletion docs/README.md

This file was deleted.

47 changes: 47 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[简体中文](README_CN.md)| English

# Tutorials

## Install

- [Install FastDeploy Prebuilt Libraries](en/build_and_install/download_prebuilt_libraries.md)
- [Build and Install FastDeploy Library on GPU Platform](en/build_and_install/gpu.md)
- [Build and Install FastDeploy Library on CPU Platform](en/build_and_install/cpu.md)
- [Build and Install FastDeploy Library on IPU Platform](en/build_and_install/ipu.md)
- [Build and Install FastDeploy Library on KunlunXin XPU Platform](en/build_and_install/xpu.md)
- [Build and Install on RV1126 Platform](en/build_and_install/rv1126.md)
- [Build and Install on RK3588 Platform](en/build_and_install/rknpu2.md)
- [Build and Install on A311D Platform](en/build_and_install/a311d.md)
- [Build and Install FastDeploy Library on Nvidia Jetson Platform](en/build_and_install/jetson.md)
- [Build and Install FastDeploy Library on Android Platform](en/build_and_install/android.md)
- [Build and Install FastDeploy Serving Deployment Image](../serving/docs/EN/compile-en.md)

## A Quick Start - Demos

- [Python Deployment Demo](en/quick_start/models/python.md)
- [C++ Deployment Demo](en/quick_start/models/cpp.md)
- [A Quick Start on Runtime Python](en/quick_start/runtime/python.md)
- [A Quick Start on Runtime C++](en/quick_start/runtime/cpp.md)

## API

- [Python API](https://baidu-paddle.github.io/fastdeploy-api/python/html/)
- [C++ API](https://baidu-paddle.github.io/fastdeploy-api/cpp/html/)
- [Android Java API](../java/android)

## Performance Optimization

- [Quantization Acceleration](en/quantize.md)

## Frequent Q&As

- [1. How to Change Inference Backends](en/faq/how_to_change_backend.md)
- [2. How to Use FastDeploy C++ SDK on Windows Platform](en/faq/use_sdk_on_windows.md)
- [3. How to Use FastDeploy C++ SDK on Android Platform](en/faq/use_cpp_sdk_on_android.md)
- [4. Tricks of TensorRT](en/faq/tensorrt_tricks.md)
- [5. How to Develop a New Model](en/faq/develop_a_new_model.md)

## More FastDeploy Deployment Module

- [Deployment AI Model as a Service](../serving)
- [Benchmark Testing](../benchmark)
2 changes: 1 addition & 1 deletion docs/README_CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[English](README_EN.md) | 简体中文
[English](README.md) | 简体中文

# 使用文档

Expand Down
47 changes: 0 additions & 47 deletions docs/README_EN.md

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion docs/api/vision_results/README_CN.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[English](README_EN.md)| 简体中文
[English](README.md)| 简体中文
# 视觉模型预测结果说明

FastDeploy根据视觉模型的任务类型,定义了不同的结构体(`fastdeploy/vision/common/result.h`)来表达模型预测结果,具体如下表所示
Expand Down
2 changes: 1 addition & 1 deletion docs/api/vision_results/matting_result_EN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
English | [中文](matting_result.md)

# MattingResult keying results
# Matting Result

The MattingResult code is defined in `fastdeploy/vision/common/result.h`, and is used to indicate the predicted value of alpha transparency predicted and the predicted foreground, etc.

Expand Down
31 changes: 16 additions & 15 deletions docs/en/faq/develop_a_new_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ English | [中文](../../cn/faq/develop_a_new_model.md)

| Step | Description | Create or modify the files |
|:-----------:|:--------------------------------------------------------------------------------:|:-----------------------------------------:|
| [1](#step2) | Add a model implementation to the corresponding task module in FastDeploy/vision | resnet.hresnet.ccvision.h |
| [2](#step4) | Python interface binding via pybind | resnet_pybind.ccclassification_pybind.cc |
| [3](#step5) | Use Python to call Interface | resnet.py\_\_init\_\_.py |
| [1](#step2) | Add a model implementation to the corresponding task module in FastDeploy/vision | resnet.h, resnet.cc, vision.h |
| [2](#step4) | Python interface binding via pybind | resnet_pybind.cc, classification_pybind.cc |
| [3](#step5) | Use Python to call Interface | resnet.py, \_\_init\_\_.py |

After completing the above 3 steps, an external model is integrated.

If you want to contribute your code to FastDeploy, it is very kind of you to add test code, instructions (Readme), and code annotations for the added model in the [test](#test).

## Model Integration
## Model Integration <span id="modelsupport"></span>

### Prepare the models <span id="step1"></span>

### Prepare the models

Before integrating external models, it is important to convert the trained models (.pt, .pdparams, etc.) to the model formats (.onnx, .pdmodel) that FastDeploy supports for deployment. Most open source repositories provide model conversion scripts for developers. As torchvision does not provide conversion scripts, developers can write conversion scripts manually. In this demo, we convert `torchvison.models.resnet50` to `resnet50.onnx` with the following code for your reference.

Expand All @@ -40,7 +41,7 @@ torch.onnx.export(model,

Running the above script will generate a`resnet50.onnx` file.

### C++
### C++ <span id="step2"></span>

* Create`resnet.h` file
* Create a path
Expand All @@ -64,7 +65,7 @@ class FASTDEPLOY_DECL ResNet : public FastDeployModel {
* Create a path
* FastDeploy/fastdeploy/vision/classification/contrib/resnet.cc (FastDeploy/C++ code/vision/task name/external model name/model name.cc)
* Create content
* Implement the specific logic of the functions declared in `resnet.h` to `resnet.cc`, where `PreProcess` and `PostProcess` need to refer to the official source library for pre- and post-processing logic reproduction. The specific logic of each ResNet function is as follows. For more detailed code, please refer to [resnet.cc](https:// github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-d229d702de28345253a53f2a5839fd2c638f3d32fffa6a7d04d23db9da13a871).
* Implement the specific logic of the functions declared in `resnet.h` to `resnet.cc`, where `PreProcess` and `PostProcess` need to refer to the official source library for pre- and post-processing logic reproduction. The specific logic of each ResNet function is as follows. For more detailed code, please refer to [resnet.cc](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-d229d702de28345253a53f2a5839fd2c638f3d32fffa6a7d04d23db9da13a871).
```C++
ResNet::ResNet(...) {
Expand Down Expand Up @@ -93,7 +94,7 @@ bool ResNet::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
return true;
}
```

<span id="step3"></span>
* Add new model file to`vision.h`
* modify location
* FastDeploy/fastdeploy/vision.h
Expand All @@ -105,7 +106,7 @@ bool ResNet::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
#endif
```

### Pybind
### Pybind <span id="step4"></span>

* Create Pybind file

Expand Down Expand Up @@ -146,7 +147,7 @@ bool ResNet::Predict(cv::Mat* im, ClassifyResult* result, int topk) {
}
```

### Python
### Python <span id="step5"></span>

* Create`resnet.py`file
* Create path
Expand All @@ -167,7 +168,7 @@ class ResNet(FastDeployModel):
def size(self, wh):
...
```

<span id="step6"></span>
* Import ResNet classes
* modify path
* FastDeploy/python/fastdeploy/vision/classification/\_\_init\_\_.py (FastDeploy/Python code/fastdeploy/vision model/task name/\_\_init\_\_.py)
Expand All @@ -177,7 +178,7 @@ class ResNet(FastDeployModel):
from .contrib.resnet import ResNet
```

## Test
## Test <span id="test"></span>

### Compile

Expand Down Expand Up @@ -229,7 +230,7 @@ pip install fastdeploy_gpu_python-Version number-cpxx-cpxxm-system architecture.
```

* C++
* Write CmakeLists、C++ code and README.md . Please refer to[cpp/](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-afcbe607b796509581f89e38b84190717f1eeda2df0419a2ac9034197ead5f96)
* Write CmakeLists、C++ code and README.md . Please refer to [cpp/](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-afcbe607b796509581f89e38b84190717f1eeda2df0419a2ac9034197ead5f96)
* Compile infer.cc
* Path:FastDeploy/examples/vision/classification/resnet/cpp/

Expand All @@ -240,7 +241,7 @@ make
```

* Python
* Please refer to[python/](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-5a0d6be8c603a8b81454ac14c17fb93555288d9adf92bbe40454449309700135) for Python code and Readme.md
* Please refer to [python/](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-5a0d6be8c603a8b81454ac14c17fb93555288d9adf92bbe40454449309700135) for Python code and Readme.md

### Annotate the Code

Expand All @@ -249,7 +250,7 @@ make
To make the code clear for understanding, developers can annotate the newly-added code.

- C++ code
Developers need to add annotations for functions and variables in the resnet.h file, there are three annotating methods as follows, please refer to [resnet.h](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff- 69128489e918f305c208476ba793d8167e77de2aa7cadf5dcbac30da448bd28e) for more details.
Developers need to add annotations for functions and variables in the resnet.h file, there are three annotating methods as follows, please refer to [resnet.h](https://github.com/PaddlePaddle/FastDeploy/pull/347/files#diff-69128489e918f305c208476ba793d8167e77de2aa7cadf5dcbac30da448bd28e) for more details.

```C++
/** \brief Predict for the input "im", the result will be saved in "result".
Expand Down
6 changes: 3 additions & 3 deletions docs/en/faq/use_sdk_on_windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ In particular, for the configuration method of the dependency library required b

### 3.2 SDK usage method 2: Visual Studio 2019 creates sln project using C++ SDK

This section is for non-CMake users and describes how to create a sln project in Visual Studio 2019 to use FastDeploy C++ SDK. CMake users please read the next section directly. In addition, this section is a special thanks to "Awake to the Southern Sky" for his tutorial on FastDeploy: [How to deploy PaddleDetection target detection model on Windows using FastDeploy C++].(https://www.bilibili.com/read/cv18807232)
This section is for non-CMake users and describes how to create a sln project in Visual Studio 2019 to use FastDeploy C++ SDK. CMake users please read the next section directly. In addition, this section is a special thanks to "Awake to the Southern Sky" for his tutorial on FastDeploy: [How to deploy PaddleDetection target detection model on Windows using FastDeploy C++](https://www.bilibili.com/read/cv18807232).

<div id="VisualStudio2019Sln"></div>

Expand Down Expand Up @@ -192,7 +192,7 @@ Compile successfully, you can see the exe saved in:
D:\qiuyanjun\fastdeploy_test\infer_ppyoloe\x64\Release\infer_ppyoloe.exe
```

(2)Execute the executable file and get the inference result. First you need to copy all the dlls to the directory where the exe is located. At the same time, you also need to download and extract the pyoloe model files and test images, and then copy them to the directory where the exe is located. Special note, the exe needs to run when the dependency library configuration method, please refer to the section: [various methods to configure the exe to run the required dependency library](#CommandLineDeps)
(2)Execute the executable file and get the inference result. First you need to copy all the dlls to the directory where the exe is located. At the same time, you also need to download and extract the pyoloe model files and test images, and then copy them to the directory where the exe is located. Special note, the exe needs to run when the dependency library configuration method, please refer to the section: [various methods to configure the exe to run the required dependency library](#CommandLineDeps).

![image](https://user-images.githubusercontent.com/31974251/192829545-3ea36bfc-9a54-492b-984b-2d5d39094d47.png)

Expand Down Expand Up @@ -331,7 +331,7 @@ Open the saved image to view the visualization results at:
<img src="https://user-images.githubusercontent.com/19339784/184326520-7075e907-10ed-4fad-93f8-52d0e35d4964.jpg", width=480px, height=320px />
</div>

Special note, the exe needs to run when the dependency library configuration method, please refer to the section: [a variety of methods to configure the exe to run the required dependency library](#CommandLineDeps)
Special note, the exe needs to run when the dependency library configuration method, please refer to the section: [a variety of methods to configure the exe to run the required dependency library](#CommandLineDeps).

## 4. Multiple methods to Configure the Required Dependencies for the Exe Runtime
<div id="CommandLineDeps"></div>
Expand Down
Loading

0 comments on commit b7d2c0d

Please sign in to comment.