LibtorchSegmentation icon indicating copy to clipboard operation
LibtorchSegmentation copied to clipboard

How to convert pt-model to ONNX-model

Open Jessicahjj opened this issue 2 years ago • 1 comments

How to convert pt-model to ONNX-model? I need to load and run an ONNX-model using opencv. Thanks!

Jessicahjj avatar Feb 07 '22 06:02 Jessicahjj

Define a onnx model with the exact same structure as libtorch model and copy the weight like convolution to the onnx model.

AllentDan avatar Feb 09 '22 00:02 AllentDan

Is it possible to convert a torch::nn::Module to a torch::jit::Module?

KongCang avatar Mar 13 '23 07:03 KongCang

Yes. That's what I answered before.

AllentDan avatar Mar 13 '23 08:03 AllentDan

Thanks for your reply. If there is a simpler way, I will share it here.

KongCang avatar Mar 17 '23 07:03 KongCang