Export to ONNX
michaelnguyen11 opened this issue · 1 comments
michaelnguyen11 commented
Hi authors and communities,
Do anyone convert successfully DeepPruner / DeepPruner Fast Pytorch to ONNX model ? Could you guys help me to convert DeepPruner Pytoch to ONNX model ?
I tried to convert to ONNX, however, the uniform operator is not supported with all version of ONNX opset.
How I did : in submission_kitti.py , at function test()
def test(imgL, imgR):
model.eval()
with torch.no_grad():
imgL = Variable(torch.FloatTensor(imgL))
imgR = Variable(torch.FloatTensor(imgR))
if args.cuda:
imgL, imgR = imgL.cuda(), imgR.cuda()
onnx_file = f"deepPruner_fast.onnx"
torch.onnx.export(model,
args=(imgL,imgR),
f=onnx_file,
opset_version=13)
import onnx
from onnxsim import simplify
model_load = onnx.load(onnx_file)
model_simp, check = simplify(model_load)
onnx.save(model_simp, onnx_file)
import sys
sys.exit(0)
refined_disparity = model(imgL, imgR)
return refined_disparity
Many thanks in advance.
ShivamDuggal4 commented
Sorry, we do not have the ONNX version of the DeepPruner models and are not aware of anyone who can provide quick help for the same.
Best Regards
Shivam