open-mmlab / mmdeploy

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

[Bug] mmdeploy-1.0.0rc3-windows-amd64-onnxruntime1.8.1.zip bug #2017

Closed mortal-Zero closed 1 year ago

mortal-Zero commented 1 year ago

Checklist

Describe the bug

I download the mmdeploy-1.0.0rc3-windows-amd64-onnxruntime1.8.1.zip and install it with pip install .\mmdeploy-1.0.0rc3-windows-amd64-onnxruntime1.8.1\dist\mmdeploy-1.0.0rc3-py38-none-win_amd64.whl
pip install .\mmdeploy-1.0.0rc3-windows-amd64-onnxruntime1.8.1\sdk\python\mmdeploy_python-1.0.0rc3-cp38-none-win_amd64.whl And I use python to infer, when I from mmdeploy_python import Detector, I got The given version [8] is not supported, only version 1 to 7 is supported in this build.. It is not an error, but when I go on to detector = Detector(model_path=det_model, device_name='cpu'), I got [2023-04-23 11:39:00.624] [mmdeploy] [info] [model.cpp:35] [DirectoryModel] Load model: "E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nano", then the process died.

What kind of problem is that?

Reproduction

no.

Environment

OS: Windows 11 21H2
CPU: 12th Gen Intel(R) Core(TM) i7-12700H
Python: 3.8
mmengine: 0.7.2
mmcv: 2.0.0
mmdeploy: 1.0.0rc3
mmdeploy-python: 1.0.0rc3
wheel: 0.38.4

Error traceback

no.
irexyc commented 1 year ago

Maybe similiar to https://github.com/open-mmlab/mmdeploy/issues/1913

Could you please unzip the mmdeploy-1.0.0rc3-py38-none-win_amd64.whl file and use Dependencies to check the dependences of the pyd file ?

Please check if the pyd linked the right onnxruntime.dll.

image
mortal-Zero commented 1 year ago

Maybe similiar to #1913

Could you please unzip the mmdeploy-1.0.0rc3-py38-none-win_amd64.whl file and use Dependencies to check the dependences of the pyd file ?

Please check if the pyd linked the right onnxruntime.dll.

image

Thanks for you reply, I will try that. And I noticed that you published mmdeploy1.0.0, which can be installed with pip, can I install mmdeploy_python with pip on windows?

irexyc commented 1 year ago

Thanks for you reply, I will try that. And I noticed that you published mmdeploy1.0.0, which can be installed with pip, can I install mmdeploy_python with pip on windows?

We have renamed mmdeploy_python to mmdeploy_runtime. The api of mmdeploy_runtime is same with mmdeploy_python. So I think you can forget the mmdeploy_python 🙃

mortal-Zero commented 1 year ago

Thanks for you reply, I will try that. And I noticed that you published mmdeploy1.0.0, which can be installed with pip, can I install mmdeploy_python with pip on windows?

We have renamed mmdeploy_python to mmdeploy_runtime. The api of mmdeploy_runtime is same with mmdeploy_python. So I think you can forget the mmdeploy_python 🙃

So, I can install mmdeploy_runtime with pip now?

mortal-Zero commented 1 year ago

Thanks for you reply, I will try that. And I noticed that you published mmdeploy1.0.0, which can be installed with pip, can I install mmdeploy_python with pip on windows?

We have renamed mmdeploy_python to mmdeploy_runtime. The api of mmdeploy_runtime is same with mmdeploy_python. So I think you can forget the mmdeploy_python 🙃

Sorry for bothering again. I install mmdeploy with pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mmdeploy==1.0.0, and install mmdeploy_runtime with pip install -i https://pypi.tuna.tsinghua.edu.cn/simple mmdeploy-runtime==1.0.0. I can import mmdeploy_runtime successfully, and load model without error message, but when I do infer, the process died again. Here is my cmd output:

>>> import cv2                                                                       
>>> from mmdeploy_runtime import Detector
loading mmdeploy_ort_net.dll ...
>>> det_model = r'E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nano'
>>> detector = Detector(model_path=det_model, device_name='cpu')
[2023-04-23 16:57:46.044] [mmdeploy] [info] [model.cpp:35] [DirectoryModel] Load model: "E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nano"
>>> image_path = r'E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\000000147979.jpg' 
>>> img = cv2.imread(image_path)                                                     
>>> bboxes, labels, _ = detector(img) 

# Then process died.
irexyc commented 1 year ago

What is the model type of E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nano ? Can you upload detail.json in E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nan

mortal-Zero commented 1 year ago

