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)
- 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)
- Clone this github project
- 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
- Review the script and eventually customize the installation
- 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
- Execute the script
NanoSetup.sh
to configure the system on the SD card - 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'\'''
)
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!)
MIT License
- Nvidia forum discussion on buildling Tensorflow from sources (1)
- Nvidia forum discussion on buildling Tensorflow from sources (2)
- Nvidia forum discussion on buildling Tensorflow from sources (3)
- Nvidia forum discussion on Jupyter-lab error
- Nvidia forum discussion on compiling options
- GCC options for ARM
- Jetsonhacks tutorials & ressources
- Jetsonhacks tutorial to install a Fan
- Jetsonhacks tutorial to run from a USB drive
- Jetsonhacks tutorial to install a Swap File
- Jetsonhacks tutorial to install Visual Studio editor
- Headmelted Visual Studio Code for ARM platform
- Headmelted github code
- Tensorflow Lite Python Quickstart
- tensorflow Post training Quantization
- Inference on Coral TPU Edge with TensorFlow Lite in Python
TODO add screenshots
- Nvidia Jetson Nano
- Samsung 64GB Micro SD
- 5v 4A power supply - Adjust to your region
- Google Coral TPU Edge
- Noctua NF-A4x20 5V PWM Fan
- Intel Dual Band Wireless AC8265
- Wifi Antenna
- Samsung 250GB SSD T5
- Raspberry Pi v2 8MP camera
- Waveshare Jetson Nano case
- 2 x USB 3.0 to type C angle cable
(and of course a Monitor, a Keyboard and a Mouse)