visionml / pytracking

Visual tracking library based on PyTorch.
GNU General Public License v3.0
3.19k stars 603 forks source link

TensorRT Conversion of KeepTrack #425

Open PradhanSomu opened 5 months ago

PradhanSomu commented 5 months ago

I am attempting to convert the pretrained weights of the KeepTrack model to TensorRT for inference. As I am new to TensorRT and ONNX, I would greatly appreciate any guidance or suggestions on how to successfully complete this conversion process.

daisatojp commented 5 months ago

Hi. There is a related issue. I'm glad if it helps you. https://github.com/visionml/pytracking/issues/333

iMaTzzz commented 5 months ago

Hi, I'm currently trying to export object tracking models to onnx format and I may not immediately help you but I can give you some insight on what to do:

Basically the steps to export a model to onnx format for inference is simply provide torch.onnx.export (or torch.onnx.dynamo_export) an instance of the model and a dummy input. It will trace the model and capture a static computational graph. You could also use torch.onnx.dynamo_export to do same thing but keeping the dynamic nature of the model. You can look into the details here. But it's sadly not that simple with state-of-the-art models for multiple reasons:

The only available code I found in object detection (sadly not in object tracking) that actually exports recent models to onnx format was made by open-mmlab: mmdeploy

Feel free me to correct me if I'm wrong ! I will also try to write some code to export the TaMOS model so I will try to follow up in a few days.