Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load converted model to cpu-tflite #320

Open
kossyrev-bg opened this issue Jan 9, 2025 · 0 comments
Open

Unable to load converted model to cpu-tflite #320

kossyrev-bg opened this issue Jan 9, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@kossyrev-bg
Copy link

Please do not disclose security vulnerabilities as issues. See our security policy for responsible disclosures.

Describe the bug

Explain the behavior you would expect and the actual behavior.

To reproduce

On an AXIS M3067-P, I attempted to load RT-DETRv2 converted to tflite, using the app build from object_detection. I immediately hit the could not allocate tensors error from calling the larodLoadModel function. The model is unfortunately too big to upload, but I will post a snapshot of netron.

Steps to reproduce the behavior:

  1. Clone RT-DETRv2 repo
  2. Download the v2 Small checkpoint
  3. Install python requirements:
torch
torchvision
onnx
onnxruntime
tensorflow
tf_keras
pycocotools
PyYAML
scipy
psutil
onnx_graphsurgeon
IPython
onnx-simplifier
onnx2tf
simple_onnx_processing_tools
  1. Run the below to export model to onnx:
python3 tools/export_onnx.py -c <path to repo>/rtdetrv2_pytorch/configs/rtdetrv2/rtdetrv2_r18vd_120e_coco.yml -r <path to downloaded model>/rtdetrv2_r18vd_120e_coco_rerun_48.1.pth --check

4.5. Note that I had to comment out the dynamic_axes=dynamic_axes step in the export_onnx file otherwise the next step would fail
5. Run onnx2tf to export the model to onnx:

onnx2tf -i <path to model>/model.onnx
  1. This generates a folder of saved_model.
  2. Modify the Dockerfile in object_detection to import that model instead of downloading it from google. No need to modify labels file import; the model uses COCO labels
  3. Build the app using ARCH=armv7hf and CHIP=cpu
  4. Upload to the camera, start the app and see the failure

Screenshots

image

Environment

  • Axis device model: M3067-P
  • Axis device firmware version: 11-something

Additional context

Add any other context about the problem here.

@kossyrev-bg kossyrev-bg added the bug Something isn't working label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant