Skip to content

Commit 7150e64

Browse files
wjj19950828jiangjiajunDefTruth
authored
[Model] Add FSANet model (#448)
* add yolov5cls * fixed bugs * fixed bugs * fixed preprocess bug * add yolov5cls readme * deal with comments * Add YOLOv5Cls Note * add yolov5cls test * add rvm support * support rvm model * add rvm demo * fixed bugs * add rvm readme * add TRT support * add trt support * add rvm test * add EXPORT.md * rename export.md * rm poros doxyen * deal with comments * deal with comments * add rvm video_mode note * add fsanet * fixed bug * update readme * fixed for ci * deal with comments * deal with comments * deal with comments Co-authored-by: Jason <[email protected]> Co-authored-by: DefTruth <[email protected]>
1 parent ce828ec commit 7150e64

File tree

31 files changed

+922
-22
lines changed

31 files changed

+922
-22
lines changed

docs/api/vision_results/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ FastDeploy根据视觉模型的任务类型,定义了不同的结构体(`fastd
1414
| MattingResult | [C++/Python文档](./matting_result.md) | 图片/视频抠图返回结果 | MODNet、RVM系列模型等 |
1515
| OCRResult | [C++/Python文档](./ocr_result.md) | 文本框检测,分类和文本识别返回结果 | OCR系列模型等 |
1616
| MOTResult | [C++/Python文档](./mot_result.md) | 多目标跟踪返回结果 | pptracking系列模型等 |
17+
| HeadPoseResult | [C++/Python文档](./headpose_result.md) | 头部姿态估计返回结果 | FSANet系列模型等 |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# HeadPoseResult 头部姿态结果
2+
3+
HeadPoseResult 代码定义在`fastdeploy/vision/common/result.h`中,用于表明头部姿态结果。
4+
5+
## C++ 定义
6+
7+
`fastdeploy::vision::HeadPoseResult`
8+
9+
```c++
10+
struct HeadPoseResult {
11+
std::vector<float> euler_angles;
12+
void Clear();
13+
std::string Str();
14+
};
15+
```
16+
17+
- **euler_angles**: 成员变量,表示单张人脸图片预测的欧拉角,存放的顺序是(yaw, pitch, roll), yaw 代表水平转角,pitch 代表垂直角,roll 代表翻滚角,值域都为 [-90,+90]度
18+
- **Clear()**: 成员函数,用于清除结构体中存储的结果
19+
- **Str()**: 成员函数,将结构体中的信息以字符串形式输出(用于Debug)
20+
21+
## Python 定义
22+
23+
`fastdeploy.vision.HeadPoseResult`
24+
25+
- **euler_angles**(list of float): 成员变量,表示单张人脸图片预测的欧拉角,存放的顺序是(yaw, pitch, roll), yaw 代表水平转角,pitch 代表垂直角,roll 代表翻滚角,值域都为 [-90,+90]度

examples/CMakeLists.txt

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ function(add_fastdeploy_executable FIELD CC_FILE)
4949
add_executable(${TEMP_TARGET_NAME} ${TEMP_TARGET_FILE})
5050
target_link_libraries(${TEMP_TARGET_NAME} PUBLIC fastdeploy)
5151
if(TARGET gflags)
52-
if(NOT ANDROID)
52+
if(UNIX)
5353
target_link_libraries(${TEMP_TARGET_NAME} PRIVATE gflags pthread)
5454
else()
5555
target_link_libraries(${TEMP_TARGET_NAME} PRIVATE gflags)

examples/vision/README.md

100644100755
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
本目录下提供了各类视觉模型的部署,主要涵盖以下任务类型
44

5-
| 任务类型 | 说明 | 预测结果结构体 |
6-
|:------------------|:------------------------------------------------|:-------------------------------------------------------------------------------------|
7-
| Detection | 目标检测,输入图像,检测图像中物体位置,并返回检测框坐标及类别和置信度 | [DetectionResult](../../docs/api/vision_results/detection_result.md) |
8-
| Segmentation | 语义分割,输入图像,给出图像中每个像素的分类及置信度 | [SegmentationResult](../../docs/api/vision_results/segmentation_result.md) |
9-
| Classification | 图像分类,输入图像,给出图像的分类结果和置信度 | [ClassifyResult](../../docs/api/vision_results/classification_result.md) |
10-
| FaceDetection | 人脸检测,输入图像,检测图像中人脸位置,并返回检测框坐标及人脸关键点 | [FaceDetectionResult](../../docs/api/vision_results/face_detection_result.md) |
11-
| KeypointDetection | 关键点检测,输入图像,返回图像中人物行为的各个关键点坐标和置信度 | [KeyPointDetectionResult](../../docs/api/vision_results/keypointdetection_result.md) |
12-
| FaceRecognition | 人脸识别,输入图像,返回可用于相似度计算的人脸特征的embedding | [FaceRecognitionResult](../../docs/api/vision_results/face_recognition_result.md) |
13-
| Matting | 抠图,输入图像,返回图片的前景每个像素点的Alpha值 | [MattingResult](../../docs/api/vision_results/matting_result.md) |
14-
| OCR | 文本框检测,分类,文本框内容识别,输入图像,返回文本框坐标,文本框的方向类别以及框内的文本内容 | [OCRResult](../../docs/api/vision_results/ocr_result.md) |
15-
| MOT | 多目标跟踪,输入图像,检测图像中物体位置,并返回检测框坐标,对象id及类别置信度 | [MOTResult](../../docs/api/vision_results/mot_result.md) |
5+
| 任务类型 | 说明 | 预测结果结构体 |
6+
|:-------------- |:----------------------------------- |:-------------------------------------------------------------------------------- |
7+
| Detection | 目标检测,输入图像,检测图像中物体位置,并返回检测框坐标及类别和置信度 | [DetectionResult](../../docs/api/vision_results/detection_result.md) |
8+
| Segmentation | 语义分割,输入图像,给出图像中每个像素的分类及置信度 | [SegmentationResult](../../docs/api/vision_results/segmentation_result.md) |
9+
| Classification | 图像分类,输入图像,给出图像的分类结果和置信度 | [ClassifyResult](../../docs/api/vision_results/classification_result.md) |
10+
| FaceDetection | 人脸检测,输入图像,检测图像中人脸位置,并返回检测框坐标及人脸关键点 | [FaceDetectionResult](../../docs/api/vision_results/face_detection_result.md) |
11+
| FaceAlignment | 人脸对齐(人脸关键点检测),输入图像,返回人脸关键点 | [FaceAlignmentResult](../../docs/api/vision_results/face_alignment_result.md) |
12+
| KeypointDetection | 关键点检测,输入图像,返回图像中人物行为的各个关键点坐标和置信度 | [KeyPointDetectionResult](../../docs/api/vision_results/keypointdetection_result.md) |
13+
| FaceRecognition | 人脸识别,输入图像,返回可用于相似度计算的人脸特征的embedding | [FaceRecognitionResult](../../docs/api/vision_results/face_recognition_result.md) |
14+
| Matting | 抠图,输入图像,返回图片的前景每个像素点的Alpha值 | [MattingResult](../../docs/api/vision_results/matting_result.md) |
15+
| OCR | 文本框检测,分类,文本框内容识别,输入图像,返回文本框坐标,文本框的方向类别以及框内的文本内容 | [OCRResult](../../docs/api/vision_results/ocr_result.md) |
16+
| MOT | 多目标跟踪,输入图像,检测图像中物体位置,并返回检测框坐标,对象id及类别置信度 | [MOTResult](../../docs/api/vision_results/mot_result.md) |
17+
| HeadPose | 头部姿态估计,返回头部欧拉角 | [HeadPoseResult](../../docs/api/vision_results/headpose_result.md) |
1618

1719
## FastDeploy API设计
1820

examples/vision/facealign/pfld/cpp/CMakeLists.txt

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,8 @@ include_directories(${FASTDEPLOY_INCS})
1111

1212
add_executable(infer_demo ${PROJECT_SOURCE_DIR}/infer.cc)
1313
# 添加FastDeploy库依赖
14-
target_link_libraries(infer_demo ${FASTDEPLOY_LIBS} gflags pthread)
14+
if(UNIX)
15+
target_link_libraries(infer_demo ${FASTDEPLOY_LIBS} gflags pthread)
16+
else()
17+
target_link_libraries(infer_demo ${FASTDEPLOY_LIBS} gflags)
18+
endif()

examples/vision/facealign/pfld/python/README.md

100644100755
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ cd FastDeploy/examples/vision/facealign/pfld/python
1616
## 原版ONNX模型
1717
wget https://bj.bcebos.com/paddlehub/fastdeploy/pfld-106-lite.onnx
1818
wget https://bj.bcebos.com/paddlehub/fastdeploy/facealign_input.png
19-
2019
# CPU推理
2120
python infer.py --model pfld-106-lite.onnx --image facealign_input.png --device cpu
2221
# GPU推理

examples/vision/facealign/pfld/python/infer.py

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ def parse_arguments():
1717
parser.add_argument(
1818
"--backend",
1919
type=str,
20-
default="ort",
21-
help="inference backend, ort, ov, trt, paddle, paddle_trt.")
20+
default="default",
21+
help="inference backend, default, ort, ov, trt, paddle, paddle_trt.")
2222
parser.add_argument(
2323
"--enable_trt_fp16",
24-
type=bool,
24+
type=ast.literal_eval,
2525
default=False,
2626
help="whether enable fp16 in trt/paddle_trt backend")
2727
return parser.parse_args()

examples/vision/headpose/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# 头部姿态模型
2+
3+
FastDeploy目前支持如下人脸对齐模型部署
4+
5+
| 模型 | 说明 | 模型格式 | 版本 |
6+
| :--- | :--- | :------- | :--- |
7+
| [omasaht/headpose-fsanet-pytorch](./fsanet) | FSANet 系列模型 | ONNX | [CommitID:002549c](https://github.com/omasaht/headpose-fsanet-pytorch/commit/002549c) |
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# FSANet 模型部署
2+
3+
## 模型版本说明
4+
5+
- [FSANet](https://github.com/omasaht/headpose-fsanet-pytorch/commit/002549c)
6+
7+
## 支持模型列表
8+
9+
目前FastDeploy支持如下模型的部署
10+
11+
- [FSANet 模型](https://github.com/omasaht/headpose-fsanet-pytorch)
12+
13+
## 下载预训练模型
14+
15+
为了方便开发者的测试,下面提供了PFLD导出的各系列模型,开发者可直接下载使用。
16+
17+
| 模型 | 参数大小 | 精度 | 备注 |
18+
|:---------------------------------------------------------------- |:----- |:----- | :------ |
19+
| [fsanet-1x1.onnx](https://bj.bcebos.com/paddlehub/fastdeploy/fsanet-1x1.onnx) | 1.2M | - |
20+
| [fsanet-var.onnx](https://bj.bcebos.com/paddlehub/fastdeploy/fsanet-var.onnx) | 1.2MB | - |
21+
22+
## 详细部署文档
23+
24+
- [Python部署](python)
25+
- [C++部署](cpp)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
PROJECT(infer_demo C CXX)
2+
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
3+
4+
# 指定下载解压后的fastdeploy库路径
5+
option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")
6+
include(${FASTDEPLOY_INSTALL_DIR}/utils/gflags.cmake)
7+
include(${FASTDEPLOY_INSTALL_DIR}/FastDeploy.cmake)
8+
9+
# 添加FastDeploy依赖头文件
10+
include_directories(${FASTDEPLOY_INCS})
11+
12+
add_executable(infer_demo ${PROJECT_SOURCE_DIR}/infer.cc)
13+
# 添加FastDeploy库依赖
14+
if(UNIX)
15+
target_link_libraries(infer_demo ${FASTDEPLOY_LIBS} gflags pthread)
16+
else()
17+
target_link_libraries(infer_demo ${FASTDEPLOY_LIBS} gflags)
18+
endif()

0 commit comments

Comments
 (0)