Tensorflow compatibilty issue

Hi team,

I am using tensorflow version 2.15.0 on my linux machine x86_64 having CUDA 11.5 version and python 3.9.13 for CNN model training purpose whose backbone is Resnet. I successfully trained the model and got the expected result on unseen data while inferencing.

Now i want to deploy the model on jetson nano developer kit aarch64 which is using jetpack 4.6.5 and cudart10.2 where i successfully installed tensorflow version 2.3.1 and python version 3.6.

The problem is tensorflow version mismatch and architecture difference.

To overcome this which is the best way .

Follow below things i tried so far

  1. tried to have same tensorflow version on jetson nano i.e 2.15.0 but it won’t ssupport.

  2. tried to convert model to tflite format which is achieved and also i did the changes as per that but didn’t succeed

  3. tried to convert model to tensorrt format on my training machine using ONNX but that is not working .

From the above ways which one is more feasible, please let me know and

Is there any thing i am missing if yes please let me know .

Hi,

The latest TensorFlow for Jetson Nano is v2.7.
Does your model work on TensorFlow v2.7 or require the features in the newer version?

https://developer.download.nvidia.com/compute/redist/jp/v461/tensorflow/

Thanks.

Hi ,

I tried to install tensorflow version v2.7 for same python version 3.6, but it is giving error as
ERROR: Failed building wheel for h5py
After that i checked the below discussion to resolve h5py problem

and i follow the step for Python 3.6+JetPack4.6.3 then also i am getting h5py issue
Failed to build h5py
ERROR: Could not build wheels for h5py, which is required to install pyproject.toml-based projects

I am using jetpack 4.6.5

Now i am able to do inferencing using below whl file and python3.9 on my jetson nano.
tensorflow_aarch64-2.15.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Now i can see the inference time is 23s but on my training machine it was in miliseconds . I want to make sure that it is utilizing GPU power or not ?
If not then please let me know how to use the computation power

Hi,

No, the package you use doesn’t have GPU enabled.
Please follow the steps in the above topic to install TensorFlow v2.7.

If you still meet an error from h5py, please share the complete output log.

Thanks.

i have successfully installed tensorflow 2.7 and python 3.6 version in a conda env.
i am able to import it and i can see it is able to detect gpu
But while i am running my script which is also has cv2 also for basic image loading and processing
I am getting below error
Traceback (most recent call last):
** File “model.py”, line 125, in **
** class DecodePredictions(tf.keras.layers.Layer):**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py”, line 62, in getattr**
** module = self._load()**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py”, line 45, in _load**
** module = importlib.import_module(self.name)**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/importlib/init.py”, line 126, in import_module**
** return _bootstrap._gcd_import(name[level:], package, level)**
** File “”, line 994, in _gcd_import**
** File “”, line 971, in _find_and_load**
** File “”, line 941, in _find_and_load_unlocked**
** File “”, line 219, in _call_with_frames_removed**
** File “”, line 994, in _gcd_import**
** File “”, line 971, in _find_and_load**
** File “”, line 941, in _find_and_load_unlocked**
** File “”, line 219, in _call_with_frames_removed**
** File “”, line 994, in _gcd_import**
** File “”, line 971, in _find_and_load**
** File “”, line 941, in _find_and_load_unlocked**
** File “”, line 219, in _call_with_frames_removed**
** File “”, line 994, in _gcd_import**
** File “”, line 971, in _find_and_load**
** File “”, line 955, in _find_and_load_unlocked**
** File “”, line 665, in _load_unlocked**
** File “”, line 678, in exec_module**
** File “”, line 219, in _call_with_frames_removed**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/init.py”, line 20, in **
** from keras import distribute**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/distribute/init.py”, line 18, in **
** from keras.distribute import sidecar_evaluator**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/distribute/sidecar_evaluator.py”, line 22, in **
** from keras.optimizers.optimizer_experimental import (**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/optimizers/init.py”, line 26, in **
** from keras.optimizers.legacy import adadelta as adadelta_legacy**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/optimizers/legacy/adadelta.py”, line 17, in **
** from keras.optimizers.optimizer_v2 import adadelta**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/optimizers/optimizer_v2/adadelta.py”, line 21, in **
** from keras.optimizers.optimizer_v2 import optimizer_v2**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/optimizers/optimizer_v2/optimizer_v2.py”, line 26, in **
** from keras import initializers**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/initializers/init.py”, line 22, in **
** from keras.initializers import initializers_v2**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/initializers/initializers_v2.py”, line 23, in **
** from keras.dtensor import utils**
** File “/home/shikhar/archiconda3/envs/py36tf27/lib/python3.6/site-packages/keras/dtensor/init.py”, line 22, in **
** from tensorflow.compat.v2.experimental import dtensor as dtensor_api**
ImportError: cannot import name ‘dtensor’

Does it mean my model can only run on tensorflow 2.15.0 ?

Hi,

The error seems relate to the TensorFlow and Keras compatibility.
Which Keras version do you install?

Could you try to downgrade the Keras version to 2.6 as mentioned in the below link:

Thanks.

Hi , i am getting the error of h5py installation while installing tensorflow 2.7 in a env having python 3.6

Hi,

The error is truncated. Could you share the complete log with us?

On JetPack 4, please verify your Cython version is 2.x.

$ sudo pip3 install --verbose 'protobuf<4' 'Cython<3'

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.