# Easy keras-TF docker file?

**URL:** <https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441>\
**Category:** Jetson Xavier NX\
**Tags:** docker\
**Created:** [November 25, 2020, 10:08pm UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441 "2020-11-25T22:08:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnsmiscstuff](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@johnsmiscstuff](https://forums.developer.nvidia.com/u/johnsmiscstuff)\
**Post date:** [November 25, 2020, 10:08pm UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/1 "2020-11-25T22:08:35Z")

</div>

Hello all! Anybody know of any good docker images that’ll run on a Xavier NX with a Keras frontend for TF? I note that NGC files don’t have keras in the docker files, due to its rapid changes and the fact that it can be a frontend for multiple things. I tried just running “pip3 install keras” in the m4L container (and it said it worked), but then started getting errors about having the wrong tensorflow installed when I wanted to import things. I just want one that works out of the box!

And yes, I know, training my own models on the xavier is going to be comparatively slow. It’s my only option right now, unless someone at NVidia has a spare 3080 laying around in the back I can buy! (My ancient geforce 760 won’t run modern tensorflow, haha). And yes, I see that pytorch is on plenty of the NGC docker files, but I’m more well-versed in keras! I could probably pick pytorch up quickly enough, but kinda don’t want to!

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [November 26, 2020, 3:02am UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/3 "2020-11-26T03:02:50Z")

</div>

Hi,

Keras is integrated into the TensorFlow package.  
So you can use either [**l4t-tensorflow**](https://ngc.nvidia.com/catalog/containers/nvidia:l4t-tensorflow/) or [**l4t-ml**](https://ngc.nvidia.com/catalog/containers/nvidia:l4t-ml) container.

For example:

```auto
$ sudo docker run -it --rm --runtime nvidia --network host nvcr.io/nvidia/l4t-tensorflow:r32.4.4-tf2.3-py3

```

```auto
>root@nvidia-desktop:/# python3
Python 3.6.9 (default, Oct 8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tensorflow import keras
2020-11-26 02:57:27.379252: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.2

```

Thanks.

---

<div class="post-metadata">

**Author:** ![johnsmiscstuff](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@johnsmiscstuff](https://forums.developer.nvidia.com/u/johnsmiscstuff)\
**Post date:** [November 26, 2020, 4:04pm UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/4 "2020-11-26T16:04:08Z")

</div>

Aaaah. Oops! I got confused. I was trying to use [image\_dataset\_from\_directory()](https://keras.io/api/preprocessing/image/) and was having a lot of import problems, and assumed the whole library was missing. It looks like maybe that bit of preprocessing is not in all the tf installs? An issue thread I saw with it said that I need to install tf-nightly to get at it. I tried `pip3 install tf-nightly` in the container but it couldn’t find it. Any advice there? Thanks for your help!

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [November 27, 2020, 3:56am UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/5 "2020-11-27T03:56:20Z")

</div>

Hi,

We can run ` import tensorflow.keras.preprocessing` without issue on the **l4t-tensorflow:r32.4.4-tf2.3-py3** image.  
Please also give it a try.

For Jetson, you won’t be able to install tensorflow through \*pip3ˇ directly since it is an ARM system.  
More, if the community recommends you to install the nightly build, it is quite possible that the fix is merged into the latest TensorFlow already.

Thanks.

---

<div class="post-metadata">

**Author:** ![johnsmiscstuff](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@johnsmiscstuff](https://forums.developer.nvidia.com/u/johnsmiscstuff)\
**Post date:** [November 27, 2020, 8:05pm UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/6 "2020-11-27T20:05:49Z")

</div>

Here’s a screenshot of what happens when I attempt to import the function in question on the Jetson. Note, this is in the l4t-ml container.

Here’s a stack overflow thread on it, for reference (or for anyone else coming along looking for an answer to the same question)  
Thanks for helping!  
 ![image](https://global.discourse-cdn.com/nvidia/original/3X/9/8/9887b6b847e2bd402d9ea8663d90c04ff98a7898.png)

---

<div class="post-metadata">

**Author:** ![johnsmiscstuff](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@johnsmiscstuff](https://forums.developer.nvidia.com/u/johnsmiscstuff)\
**Post date:** [November 27, 2020, 8:06pm UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/7 "2020-11-27T20:06:31Z")

</div>

Doh, didn’t include SO link:

> <https://stackoverflow.com/questions/62409838/error-in-loading-image-dataset-from-directory-in-tensorflow>

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [November 30, 2020, 4:13am UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/8 "2020-11-30T04:13:19Z")

</div>

Hi,

Which TF version do you use?

The link indicates the module haven’t been included into the v2.1.x or v2.2.0.  
But in our latest docker, TensorFlow version is already v2.3 and the module can be imported without issue.

Thanks.

---

<div class="post-metadata">

**Author:** ![nadeemm](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/nadeemm/32/367020_2.png) [@nadeemm](https://forums.developer.nvidia.com/u/nadeemm)\
**Post date:** [October 18, 2021, 6:42pm UTC](https://forums.developer.nvidia.com/t/easy-keras-tf-docker-file/160441/10 "2021-10-18T18:42:45Z")

</div>

Closed on October 18, 2021, 6:42pm UTC


