Export an object detection model into onnx

Hi everybody,

I’m trying to export the faster cnn model into onnx in order to use it with opencv, and get the following error :

/lib/python3.6/site-packages/torchvision/ops/poolers.py:101: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
  scale = 2 ** torch.tensor(approx_scale).log2().round().item()
RuntimeError: log2_vml_cpu not implemented for 'Long'

However it works fine when I try it with an image classification model, here is my code:

import sys as s
import torch.onnx
import torchvision.models
model = torchvision.models.detection.fasterrcnn_resnet50_fpn(pretrained=True)
dummy_input = torch.randn(1, 3, 800, 800)
nom = s.argv[1] + ".onnx"
torch.onnx.export(model, dummy_input, nom)

I also tried it with a segmentation model and got the exact same error, so what am I missing ?
thanks to those who will answer me