open-mmlab / mmdeploy

OpenMMLab Model Deployment Framework
https://mmdeploy.readthedocs.io/en/latest/
Apache License 2.0
2.76k stars 634 forks source link

[Bug] #2750

Open Gbbfine opened 6 months ago

Gbbfine commented 6 months ago

Checklist

Describe the bug

代码在linux服务器上能运行,但是在windows上运行不了,会报以下错误,也没有结果生成

这是代码 from mmdeploy_runtime import Segmentor import cv2 import numpy as np

img = cv2.imread('D:\Code\pycharm_work\onnx\AH2-95_crop_2_2.jpg')

create a classifier

segmentor = Segmentor(model_path='D:\Code\pycharm_work\onnx\segformerIMF', device_name='cpu', device_id=0)

perform inference

seg = segmentor(img)

visualize inference result

random a palette with size 256x3

palette = np.random.randint(0, 256, size=(256, 3)) color_seg = np.zeros((seg.shape[0], seg.shape[1], 3), dtype=np.uint8) for label, color in enumerate(palette): color_seg[seg == label, :] = color

convert to BGR

color_seg = color_seg[..., ::-1] img = img 0.5 + color_seg 0.5 img = img.astype(np.uint8) cv2.imwrite('output_segmentation.png', img)

这是报错 C:\Users\GBB.conda\envs\pytorch\python.exe D:\Code\pycharm_work\onnx\main.py loading mmdeploy_ort_net.dll ... [2024-04-25 23:28:33.368] [mmdeploy] [info] [model.cpp:35] [DirectoryModel] Load model: "D:\Code\pycharm_work\onnx\segformerIMF" [2024-04-25 23:28:33.434] [mmdeploy] [error] [ort_net.cpp:205] unhandled exception when creating ORTNet: Failed to load model because protobuf parsing failed. [2024-04-25 23:28:33.434] [mmdeploy] [error] [net_module.cpp:54] Failed to create Net backend: onnxruntime, config: { "context": { "device": "", "model": "", "stream": "" }, "input": [ "prep_output" ], "input_map": { "img": "input" }, "is_batched": true, "module": "Net", "name": "segformer", "output": [ "infer_output" ], "output_map": {}, "type": "Task" } [2024-04-25 23:28:33.434] [mmdeploy] [error] [task.cpp:99] error parsing config: { "context": { "device": "", "model": "", "stream": "" }, "input": [ "prep_output" ], "input_map": { "img": "input" }, "is_batched": true, "module": "Net", "name": "segformer", "output": [ "infer_output" ], "output_map": {}, "type": "Task" }

Process finished with exit code -1073741819 (0xC0000005)

Reproduction

1

Environment

1

Error traceback

1
chuanxiang-wu commented 3 months ago

请问你解决了吗?我也遇到了这个问题。