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

HardSigmoid op not support now for sophon example #1416

Closed
thunder95 opened this issue Feb 22, 2023 · 6 comments
Closed

HardSigmoid op not support now for sophon example #1416

thunder95 opened this issue Feb 22, 2023 · 6 comments
Labels

Comments

@thunder95
Copy link
Contributor

环境

  • 【FastDeploy版本】: fastdeploy-linux-gpu-0.8.0
  • 【编译命令】: 未编译
  • 【系统平台】: Linux x64(Ubuntu 18.04) /
  • 【硬件】: BM1684X
  • 【编译语言】: python

完全按照例子https://github.com/PaddlePaddle/FastDeploy/tree/develop/examples/vision/detection/paddledetection/sophgo,生成onnx并转mlir模型时出现两个问题:

  1. -input_shapes [[1,3,640,640],[1,2]] 这也写检查shape会报错
  2. 绕过第一步,会出现算子不支持, HardSigmoid op not support now
@jiangjiajun
Copy link
Collaborator

Hi, @KhantiInNaraka 能帮忙看下这个问题吗?

@thunder95
Copy link
Contributor Author

@KhantiInNaraka 尝试yoloe-r时,也出现了Constant op not support now, 里面也没有NonMaxSuppression这个节点

@Yi-sir
Copy link
Contributor

Yi-sir commented Mar 21, 2023

这些问题在https://github.com/sophgo/tpu-mlir 下载新版本的mlir工具可以解决。另外,生成inputs.npz的文件可能需要修改一下,自测使用如下函数可以通过。
def prepare(img_path):
im = cv2.imread(img_path)
im = cv2.cvtColor(im, cv2.COLOR_BGR2RGB)
im = cv2.resize(im, (640, 640))
im = im.transpose((2,0,1))
im = im[np.newaxis,...]
im_scale_y = 640 / float(im.shape[2])
im_scale_x = 640 / float(im.shape[3])
inputs = {}
inputs['image'] = np.array(im).astype('float32')
inputs['scale_factor'] = np.array(([im_scale_y, im_scale_x],)).astype('float32')
np.savez('inputs.npz', image=inputs['image'], scale_factor=inputs['scale_factor'])

@thunder95
Copy link
Contributor Author

@Yi-sir 您好,我想用soc模式部署, 请问在docker开发环境里怎么使用fastdeploy,我看教程里是pcie模式的,参考文档:https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/cn/build_and_install/sophgo.md

@Yi-sir
Copy link
Contributor

Yi-sir commented Mar 21, 2023

@thunder95 soc模式下,sophgo设备可以直接通过SD卡刷机完成环境配置,刷机指南参考【 https://www.sophgo.com/curriculum/detail.html?category_id=3&type_id=2&id=4 】,刷机包下载:【 https://sophon-file.sophon.cn/sophon-prod-s3/drive/23/01/05/12/Release_221201-public.zip 】。完成刷机之后可以尝试直接从https://github.com/PaddlePaddle/FastDeploy/blob/develop/docs/cn/build_and_install/sophgo.md 的【C++编译安装】部分开始执行

@Yi-sir
Copy link
Contributor

Yi-sir commented Mar 22, 2023

@KhantiInNaraka 尝试yoloe-r时,也出现了Constant op not support now, 里面也没有NonMaxSuppression这个节点

mlir报告NMS不支持的问题,可以参考【 https://github.com/PaddlePaddle/FastDeploy/tree/develop/examples/vision/detection/paddledetection/sophgo 】解决。注意python需要在推理代码中,模型初始化之后补充 【model.postprocessor.apply_nms()】,c++补充【model.GetPostprocessor().ApplyNMS();】

@paddle-bot paddle-bot bot closed this as completed Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants