InternImage
InternImage copied to clipboard
export.py for segmentation model
Hello! I'm attempting to build an onnx for segmentation inference, and I noticed there's a export.py for the classification folder, but not for segmentation folder...
Is this a possibility in the future? Or, a release of onnx direct?
Thank you!
Hello, we are preparing the onnx for segmentation inference, could you please wait for some days?
Sounds great! Thanks
Hi! I am very excited for this. Currently, I am having error on export.
File "/Users/caleb/dev/Deepwork/deepworkenv/lib/python3.10/site-packages/mmseg/apis/inference.py", line 36, in init_segmentor model.CLASSES = checkpoint['meta']['CLASSES'] KeyError: 'meta'
I have tried with both XL and H checkpoints, and their respective configs. Adjusting for 'core_op='DCNv3_pytorch' as I'm on M1 Max.
Any idea? Thanks
Hi! I am very excited for this. Currently, I am having error on export.
File "/Users/caleb/dev/Deepwork/deepworkenv/lib/python3.10/site-packages/mmseg/apis/inference.py", line 36, in init_segmentor model.CLASSES = checkpoint['meta']['CLASSES'] KeyError: 'meta'
I have tried with both XL and H checkpoints, and their respective configs. Adjusting for 'core_op='DCNv3_pytorch' as I'm on M1 Max.
Any idea? Thanks
Missing CLASSES information in our released checkpoints seems to be the source of this issue. We will update them as soon as possible to fix this issue. Thank you for your issue!
You can currently run the following code to fix this issue:
import torch
from mmseg.core import get_classes
ckpt_path = '/path/to/ckpt.pth'
ckpt = torch.load(ckpt_path, map_location='cpu')
ckpt['meta'] = {}
ckpt['meta']['CLASSES'] = get_classes('ade20k')
torch.save(ckpt, ckpt_path)
Thanks for that. I ended up editing that to add a "PALETTE" value too, and the onnx file exported. But now I am having the following error: onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from /Users/caleb/dev/Deepwork/InternImage-main/segmentation/end2end.onnx failed:Fatal error: mmdeploy:grid_sampler(-1) is not a registered function/op
Suggesting that mmdeploy method isn't within onnx runtime framework. Any solution here?
Thanks for that. I ended up editing that to add a "PALETTE" value too, and the onnx file exported. But now I am having the following error:
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from /Users/caleb/dev/Deepwork/InternImage-main/segmentation/end2end.onnx failed:Fatal error: mmdeploy:grid_sampler(-1) is not a registered function/op
Suggesting that mmdeploy method isn't within onnx runtime framework. Any solution here?
This error is casued by the absense of the corresponding custom operator in onnxruntime. However, we have not implemented this custom operator for onnxruntime engine yet.
If you still want to inference with onnxruntime as your engine, you can try to replace the core_op='DCNv3'
with core_op='DCNv3_pytorch'
so that you can avoid the issue of custom operator. You can refer to issue #41 for more details about how to replace this operator.
Thanks! I had already done this though. Any other suggestions?
i have this error"
Traceback (most recent call last):
File "/content/InternImage/segmentation/deploy.py", line 12, in
@calebhemara hello,do you achieve the segmentation model convert. I meet some problem