Issue with Running D2Go Model on Android Using PyTorch Android Lite

Hello,

I trained and exported a model using Detectron2’s D2Go with the following environment:

  • PyTorch version: 2.0.1+cu118
  • CUDA version (used by PyTorch): 11.8
  • torchvision version: 0.15.2+cu118
  • OpenCV version: 4.7.0
  • NumPy version: 1.24.1
  • detectron2 version: 0.6
  • Python version: 3.10

The model performed excellently in my tests, including when I uploaded and tested the exported mobile model.

However, I’m encountering an issue when trying to use the model on Android. My Android environment uses:

  • PyTorch Android Lite version 1.13.1
  • TorchVision Ops version 0.14.0

I was able to load the model successfully, but when I try to perform a forward pass for detection, I consistently receive a tuple of size 4, with each element of the tuple being empty.

I suspect that the issue might be due to version discrepancy, where the versions used to create the model are more advanced than the versions I’m using on Android.

Is there a light version of PyTorch Android Lite compatible with PyTorch version 2.0.1+cu118? Or is there any other potential solution or workaround to this issue?

Thank you in advance for any help or guidance.