/DeepNano

This project contains a set of scripts to facilitate the setup of the Jetson Nano for doing Deep Learning with Tensorflow 2.0 (and also with Coral TPU Edge)

Primary LanguageJupyter NotebookMIT LicenseMIT

DeepNano

This project aims to provide a couple of script to automate the setup of a Jetson Nano for Deep Learning at Edge with Tensorflow.

The scripts will :

  • Update the system
  • Create a Python3.6 virtual environment and install usefull packages
  • Install Visual Studio
  • Install the Coral TPU Edge
  • Build and Install Bazel (in order to build Tensorflow)
  • Build and Install Tensorflow 2.0 for Jetson Nano (aarch64 with CUDA support)

Be aware that the setup can takes 1-2 days if compiling bazel and Tensorflow (a bit more than 1 day just to compile Tensorflow natively on the Jetson Nano. Cross-compiling might be considered to speed up the compilation from sources)

Prerequisites

  • Install a Fan on the Jetson Nano in order operate at max power
  • Download and install the Jetson Nano Developer Kit SD Card Image with JetPack 4.2.2 on a 64GB SD Card
  • Boot on the Jeston Nano with this SD card (Make sure to power the Nano with a 4A power supply in order to operate in power mode0 MAXN)

How to use

  1. Clone this github project
  2. If you have already built a binary for Bazel and a Python wheel for Tensorflow, restore them at the following locations (You may also download my builds in the release section) :
  • /usr/local/bin/bazel
  • /opt/local/tmp/tensorflow_pkg/tensorflow-2.0.0-cp36-cp36m-linux_aarch64.whl
  1. Review the script and eventually customize the installation
  2. During the script execution, make sure to close all applications (except the Terminal to run the script). During the tensorflow compilation almost all the RAM + Swap memory will be used. Using other applications might cause a crash
  3. Execute the script NanoSetup.sh to configure the system on the SD card
  4. Make sure that that only one single USB drive is connected to the Jetson Nano. Then, execute the script Move2USB.sh to copy the system on the USB SSD drive and update the system to boot from it (Note: You might want to reuse this script in the future, in order to refresh your USB SSD drive with a fresh copy of the system located on the SD Card)

When using the Nano, make sure:

  • To execute your Tensorflow code inside the Python Virtual Environment
  • If you want to launch Jupyter Lab notebooks, first start the Chromium browser with the --no-sandbox or --disable-gpu option
# Manually using Jupyter Labd on the Jetson Nano
/opt/local/virtual-env/bin/activate bash 
chromium-browser --no-sandbox &
jupyter-lab --log-level='ERROR'

For convenience an alias jl has been define in the .bashrc (alias jl='(chromium-browser --no-sandbox &) ; jupyter-lab --log-level='\''ERROR'\''')

Jupyter Notebook experiments - Work In progress

A Jupyter Notebook is provided to experiment with Tensorflow 2.0 on the Jetson Nano and Coral Edge TPU.

This notebook does not aim to serve as a benchmark. It is intended at exploring the possibilities/capabilities with this setup. It can also serves as a quick reference guide for using the tf.lite API. (Also remember that these devices are intended for inference. They are not designed for training. That being said, the Jetson Nano is not bad at training a rather basic Neural network!)

Copyright acknowledgements and usefull links

MIT License

My Hardware setup

TODO add screenshots

(and of course a Monitor, a Keyboard and a Mouse)