Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon 4th No.180】在FastDeploy中集成集成地平线推理引擎 #410

Merged
merged 3 commits into from
Mar 10, 2023
Merged
Changes from 2 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
88 changes: 88 additions & 0 deletions rfcs/FastDeploy/20230303_horizon_for_FastDeploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 在FastDeploy中集成集成地平线推理引擎,在PP-YOLOE完成模型转换测试

| 领域 | 飞桨文档体验方案 |
|----------------------------------------------------------|-------------------------------------------|
| 提交作者<input type="checkbox" class="rowselector hidden"> | seyosum |
| 提交时间<input type="checkbox" class="rowselector hidden"> | 2023-03-04 |
| 版本号 | V1.0 |
| 依赖飞桨版本<input type="checkbox" class="rowselector hidden"> | paddlepaddle-gpu==0.0 |
| 文件名 | 20230304_horizon_for_FastDeploy.md<br> |

# 一、概述
## 1、相关背景
完成地平线AI推理引擎接入Fastdeploy工作,同时将PP-YOLOE转换为板端模型,确保模型推理结果正确。

[https://github.com/PaddlePaddle/Paddle/issues/50631#task180](https://github.com/PaddlePaddle/Paddle/issues/50631#task180)

## 2、功能目标
将地平线推理引擎接入FastDeploy,开发HorizonBackends部分。
## 3、意义
FastDeploy增添地平线推理引擎,提高开发者开发效率。

# 二、地平线芯片开发现状

开发地平线端侧芯片需要阅读大量开发手册,短时间内难以上手,且文档内容较为分散,提取有效信息较为困难,且当前未有第三方框架对其进行集成。

# 三、业内方案调研

目前FastDeploy已经将瑞芯微端侧推理集成到整体框架中,大大提高了开发者的开发效率。

# 四、对比分析

大部分AI芯片的开发大概可分为前处理开发、推理引擎开发、后处理开发三部分,主要的工作主要在推理引擎开发部分,其核心在于将地平线的API集成入backends中,需要实现的方法主要是输入输出信息的获取、模型的初始化、infer。


# 五、设计思路与实现方案

## 1、主体设计思路与折衷
参考技术文档跑通示例Demo,完成相关API的提取。
### 主体设计具体描述
1. 模型转换文档

2. 编译环境cmake集成

3. backends编写、调试

4. 将backends集成进FastDeploy

5. 分类模型验证正确性
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里为什么要有一个分类模型验证准确性啊,是说先移植分类模型再移植PPYOLO-E吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

分类模型一般情况下是可以直接通过网络输出结果的,因此,为了验证模型推理部分的正确性,所以先移植分类模型,之后再移植PPYOLO-E

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那你的意思是先在FastDeploy上移植Clas模型随后移植PPYOLOE是吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

那你需要在你的RFC中提到你需要移植哪一个Clas模型哦。


6. 验证PP-YOLOE正确性



## 2、关键技术点/子模块设计与实现方案
将地平线推理API集成进行Backends是本方案的核心部分,需要参考地平线技术文档。

## 3、主要影响的模块接口变化
不影响FastDeploy接口。

# 六、测试和验收的考量
推理结果正确,且无内存泄露。

# 七、影响面

## 对用户的影响
单独Demo项目,对用户无影响。
## 对二次开发用户的影响
单独Demo项目,对用户无影响。
## 对框架架构的影响
## 对性能的影响
## 对比业内深度学习框架的差距与优势的影响
## 其他风险
无开发地平线芯片经验,但具有开发瑞芯微、联咏芯片经验,且已经完成联咏芯片的FastDeploy适配(暂未获得开源许可)

# 八、排期规划
* 环境搭建并跑通参考项目(2023-3-10)
* backends编写(2023-3-10至2023-3-20)
* FastDeploy集成(2023-3-20至2023-3-22)
* 分类模型测试(2023-3-22至2023-3-23)
* 测试PP-YOLOE模型的正确性,检查有无内存泄露(2023-3-23至2023-3-30)
* 提交PR(2023-3-30)

# 名词解释
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里如果没有名词解释和参考资料可以直接删除

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好,这块我再修改下

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Zheng-Bicheng 大佬有空再帮忙review下吧


# 附件及参考资料