lucastabelini / PolyLaneNet

Code for the paper entitled "PolyLaneNet: Lane Estimation via Deep Polynomial Regression" (ICPR 2020)
https://arxiv.org/abs/2004.10924
MIT License
295 stars 74 forks source link

from pt convert ONNX model #61

Closed jyfei-An closed 2 years ago

jyfei-An commented 2 years ago

I want to use the following code to convert the model to onnx format, but it fails, I want to ask if it supports conversion, and if so how to convert it

dummy_input = torch.randn(images.shape) torch.onnx.export(model, dummy_input, "./polylanenet.onnx", verbose=True)

failed imformation: RuntimeError: ONNX export failed: Couldn't export Python operator SwishImplementation

stealth0414 commented 2 years ago

How did you do it?

jyfei-An commented 2 years ago

You can call the set_swish function of the EfficientNet model. my code: if 'efficientnet' in backbone: if pretrained: self.model = EfficientNet.from_pretrained(backbone, num_classes=num_outputs) else: self.model = EfficientNet.from_name(backbone, override_params={'num_classes': num_outputs}) self.model.set_swish(memory_efficient=False) self.model._fc = OutputLayer(self.model._fc, extra_outputs)

stealth0414 commented 2 years ago

Thank you for your reply :) I'm trying to convert the model to onnx format to deploy in jetson nano.

stealth0414 commented 2 years ago

Excuse me, plz tell me how to from pt convert onnx model? I cannot creat it. Thank you.