Xavier NX and TensorFlow Object Detection

Hi, I have been trying to install the TensorFlow Object Detection API in the NX. I am following this tutorial: Installation — TensorFlow 2 Object Detection API tutorial documentation

Once I started to install it, pip goes on an endless loop trying to install scipy with this message:
INFO: pip is looking at multiple versions of scipy to determine which version is compatible with other requirements. This could take a while.

For curiosity’s sake, I removed scipy from the required packages but the I get this error:

ERROR: Cannot install object-detection because these package versions have conflicting dependencies.

The conflict is caused by:
tf-models-official 2.4.0 depends on tensorflow-addons
tf-models-official 2.3.0 depends on tensorflow-addons
tf-models-official 2.2.2 depends on tensorflow-addons
tf-models-official 2.2.1 depends on tensorflow-addons
tf-models-official 2.2.0 depends on tensorflow-addons

To fix this you could try to:

  1. loosen the range of package versions you’ve specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

ERROR: ResolutionImpossible: for help visit User Guide - pip documentation v22.3.dev0

After looking this up, I found that tensorflow-addons is not officially supported on ARM architectures.

Where do I go from here? Is TFOD supported in the NX? If so, how can I go about fixing these issues? Thanks.

Hi,

Please use pip3 instead.
Due to the EOL of python 2, it’s expected to setup all the environment with python3.

Thanks.

I used pip3 + virtualenv but I am getting the same issue.

Hi,

Do you follow the installation instructions below:

Thanks.

When I used the docker install, I get this error:

docker build -f research/object_detection/dockerfiles/tf2/Dockerfile -t od .
Sending build context to Docker daemon 660.9MB
Step 1/15 : FROM tensorflow/tensorflow:2.2.0-gpu
—> f5ba7a196d56
Step 2/15 : ARG DEBIAN_FRONTEND=noninteractive
—> Using cache
—> 25924626fbf7
Step 3/15 : RUN apt-get update && apt-get install -y git gpg-agent python3-cairocffi protobuf-compiler python3-pil python3-lxml python3-tk wget
—> Running in 5165b6b7bd79
standard_init_linux.go:211: exec user process caused “exec format error”
The command ‘/bin/bash -c apt-get update && apt-get install -y git gpg-agent python3-cairocffi protobuf-compiler python3-pil python3-lxml python3-tk wget’ returned a non-zero code: 1

Using the Python package install gives me the same issue as before.

Hi @ig-j, it’s because this is a base container that was built for x86, not aarch64. You will encounter “exec format error” when you try to run an x86 binary on aarch64 (or vice versa)

On Jetson, it’s recommended to use the l4t-tensorflow or l4t-ml container as base.

Hi @dusty_nv, can I run the object detection API in that container then? I’m still quite new to all of these.

Hi @ig-j, sorry for the delay - you will want to change the FROM statement at the top of that Dockerfile to one of the l4t-tensorflow or l4t-ml containers. Then it will use an aarch64 base container instead of x86_64 base container.

BTW you will want to pick one of the l4t-tensorflow/l4t-ml containers that has the same L4T version as you are running (which you can check with cat /etc/nv_tegra_release). For example, if you are running L4T R32.5.0 or R32.5.1, you can use nvcr.io/nvidia/l4t-tensorflow:r32.5.0-tf2.3-py3

@dusty_nv, no worries, I was able to run the Dockerfile all the way the the very end but I get the same issue as before. Pip kept on installing multiple version of scipy. Should I let it run?

I notice that the docker container is using TF2.3(from the name) but right now, I am using TF2.4 that I got from here: https://docs.nvidia.com/deeplearning/frameworks/install-tf-jetson-platform/index.html

Would the container work with TF2.4 as well?

Sorry for the delay - I’ve not yet updated these containers for the TF2.4 wheels, but if you wanted you could build the containers for TF2.4. Essentially you would replace the URL/filename of the TF2.3 wheel with the TF2.4 wheel here:

Hi i have been trying to do the same thing, running TFOD on jetson xavier. I also came across the same issue of mutiple installation of scipy. Did u find a way around this, and are u able to get TF object detection up and running on ur jetson?

just need to manually build tensorflow-addons module before running
python -m pip install .