Converting a fine-tuned TensorFlow2 object detection model for Jetson NANO

Hi,
I used the Tensorflow2 API to fine-tune an object detection model (ssd_mobilenet_v2_fpnlite_640x640) and make it recognize a custom object.

The model works perfectly on my PC, I have the trained model in saved format, and I was wondering how to export it to the Jetson NANO.

I tried using the tf2onnx repository, but when I try to convert my model I’m getting the error:

ValueError: StridedSlice: attribute new_axis_mask not supported

so, I’m assuming there are some parts in the model not supported in onnx. Just out of curiosity, I also tried converting to onnx the original, pre-trained model (as downloaded form the TF model zoo, without me fine-tuning it) but it also returned some similar errors.

So, I was planning on copying my saved model to the Jetson NANO and following this guide to optimize it with TensorRT, but before proceeding I wanted to ask:

  • once (if) I successfully optimize the model with TensorRT, how can I run it on the Jetson NANO? Do I need the TensorFlow object detection API to run on the device for it? Or can I somehow run it with detectnet?

  • if I need the object detection API, is there a RELIABLE guide on how to install it on the NANO? I followed a bunch of guides, but can’t seem to make it work. After compiling the protopuf files, I’m running the command:

    python -m pip install --use-feature=2020-resolver .

but the installation goes on forever, pip is going backwards through a bunch of versions of scipy without being able to solve the dependency.

  • are there any alternatives that I’m missing?

Hi,

1. If the model can run on TensorRT, you don’t need to install the TensorFlow Object Detection API.
But the workflow is TF->ONNX->TensorRT, it’s required to convert the model into ONNX format first.

2. Since ONNX doesn’t support your model currently, please run it through the TensorFlow Object Detection API instead.
Below is our document for installing the TensorFlow library on Jetson:
https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html

Then you can install the Objection API with the instruction from its GitHub.

Thanks.