FastDeploy icon indicating copy to clipboard operation
FastDeploy copied to clipboard

Fastdeploy下使用ppvehicle的模型推理汽车的属性分类出现bug

Open hunagjingwei opened this issue 3 months ago • 3 comments

环境

  • 【FastDeploy版本】:

  • 【系统平台】: Linux x64(Ubuntu 2004)

  • 【硬件】: CPU

  • 【编译语言】: C++ 在https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.7/deploy/pipeline/docs/tutorials/ppvehicle_attribute.md下载了车辆检测模型以及车辆属性识别模型,基于fastdeploy部署了车辆目标检测以及车辆属性识别模型,其中车辆检测模型识别正常推理,但是车辆属性识别出现问题,算法流程:目标检测图像中的车辆,然后将车辆roi扣出来,单独送到车辆属性检测器推理,但是出现失败,具体log如下: terminate called after throwing an instance of 'ov::Exception' what(): Can't set input blob with name: x, because model input (shape=[?,3,192,256]) and blob (shape=(1.765.1360.3)) are incompatible Aborted roi图像没有问题,测试保存下来是正常的车辆图像,也尝试过单独使用fastdeploy推理ppvehicle的属性识别模型,也是报一样的错误

hunagjingwei avatar Apr 03 '24 09:04 hunagjingwei

看起来是模型的输入不对,你检查一下放入模型的输入是否符合预期,看报错你输入的shape是1.765.1360.3 ?

rainyfly avatar Apr 07 '24 02:04 rainyfly

看起来是模型的输入不对,你检查一下放入模型的输入是否符合预期,看报错你输入的shape是1.765.1360.3 ?

std::string att_model_file = "/home/V01/uids0382/projects/CarDetDemo/vehicle_attribute_model/model.pdmodel"; std::string att_params_file = "/home/V01/uids0382/projects/CarDetDemo/vehicle_attribute_model/model.pdiparams"; std::string att_infer_cfg_file = "/home/V01/uids0382/projects/CarDetDemo/vehicle_attribute_model/infer_cfg.yml"; auto att_model = fastdeploy::vision::classification::PaddleClasModel(att_model_file, att_params_file, att_infer_cfg_file); fastdeploy::vision::ClassifyResult result; obj.convertTo(obj,CV_32F);//obj是Mat 图像 assert(att_model.Predict(&obj, &result));

直接用fastdeploy定义推理接口,好像不需要定义输入图像的大小吧,直接使用Predict进行推理就行了吧

hunagjingwei avatar Apr 07 '24 05:04 hunagjingwei

问题已已解决,使用paddleclas项目下 ./deploy/configs/inference_cls.yaml替代https://github.com/PaddlePaddle/PaddleDetection/blob/release/2.7/deploy/pipeline/docs/tutorials/ppvehicle_attribute.md下载的车辆属性yml文件即可解决。

hunagjingwei avatar Apr 08 '24 02:04 hunagjingwei