mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

Add mmflow to mmdeploy

Open pedroHuang123 opened this issue 2 years ago • 16 comments

Motivation

I want to add mmflow to mmdeploy,now I have implemented the conversion of the mmflow raft model to onnx.

Modification

Add mmflow to mmdeploy/codebase and mmdeply/config

pedroHuang123 avatar Jan 04 '23 03:01 pedroHuang123

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jan 04 '23 03:01 CLAassistant

Most tracerwarning can be ignored if the exporter can produce the model you want. Adding a rewriter to fix the warning might bring some trouble. The rewriter could broken if mmflow update their codes. DO NOT add rewriter unless it is necessary.

grimoire avatar Jan 06 '23 05:01 grimoire

I have remove these unnecessary rewrite ,and verify the result of onnx model. @grimoire @lvhan028 @ouonline @tehkillerbee

pedroHuang123 avatar Jan 11 '23 06:01 pedroHuang123

@pedroHuang123 Hi, any update on this PR?

RunningLeon avatar Jan 31 '23 09:01 RunningLeon

@pedroHuang123 Hi, any update on this PR?

hello, are there any problems with this PR?

pedroHuang123 avatar Jan 31 '23 10:01 pedroHuang123

@pedroHuang123 Hi, any update on this PR?

hello, are there any problems with this PR?

Some ci failed, could fix them? BTW, pls sign the cla

RunningLeon avatar Feb 01 '23 02:02 RunningLeon

@pedroHuang123 Hi, any update on this PR?

hello, are there any problems with this PR?

Some ci failed, could fix them? BTW, pls sign the cla

@pedroHuang123 Hi, any update on this PR?

hello, are there any problems with this PR?

Some ci failed, could fix them? BTW, pls sign the cla I have signed the cla,but I do not know how to fix these ci checks? image

pedroHuang123 avatar Feb 01 '23 07:02 pedroHuang123

For lint error, please install pre-commit on your local host

pip install -U pre-commit
cd mmdeploy
pre-commit install

Then run the following command to check the errors

pre-commit run --all-files

lvhan028 avatar Feb 03 '23 03:02 lvhan028

CLA assistant check Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

DESKTOP-UJGOP82\kandao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it.

Why the status still pending?

pedroHuang123 avatar Feb 03 '23 09:02 pedroHuang123

@pedroHuang123 Hi, any update on this PR?

hello, are there any problems with this PR?

Some ci failed, could fix them? BTW, pls sign the cla

I have fixed these ci check, please review the code.thanks

pedroHuang123 avatar Feb 04 '23 01:02 pedroHuang123

@pedroHuang123 Hi, could you give us the model config link of mmflow you tested on this PR?

RunningLeon avatar Feb 06 '23 03:02 RunningLeon

This is the link: https://download.openmmlab.com/mmflow/raft/raft_8x2_100k_mixed_368x768.py @RunningLeon

pedroHuang123 avatar Feb 06 '23 03:02 pedroHuang123

Now I just complete the export of torch to onnx,not include SDK . and I find that it takes long time to export mmflow raft model to onnx model (one hours). I hope mmdeploy help analyze the cause. Thanks

pedroHuang123 avatar Feb 06 '23 04:02 pedroHuang123

Please provide a script about how to convert the model.

grimoire avatar Feb 07 '23 02:02 grimoire

Please provide a script about how to convert the model.

from mmdeploy.apis import torch2onnx import onnx import os imgs = ['mmflow/demo/frame_0001.png','mmflow/demo/frame_0002.png'] work_dir = 'work_dir/onnx/raft' save_file = 'raft_mixed.onnx' deploy_cfg = 'mmdeploy/configs/mmflow/raft/opticalflow_onnxruntime_static.py' model_cfg = 'D:\KdWork\OpenmmLab\mmflow\configs\raft\raft_8x2_100k_mixed_368x768.py' model_checkpoint = 'mmflow/checkpoints/raft_8x2_100k_mixed_368x768.pth'

device = 'cuda'

1. convert model to onnx

torch2onnx(imgs, work_dir, save_file, deploy_cfg, model_cfg,model_checkpoint, device)

# 2. check onnx model

onnx_model = onnx.load(os.path.join(work_dir,save_file)) try: onnx.checker.check_model(onnx_model) except Exception: print("Model Incorrect") else: print("Model correct") print("over")

pedroHuang123 avatar Feb 07 '23 09:02 pedroHuang123

mmflow still not added to mmdeploy?

Swayzzu avatar Sep 15 '23 07:09 Swayzzu