PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
3k stars 465 forks source link

HardSigmoid op not support now for sophon example #1416

Closed thunder95 closed 7 months ago

thunder95 commented 1 year ago

环境

完全按照例子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 commented 1 year ago

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

thunder95 commented 1 year ago

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

Yi-sir commented 1 year ago

这些问题在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 commented 1 year ago

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

Yi-sir commented 1 year ago

@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 commented 1 year ago

@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();】