Run the sample "Introduction to TensorFlow Development" on Jetson nano

Can be used in the field! Introduction to TensorFlow Development Deep Learning Model Construction Method by Keras 書影

I tried to copy this book or download a sample and try to run it, but because the version of tensorflow is 1.15, I could not move it obediently with NVIDIA L4T ML provided by Nvidia NGC.

So, I built a Docker environment so that the sample of tensorflow 1.15 can be run almost as it is.

Preparation

Build failed without adding swap to Jetson nano. Create a swap file of about 6GB. → https://qiita.com/n-yamanaka/items/dd82996312ab333fe9b2

Dockerfile

I uploaded it to github. → https://github.com/Nunocky/JetsonNano_Docker_Containers

FROM nvcr.io/nvidia/l4t-tensorflow:r32.4.4-tf1.15-py3
   
RUN apt-get update
RUN apt-get install -y fonts-ipaexfont
RUN apt-get install -y libffi-dev
RUN apt-get install -y python-pip
RUN apt-get install -y python3-pip
RUN pip3 install -U pip
RUN pip3 install notebook
RUN pip3 install matplotlib
RUN pip3 install pandas
RUN pip3 install scipy
RUN pip3 install opencv-contrib-python

RUN mkdir /tf
RUN chmod 777 /tf

ADD jupyter_notebook_config.py /root/.jupyter/

CMD ["jupyter", "notebook"]

Prepare jupyter_notebook_config.py in the same location as Dockerfile. I set the Jupyter notebook password to jetsonnano. If you want to change your password You can refer to here.

jupyter_notebook_config.py


c.NotebookApp.notebook_dir = '/tf'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$kDrfziXaxPvbrLZfP2oTKA$zSNR85lqmziWEVjx/ApauQ'    

Build if you can do so far

sudo docker build -t tensorflow:1 .

It takes several hours to build matplotlib, opencv, etc.

Run

sudo docker run -it --rm --runtime nvidia --network host tensorflow:1

You don't have to delete the work record by associating the host directory with /tf on the docker container with the -v``` option at startup, but that's the basic story of docker, so I'll omit it.

tensorboard is executed by docker exec from Jetson nano.

sudo docker exec -it <container id> tensorboard --host 0.0.0.0 --logdir /tf/log --port 6006

Note

The sample from Chapter 10 that handles a large number of images may not work with ResourceExhaustedError as it is.

In that case, adjust the number of batches and epochs and change the size of the data passed to the GPU.

Corrective action for tensorflow error "tensorflow.python.framework.errors_impl.ResourceExhaustedError: 2 root error (s) found." In deep learning

Recommended Posts

Run the sample "Introduction to TensorFlow Development" on Jetson nano
Run the sample "Introduction to TensorFlow Development" on Jetson nano
Steps to install Maven on Mac and use it in Eclipse
Introduction to Slay the Spire Mod Development (1) Introduction
Introduction to Keycloak development
Introduction to Slay the Spire Mod Development (2) Development Environment Construction
Tips around the sample to release Java Lambda on CodePipeline
How to run React and Rails on the same server
Introduction to Slay the Spire Mod Development (3) Original Card Definition
How to run a Kotlin Coroutine sample from the command line
Install Ubuntu20.04 on RaspberryPi 4 and build Kubernetes to run the container
Steps to run docker on Mac
How to run JavaFX on Docker
Try "Introduction to Vert.x" on Gradle
I tried migrating the portfolio created on Vagrant to the Docker development environment
Introduction to java for the first time # 2
Sample to display (head-up) notifications on Android
Run Embulk on Docker to convert files
How to change the timezone on Ubuntu
Output of the book "Introduction to Java"
Introduction to Docker / Kubernetes Practical Container Development
Pre-processing to display on the browser (compiler)
What to do if the rails server doesn't run out on AWS cloud9
Learn while making a WEB server Introduction to WEB application development from the basics