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
2.99k stars 465 forks source link

Why does importing an image of an ONNX model exported with yolov5 --img-size 1280 get an error? How to solve it.为什么用 yolov5 --img-size 1280 导出的onnx模型图片输入会报错?如何解决 #1087

Closed HiaHong closed 9 months ago

HiaHong commented 1 year ago

[FastDeploy][INFO]: Successfully found CUDA ToolKit from system PATH env -> C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin [INFO] fastdeploy/runtime.cc(528)::fastdeploy::Runtime::Init Runtime initialized with Backend::OPENVINO in Device::CPU. Traceback (most recent call last): File "d:/AHONG_Space/AHONG/mytools/rcnnOKgpu copy.py", line 40, in <module> result = model.predict(img_array) File "D:\anaconda3\envs\paddleX\lib\site-packages\fastdeploy\vision\detection\contrib\yolov5.py", line 154, in predict return self._model.predict(input_image) RuntimeError: Can't set input blob with name: images, because model input (shape={1,3,1280,1280}) and blob (shape=(1.3.640.640)) are incompatible

默认640就可以正常运行

jiangjiajun commented 1 year ago

预处理决定了最终输入给模型的数据大小,默认情况下是640,640. 如若你是1280, 1280,那么需要修改预处理参数,可使用如下方式

model = fd.vision.detection.YOLOv5()
model.preprocessor.size = [1280, 1280]

所有API均可查阅 https://baidu-paddle.github.io/fastdeploy-api/python/html/object_detection.html#fastdeploy-vision-detection-yolov5

lhh753159 commented 1 year ago

C++部署 CPU版本的 yolov5face imgsize在哪改啊,没找到图像预处理的源码/(ㄒoㄒ)/~~

wjj19950828 commented 1 year ago

@lhh753159 试试如下代码

auto model = fastdeploy::vision::facedet::YOLOv5Face(model_file, "", option);
model.size = {width, height};
jiangjiajun commented 9 months ago

此ISSUE由于一年未更新,将会关闭处理,如有需要,可再次更新打开。