PeterL1n / BackgroundMattingV2

Real-Time High-Resolution Background Matting
MIT License
6.81k stars 950 forks source link

Convert to ONNX #49

Closed komjii2 closed 3 years ago

komjii2 commented 3 years ago

Hi, I'm very interested in your research.

Now I'm trying to convert pth file to onnx file by using export_onnx.py But unfortunately, I got an error message below.

onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Type Error: Type parameter (T) bound to different types (tensor(float) and tensor(double) in node (ScatterElements_420).

My environment is Windows 10, python 3.7, ONNX ver 1.6.0

If you know what the problem is, I would be really grateful for any help.

PeterL1n commented 3 years ago

Are you using the latest PyTorch 1.7? The export_onnx.py should work fine. Most likely there is some problem in your environment. You can try running it in Colab environment instead.

What's your special need to re-export instead of using the provided onnx model.