What is the model type of E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nano ? Can you upload detail.json in E:\DemoProjects\openmmlab\demo_rtmpose\rtmpose-ort\rtmdet-nan

{
    "version": "1.0.0rc1",
    "codebase": {
        "task": "ObjectDetection",
        "codebase": "mmdet",
        "version": "3.0.0rc2",
        "pth": "../rtmdet_nano_8xb32-300e_coco-person_in1kpretrain/rtmdet_nano_8xb32-300e_coco-person_in1kpretrain-96154d0b.pth",
        "config": "../rtmdet_nano_8xb32-300e_coco-person_in1kpretrain/rtmdet_nano_8xb32-300e_coco-person.py"
    },
    "codebase_config": {
        "type": "mmdet",
        "task": "ObjectDetection",
        "model_type": "sdk",
        "post_processing": {
            "score_threshold": 0.05,
            "confidence_threshold": 0.005,
            "iou_threshold": 0.5,
            "max_output_boxes_per_class": 200,
            "pre_top_k": 5000,
            "keep_top_k": 100,
            "background_label_id": -1
        }
    },
    "onnx_config": {
        "type": "onnx",
        "export_params": true,
        "keep_initializers_as_inputs": false,
        "opset_version": 11,
        "save_file": "end2end.onnx",
        "input_names": [
            "input"
        ],
        "output_names": [
            "dets",
            "labels"
        ],
        "input_shape": null,
        "optimize": true,
        "dynamic_axes": {
            "input": {
                "0": "batch",
                "2": "height",
                "3": "width"
            },
            "dets": {
                "0": "batch",
                "1": "num_dets"
            },
            "labels": {
                "0": "batch",
                "1": "num_dets"
            }
        }
    },
    "backend_config": {
        "type": "sdk",
        "pipeline": [
            {
                "type": "LoadImageFromFile"
            },
            {
                "type": "LoadAnnotations",
                "with_bbox": true
            },
            {
                "type": "PackDetInputs",
                "meta_keys": [
                    "img_id",
                    "img_path",
                    "ori_shape",
                    "img_shape"
                ]
            }
        ]
    },
    "calib_config": {}
}
irexyc commented 1 year ago

What's is your convert command? Your detail.json looks strange to me.

mortal-Zero commented 1 year ago

What's is your convert command? Your detail.json looks strange to me.

I got this detail.json from https://github.com/open-mmlab/mmpose/tree/1.x/projects/rtmpose, this is the download link.

irexyc commented 1 year ago

this is the download link.

I can load and inference the model you provided.

>>> bboxes, labels, _ = detector(img) #Then process died.

Does there have any outpus after bboxes, labels, _ = detector(img) ?

mortal-Zero commented 1 year ago

this is the download link.

I can load and inference the model you provided.

bboxes, labels, _ = detector(img)

Then process died.

Does there have any outpus after bboxes, labels, _ = detector(img) ?

No, When I debug the code at bboxes, labels, _ = detector(img), I F5, then process died, the terminal looks like: image

irexyc commented 1 year ago

Have no clue about the process died.

You may use Dependencies to check dll/pyd file in site-packages/mmdeploy-runtime/. See if there are missing dependencies.

mortal-Zero commented 1 year ago

Have no clue about the process died.

You may use Dependencies to check dll/pyd file in site-packages/mmdeploy-runtime/. See if there are missing dependencies.

Thanks for you reply, I will try more.

DeclK commented 1 year ago

Having the exact situation when using windows sdk, was it solved? @irexyc @Baiyixuan1113

I tried to use the Denpendencies tool to analyze it, I don't have the onnxruntime.dll in the list. Is this related to this problem?

image

I am using the mmdeploy-runtime 1.1.0.

irexyc commented 1 year ago

@DeclK

The missing python3.8.dll may because you doesn't activate a python3.8 environment by default according on your environment variable. If you can import mmdeploy_runtime after you activate a python environment, you can ignore this.

Someone reported that using pure onnxruntime python api (with loading custom ops lib) will also cause an error on his machine. While when he upgrade onnxruntime from 1.8.1 to 1.15.1, the error is gone. You may also try it. If the new onnxruntime fixes this error. You can download the new onnxruntime library from https://github.com/microsoft/onnxruntime/releases and replace onnxruntime.dll in mmdeploy_runtime installation path with download one.

github-actions[bot] commented 1 year ago

This issue is marked as stale because it has been marked as invalid or awaiting response for 7 days without any further response. It will be closed in 5 days if the stale label is not removed or if there is no further response.

github-actions[bot] commented 1 year ago

This issue is closed because it has been stale for 5 days. Please open a new issue if you have similar issues or you have any new updates now.