Yet-Another-EfficientDet-Pytorch icon indicating copy to clipboard operation
Yet-Another-EfficientDet-Pytorch copied to clipboard

Did anyone have successfully converted to onnx or tensorrt?

Open angryhen opened this issue 4 years ago • 7 comments

angryhen avatar Jul 27 '20 10:07 angryhen

Not yet, even converted it to .pt file deployed in the c++ program, any ideas?

sainttelant avatar Jul 28 '20 02:07 sainttelant

Haven't converted to TensorRT.

wxthss82 avatar Jul 28 '20 06:07 wxthss82

I was able to convert to onnx.

  • While creating the model we had to pass onnx_export=True.
  • A couple of places that didn't shift swish from memoryEfficientSwish to Swish which I also linked with the onnx_export to change it.
  • Changed #h, w = x.shape[-2:] to h, w = x.cpu().detach().numpy().shape[-2:].
  • Opset >= 11

After doing this I get the onnx file. But, when converting to tensorRt, upSample is causing issues. If anyone can help with that then do tell me.

romil611 avatar Jun 12 '21 15:06 romil611

Upsample causing issues for me too, documenting here: https://github.com/NVIDIA/Torch-TensorRT/issues/961

dav-ell avatar Apr 05 '22 18:04 dav-ell

I've successfully convert it to TensorRT version for inference. Kindly check it here: https://github.com/kongyanye/EfficientDet-TensorRT

kongyanye avatar Jun 16 '22 08:06 kongyanye

Also checkout https://github.com/NVIDIA/TensorRT/tree/main/samples/python/efficientdet

romil611 avatar Jun 17 '22 10:06 romil611

I've successfully convert it to TensorRT version for inference. Kindly check it here: https://github.com/kongyanye/EfficientDet-TensorRT

Amazing work! Thanks very much for sharing. I noticed, though, that you didn't include fold_constants=True in your export to ONNX -- I had to include that or else my conversion to TensorRT would fail. I also had to be running a version of TensorRT newer than 7.1.3. I'd also be curious to see what kind of performance boost you're getting and if you've tried it with Triton? Will leave an issue on your repo.

Also checkout https://github.com/NVIDIA/TensorRT/tree/main/samples/python/efficientdet

Yes, I've been aware of this one, but it's based on the TensorFlow version. It's not so important that EfficientDet itself is exported, but that a PyTorch version that I can make changes to is exported.


In a related note, does anyone know if TensorRT supports efficient separable convolutions? This model has tons of them, and it slightly slows down performance without a special optimization like they have in TensorFlow.

dav-ell avatar Jun 17 '22 13:06 dav-ell