Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions FastDeploy.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ endif()

if (ENABLE_TEXT)
# Add dependency libs later
find_library(FASTER_TOKENIZER_LIB core_tokenizers ${CMAKE_CURRENT_LIST_DIR}/third_libs/install/faster_tokenizer/lib NO_DEFAULT_PATH)
list(APPEND FASTDEPLOY_LIBS ${FASTER_TOKENIZER_LIB})
list(APPEND FASTDEPLOY_INCS ${CMAKE_CURRENT_LIST_DIR}/third_libs/install/faster_tokenizer/include)
list(APPEND FASTDEPLOY_INCS ${CMAKE_CURRENT_LIST_DIR}/third_libs/install/faster_tokenizer/third_party/include)
endif()

if(ENABLE_PADDLE_FRONTEND)
Expand Down
271 changes: 160 additions & 111 deletions README.md

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions csrc/fastdeploy/core/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@
#cmakedefine ENABLE_VISION
#endif

#ifndef ENABLE_TEXT
#cmakedefine ENABLE_TEXT
#endif

#ifndef ENABLE_OPENCV_CUDA
#cmakedefine ENABLE_OPENCV_CUDA
#endif

#ifndef ENABLE_VISION_VISUALIZE
#cmakedefine ENABLE_VISION_VISUALIZE
#endif

