FastDeploy
FastDeploy copied to clipboard
PaddleSeg Python部署示例:推理完成后,不输出可视化结果
Win10 64位,Python3.8,fastdeploy-python==0.4.0,按照下面链接的步骤做实例分割推理,不输出可视化结果
https://github.com/PaddlePaddle/FastDeploy/tree/develop/examples/vision/segmentation/paddleseg/python
——————————————————————————————————
测试模型:Unet_cityscapes_without_argmax_infer
运行指令:python infer.py --model Unet_cityscapes_without_argmax_infer --image 0.jpg --device cpu
使用图片:
——————————————————————————————————
报错信息:
result shape is: [480 640]
Traceback (most recent call last):
File "infer.py", line 56, in
您好,图片路径输入正确了吗?这边看大概率是没读到推理的图片。 我建议如果不确定的话,就使用绝对路径或者在Infer.py中写死路径哈?
如果有推理结果,还请麻烦给出推理结果参考下吗?
如果有推理结果,还请麻烦给出推理结果参考下吗?
图片加载成功了的,完整的输出信息如下:
[WARNING] fastdeploy/vision/segmentation/ppseg/model.cc(103)::fastdeploy::vision::segmentation::PaddleSegModel::BuildPreprocessPipelineFromConfig The exported PaddleSeg model is with dynamic shape input, which is not supported by ONNX Runtime and Tensorrt. Only OpenVINO and Paddle Inference are available now. For using ONNX Runtime or Tensorrt, Please refer to https://github.com/PaddlePaddle/PaddleSeg/blob/develop/docs/model_export.md to export model with fixed input shape.
[INFO] fastdeploy/runtime.cc(457)::fastdeploy::Runtime::Init Runtime initialized with Backend::OPENVINO in Device::CPU.
SegmentationResult Image masks 10 rows x 10 cols:
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, .....]
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, .....]
[2, 2, 2, 2, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
[8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....]
...........
SegmentationResult Score map 10 rows x 10 cols:
[3.525208, 5.101487, 5.417739, 5.691195, 5.894309, 6.081670, 6.011827, 5.762290, 5.449749, 5.330842, .....]
[5.389306, 5.438952, 5.443271, 5.316322, 5.059463, 4.920535, 4.914520, 4.885922, 4.718202, 4.773836, .....]
[5.011885, 5.142492, 5.070006, 4.868554, 5.167188, 5.484427, 5.812686, 6.214724, 6.601383, 6.922870, .....]
[7.064143, 7.203434, 7.298545, 7.378626, 7.446555, 7.676059, 7.917289, 8.200085, 8.323961, 8.354295, .....]
[8.424806, 8.470721, 8.423153, 8.288775, 8.274137, 8.336132, 8.439157, 8.468110, 8.628210, 8.818375, .....]
[8.960412, 9.044074, 9.207579, 9.373637, 9.497150, 9.475745, 9.417353, 9.352909, 9.306359, 9.282238, .....]
[9.273350, 9.300271, 9.353672, 9.405495, 9.477840, 9.574491, 9.667436, 9.706421, 9.634468, 9.597646, .....]
[9.639825, 9.762795, 9.815427, 9.877699, 10.000050, 10.144201, 10.155061, 10.169402, 10.236405, 10.206388, .....]
[10.052238, 9.947912, 9.922629, 9.997441, 10.038168, 9.887515, 9.711674, 9.669265, 9.717282, 9.661407, .....]
[9.537221, 9.400292, 9.275891, 9.202469, 9.154181, 9.247576, 9.434942, 9.721684, 9.907133, 10.153969, .....]
...........
result shape is: [480 640]
Traceback (most recent call last):
File "infer.py", line 56, in
Invoked with: array([[[237, 255, 254], [235, 253, 252], [232, 252, 253], ..., [141, 143, 151], [147, 147, 159], [144, 144, 158]],
[[237, 255, 254],
[235, 253, 252],
[232, 252, 253],
...,
[139, 141, 149],
[154, 154, 166],
[158, 158, 172]],
[[237, 255, 254],
[235, 253, 252],
[232, 252, 253],
...,
[137, 140, 148],
[153, 155, 166],
[155, 156, 170]],
...,
[[198, 182, 176],
[198, 182, 176],
[198, 182, 176],
...,
[178, 165, 167],
[178, 165, 167],
[178, 165, 167]],
[[198, 182, 176],
[198, 182, 176],
[198, 182, 176],
...,
[177, 164, 166],
[177, 164, 166],
[177, 164, 166]],
[[198, 182, 176],
[198, 182, 176],
[198, 182, 176],
...,
[177, 164, 166],
[177, 164, 166],
[177, 164, 166]]], dtype=uint8), SegmentationResult Image masks 10 rows x 10 cols:
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, .....] [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, .....] [2, 2, 2, 2, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] [8, 8, 8, 8, 8, 8, 8, 8, 8, 8, .....] ........... SegmentationResult Score map 10 rows x 10 cols: [3.525208, 5.101487, 5.417739, 5.691195, 5.894309, 6.081670, 6.011827, 5.762290, 5.449749, 5.330842, .....] [5.389306, 5.438952, 5.443271, 5.316322, 5.059463, 4.920535, 4.914520, 4.885922, 4.718202, 4.773836, .....] [5.011885, 5.142492, 5.070006, 4.868554, 5.167188, 5.484427, 5.812686, 6.214724, 6.601383, 6.922870, .....] [7.064143, 7.203434, 7.298545, 7.378626, 7.446555, 7.676059, 7.917289, 8.200085, 8.323961, 8.354295, .....] [8.424806, 8.470721, 8.423153, 8.288775, 8.274137, 8.336132, 8.439157, 8.468110, 8.628210, 8.818375, .....] [8.960412, 9.044074, 9.207579, 9.373637, 9.497150, 9.475745, 9.417353, 9.352909, 9.306359, 9.282238, .....] [9.273350, 9.300271, 9.353672, 9.405495, 9.477840, 9.574491, 9.667436, 9.706421, 9.634468, 9.597646, .....] [9.639825, 9.762795, 9.815427, 9.877699, 10.000050, 10.144201, 10.155061, 10.169402, 10.236405, 10.206388, .....] [10.052238, 9.947912, 9.922629, 9.997441, 10.038168, 9.887515, 9.711674, 9.669265, 9.717282, 9.661407, .....] [9.537221, 9.400292, 9.275891, 9.202469, 9.154181, 9.247576, 9.434942, 9.721684, 9.907133, 10.153969, .....] ........... result shape is: [480 640]
您好,感谢您的分享,debug了下,是现在FastDeploy PaddleSeg的可视化API接口更新升级了。稍后会更新Fastdeploy主库的develop分支。如果方便,也可自行将D:\Python38\lib\site-packages\fastdeploy\vision\visualize_init_.py +40 更改
def vis_segmentation(im_data, seg_result, weight=0.5):
return C.vision.vis_segmentation(im_data, seg_result, weight)
您好,感谢您的分享,debug了下,是现在FastDeploy PaddleSeg的可视化API接口更新升级了。稍后会更新Fastdeploy主库的develop分支。如果方便,也可自行将D:\Python38\lib\site-packages\fastdeploy\vision\visualize_init_.py +40 更改
def vis_segmentation(im_data, seg_result, weight=0.5): return C.vision.vis_segmentation(im_data, seg_result, weight)
好的,验证OK,感谢。
SegmentationResult Image masks 10*10和SegmentationResult Score map 10 rows x 10 cols 的二维数组 怎么与 [480 640]这个图对应呢 ,好像没有看懂这个对应关系 谢谢