dbolya / yolact

A simple, fully convolutional model for real-time instance segmentation.
MIT License
4.98k stars 1.32k forks source link

Yolact++ to onnx? #634

Open MiaoRain opened 3 years ago

MiaoRain commented 3 years ago

Has anyone successfully converted a Yolact++ model to onnx? preds = net(batch) dummy_input = Variable(torch.randn(1, 3, 550, 550)) torch.onnx.export(net, dummy_input, "yolact_0421_20000.onnx", verbose=True)

but got the errors, any suggestions would be appreciated. RuntimeError: Tried to trace <__torch__.yolact.FPN object at 0x9c26df60> but it is not part of the active trace. Modules that are called during a trace must be registered as submodules of the thing being traced.

zhoujinhai commented 2 years ago

you need change the

class FPN(ScriptModuleWrapper):

to

class FPN(nn.Module):
avickars commented 2 years ago

this doesn't work for me...did it actually work for u?

zhoujinhai commented 2 years ago

您的邮件已收到 谢谢

avickars commented 2 years ago

Any update on this? @zhoujinhai

zhoujinhai commented 2 years ago

Any update on this? @zhoujinhai

Yes, It worked for me!

sarmientoj24 commented 1 year ago

how to do this?

abhiagwl4262 commented 1 year ago

Please follow this article for ONNX support of Yolact++ - https://medium.com/@abhiagwl4262/yolact-pyotorch-to-onnx-tensorrt-9e6a37f6b974