#ifndef ENABLE_FDTENSOR_FUNC
#cmakedefine ENABLE_FDTENSOR_FUNC
#endif
2 changes: 1 addition & 1 deletion csrc/fastdeploy/vision/segmentation/ppseg/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ PaddleSegModel::PaddleSegModel(const std::string& model_file,
const Frontend& model_format) {
config_file_ = config_file;
valid_cpu_backends = {Backend::PDINFER, Backend::ORT};
valid_gpu_backends = {Backend::PDINFER, Backend::ORT};
valid_gpu_backends = {Backend::PDINFER, Backend::ORT, Backend::TRT};
runtime_option = custom_option;
runtime_option.model_format = model_format;
runtime_option.model_file = model_file;
Expand Down
5 changes: 3 additions & 2 deletions docs/api/vision_results/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ FastDeploy根据视觉模型的任务类型,定义了不同的结构体(`csrcs
| :----- | :--- | :---- | :------- |
| ClassificationResult | [C++/Python文档](./classification_result.md) | 图像分类返回结果 | ResNet50、MobileNetV3等 |
| DetectionResult | [C++/Python文档](./detection_result.md) | 目标检测返回结果 | PPYOLOE、YOLOv7系列模型等 |
| FaceDetectionResult | [C++/Python文档](./face_detection_result.md) | 目标检测返回结果 | PPYOLOE、YOLOv7系列模型等 |
| MattingResult | [C++/Python文档](./matting_result.md) | 目标检测返回结果 | PPYOLOE、YOLOv7系列模型等 |
| FaceDetectionResult | [C++/Python文档](./face_detection_result.md) | 目标检测返回结果 | SCRFD、RetinaFace系列模型等 |
| FaceRecognitionResult | [C++/Python文档](./face_recognition_result.md) | 目标检测返回结果 | ArcFace、CosFace系列模型等 |
| MattingResult | [C++/Python文档](./matting_result.md) | 目标检测返回结果 | MODNet系列模型等 |
4 changes: 2 additions & 2 deletions docs/api/vision_results/classification_result.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

ClassifyResult代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明图像的分类结果和置信度。

## C++ 结构体
## C++ 定义

`fastdeploy::vision::ClassifyResult`

Expand All @@ -20,7 +20,7 @@ struct ClassifyResult {
- **Clear()**: 成员函数,用于清除结构体中存储的结果
- **Str()**: 成员函数,将结构体中的信息以字符串形式输出(用于Debug)

## Python结构体
## Python 定义

`fastdeploy.vision.ClassifyResult`

Expand Down
6 changes: 3 additions & 3 deletions docs/api/vision_results/detection_result.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

DetectionResult代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明图像检测出来的目标框、目标类别和目标置信度。

## C++ 结构体
## C++ 定义

`fastdeploy::vision::DetectionResult`

Expand All @@ -22,10 +22,10 @@ struct DetectionResult {
- **Clear()**: 成员函数,用于清除结构体中存储的结果
- **Str()**: 成员函数,将结构体中的信息以字符串形式输出(用于Debug)

## Python结构体
## Python 定义

`fastdeploy.vision.DetectionResult`

- **boxes**(list of list(float)): 成员变量,表示单张图片检测出来的所有目标框坐标。boxes是一个list,其每个元素为一个长度为4的list, 表示为一个框,每个框以4个float数值依次表示xmin, ymin, xmax, ymax, 即左上角和右下角坐标
- **scores**(list of float): 成员变量,表示单张图片检测出来的所有目标置信度
- **label_ids(list of int): 成员变量,表示单张图片检测出来的所有目标类别
- **label_ids**(list of int): 成员变量,表示单张图片检测出来的所有目标类别
11 changes: 6 additions & 5 deletions docs/api/vision_results/face_detection_result.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# FaceDetectionResult 人脸检测结果

FaceDetectionResult 代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明图像检测出来的目标框、目标类别和目标置信度
FaceDetectionResult 代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明人脸检测出来的目标框、人脸landmarks,目标置信度和每张人脸的landmark数量

## C++ 结构体
## C++ 定义

`fastdeploy::vision::FaceDetectionResult`

Expand All @@ -11,7 +11,6 @@ struct FaceDetectionResult {
std::vector<std::array<float, 4>> boxes;
std::vector<std::array<float, 2>> landmarks;
std::vector<float> scores;
ResultType type = ResultType::FACE_DETECTION;
int landmarks_per_face;
void Clear();
std::string Str();
Expand All @@ -25,10 +24,12 @@ struct FaceDetectionResult {
- **Clear()**: 成员函数,用于清除结构体中存储的结果
- **Str()**: 成员函数,将结构体中的信息以字符串形式输出(用于Debug)

## Python结构体
## Python 定义

`fastdeploy.vision.FaceDetectionResult`

- **boxes**(list of list(float)): 成员变量,表示单张图片检测出来的所有目标框坐标。boxes是一个list,其每个元素为一个长度为4的list, 表示为一个框,每个框以4个float数值依次表示xmin, ymin, xmax, ymax, 即左上角和右下角坐标
- **scores**(list of float): 成员变量,表示单张图片检测出来的所有目标置信度
- **landmarks**: 成员变量,表示单张图片检测出来的所有人脸的关键点
- **landmarks**(list of list(float)): 成员变量,表示单张图片检测出来的所有人脸的关键点
- **landmarks_per_face**(int): 成员变量,表示每个人脸框中的关键点的数量。

24 changes: 24 additions & 0 deletions docs/api/vision_results/face_recognition_result.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# FaceRecognitionResult 人脸识别结果

FaceRecognitionResult 代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明人脸识别模型对图像特征的embedding。
## C++ 定义

`fastdeploy::vision::FaceRecognitionResult`

```
struct FaceRecognitionResult {
std::vector<float> embedding;
void Clear();
std::string Str();
};
```

- **embedding**: 成员变量,表示人脸识别模型最终的提取的特征embedding,可以用来计算人脸之间的特征相似度。
- **Clear()**: 成员函数,用于清除结构体中存储的结果
- **Str()**: 成员函数,将结构体中的信息以字符串形式输出(用于Debug)

## Python 定义

`fastdeploy.vision.FaceRecognitionResult`

- **embedding**(list of float): 成员变量,表示人脸识别模型最终提取的特征embedding,可以用来计算人脸之间的特征相似度。
18 changes: 9 additions & 9 deletions docs/api/vision_results/matting_result.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# MattingResult 抠图结果

MattingResult 代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明图像检测出来的目标框、目标类别和目标置信度
MattingResult 代码定义在`csrcs/fastdeploy/vision/common/result.h`中,用于表明模型预测的alpha透明度的值,预测的前景等

## C++ 结构体
## C++ 定义

`fastdeploy::vision::MattingResult`

```
struct MattingResult {
std::vector<float> alpha; // h x w
std::vector<float> foreground; // h x w x c (c=3 default)
std::vector<float> alpha;
std::vector<float> foreground;
std::vector<int64_t> shape;
bool contain_foreground = false;
void Clear();
Expand All @@ -25,11 +25,11 @@ struct MattingResult {
- **Str()**: 成员函数,将结构体中的信息以字符串形式输出(用于Debug)


## Python结构体
## Python 定义

`fastdeploy.vision.MattingResult`

- **alpha**: 是一维向量,为预测的alpha透明度的值,值域为[0.,1.],长度为hxw,h,w为输入图像的高和宽
- **foreground**: 是一维向量,为预测的前景,值域为[0.,255.],长度为hxwxc,h,w为输入图像的高和宽,c一般为3,foreground不是一定有的,只有模型本身预测了前景,这个属性才会有效
- **contain_foreground**: 表示预测的结果是否包含前景
- **shape**: 表示输出结果的shape,当contain_foreground为false,shape只包含(h,w),当contain_foreground为true,shape包含(h,w,c), c一般为3
- **alpha**(list of float): 是一维向量,为预测的alpha透明度的值,值域为[0.,1.],长度为hxw,h,w为输入图像的高和宽
- **foreground**(list of float): 是一维向量,为预测的前景,值域为[0.,255.],长度为hxwxc,h,w为输入图像的高和宽,c一般为3,foreground不是一定有的,只有模型本身预测了前景,这个属性才会有效
- **contain_foreground**(bool): 表示预测的结果是否包含前景
- **shape**(list of int): 表示输出结果的shape,当contain_foreground为false,shape只包含(h,w),当contain_foreground为true,shape包含(h,w,c), c一般为3
12 changes: 6 additions & 6 deletions docs/compile/prebuilt_libraries.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FastDeploy 预编编译Python Wheel包
# FastDeploy 预编译 C++ 库

FastDeploy提供了在Windows/Linux/Mac上的预先编译CPP部署库,开发者可以直接下载后使用,也可以自行编译代码。

Expand All @@ -19,17 +19,17 @@ FastDeploy提供了在Windows/Linux/Mac上的预先编译CPP部署库,开发

### Windows 10 x64平台

| 部署库下载地址 | 硬件 |
| :------------- | :--- |
| [comming...] | CPU |
| [comming...] | CPU/GPU |
| 部署库下载地址 | 硬件 | 说明 |
| :------------- | :--- | :--- |
| [fastdeploy-win-x64-0.2.0](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-win-x64-0.2.0.zip) | CPU | Visual Studio 16 2019 编译产出 |
| [fastdeploy-win-x64-gpu-0.2.0](https://bj.bcebos.com/paddlehub/fastdeploy/cpp/fastdeploy-win-x64-gpu-0.2.0.zip) | CPU/GPU | Visual Studio 16 2019,cuda 11.2, cudnn 8.2编译产出 |

### Linux aarch64平台

| 安装包 | 硬件 |
| :---- | :-- |
| [comming...] | CPU |
| [comming...] | Jetson |
| [comming...] | Jetson |

### Mac OSX平台

Expand Down
11 changes: 8 additions & 3 deletions docs/compile/prebuilt_wheels.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,20 @@ python -m pip install fastdeploy_python-0.2.0-cp38-cp38-manylinux1_x86_64.whl

| CPU 安装包 | 硬件 | Python版本 |
| :---- | :-- | :------ |
| [comming...] | CPU | 3.8 |
| [comming...] | CPU | 3.9 |
| [fastdeploy_python-0.2.0-cp38-cp38-win_amd64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp38-cp38-win_amd64.whl) | CPU | 3.8 |
| [fastdeploy_python-0.2.0-cp39-cp39-win_amd64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_python-0.2.0-cp39-cp39-win_amd64.whl) | CPU | 3.9 |

| GPU 安装包 | 硬件 | Python版本 |
| :---- | :-- | :------ |
| [fastdeploy_gpu_python-0.2.0-cp38-cp38-win_amd64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_gpu_python-0.2.0-cp38-cp38-win_amd64.whl) | CPU/GPU | 3.8 |
| [fastdeploy_gpu_python-0.2.0-cp39-cp39-win_amd64.whl](https://bj.bcebos.com/paddlehub/fastdeploy/wheels/fastdeploy_gpu_python-0.2.0-cp39-cp39-win_amd64.whl) | CPU/GPU | 3.9 |

### Linux aarch64平台

| 安装包 | 硬件 | Python版本 |
| :---- | :-- | :------ |
| [comming...] | CPU | 3.7 |
| [comming...] | CPU | 3.8 |
| [comming...] | CPU | 3.8 |
| [comming...] | CPU | 3.9 |

### Mac OSX平台
Expand Down
Binary file added docs/logo/fastdeploy-opaque.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions examples/text/information_extraction/ernie/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PROJECT(infer_demo C CXX)
CMAKE_MINIMUM_REQUIRED (VERSION 3.12)

option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")

include(${FASTDEPLOY_INSTALL_DIR}/FastDeploy.cmake)

include_directories(${FASTDEPLOY_INCS})

add_executable(infer_ernie_demo ${PROJECT_SOURCE_DIR}/infer.cc)
target_link_libraries(infer_ernie_demo ${FASTDEPLOY_LIBS})
Loading