Pages

Wednesday, 15 May 2019

Getting started with the Jetson Nano - part 3

Jetson Nano image courtesy of NVIDIA/Pimoroni
In part 2 of this series you prepared your Jetson Nano for software installation.

In this part you'll install Jupyter Notebook, Jupyter lab, TensorFlow and some other software that is needed to run the first TensorFlow notebook.

Once started, you can leave the software installation to run; it takes about an hour on a Nano in 10W power mode. It probably takes a little longer if you're using a 2.5A supply.

There's a final manual stage which takes a couple of minutes.

When that's complete you'll be able to work through the TensorFlow example, training a Neural Net to recognise item images from a Fashion database and then testing it in previously unseen images.

Here's what you'll do, in a little more detail.

Installing the software


Open a terminal window on the Nano  (A short-cut,  crl-alt-T should do it).

You'll be in your home directory; type

git clone https://github.com/romilly/nano.git

You should see a message 'cloning into nano' followed by some descriptive text.

Next, change into the newly-created nano directory and list the contents. Type

cd nano
ls 

You should see a display like this: 



Now change into the scripts directory, prepare the scripts for execution, and check the contents. Type

cd scripts
chmod a+x *.sh
ls

The result should look like this:







If you're cautious (and you should be!) you can check the contents of the scripts before you run any of them. You can use the linux cat command. Type

cat nano-tf-01.sh

The result should look like this:


The script has comments which explain what each line does.

You're ready to start installation.

Type

sudo -H ./nano-tf-01.sh


You will be asked for your password. Enter it.

The installation process will start. You can go and drink a coffee, cook a meal, or do a run - the installation should need no input, but it will take an hour or more.

The final screen should look something like this:


 Nearly there! The next steps will only take a couple of minutes.


Configure Jupyter 



Now you need to configure Jupyter Notebook ready for use.

You had to run the previous command as the super-user, using the sudo command, but you shouldn't do that for the next command. Just type

./configure-jupyter.sh

That will set up the Jupyter notebook with nano as its password.

If you want a different password - foo for example - you could instead type

./configure-jupyter.sh foo

One more step and you'll be ready to go. The next step will install the Jupyter server as a service. In other words, Jupyter will start up whenever the Nano is rebooted. Since you are changing the system configuration, you will need to run the final script as sudo. Type

sudo ./install-service.sh

Which will install the service and start it.

To check that it's running, go to a computer on your local network and open a browser on

http://:8888

Where is the hostname you chose when installing Ubuntu on your Nano.

You'll be asked for a password. Enter nano, or the password you chose just now when configuring Jupyter, if you decided not to accept the default.

You should see a screen like this:


Fantastic! You now have a powerful Deep Learning laboratory ready for your experiments.

And there's more good news. From now on, you have a choice. You can continue to use your Nano with a monitor, mouse and keyboard, or you can use it remotely from any computer on your network. That's how I work.

If you want to un-clutter your workspace by removing the monitor, mouse and keyboard, the next step will involve

  1. shutting down your Nano (see below)
  2. removing power.
  3. unplugging the peripherals, and then
  4. reapplying power

There are two ways you can shut down the Nano. You could use the mouse to click on the power icon at the top right of the Ubuntu desktop, but that won't work once you start running the Nano headless (without keyboard, mouse and monitor attached).

Instead you can shut the nano down from the browser window! Here's a short video:



To do that,

  1. Click on the terminal icon in the launcher window. A terminal window will open.
  2. In the terminal window, type sudo shutdown now -h 
  3. When prompted, enter your password.
In a couple of seconds yoiu should see the green light on the Nano go out, It is now safe to remove poser by unplugging the power supply. You can close the browser tab containing the Jupyter interface.

Unplug the monitor, mouse and keyboard. If you want to, you can move the Nano to a new home at this stage. Remember that it will need power and an Ethernet connection in its new home!

Once the Nano is where you want it, make sure the Ethernet cable is plugged in and apply power. The green light on the Nano will come on again.

Give the nano a few seconds to boot up and open a browser window on the same url as before: http://:8888

Once again, you'll be asked for the Jupyter password. Next you'll open a Jupyter Notebook and run your first TensorFlow example.

Below, you'll find step by step instructions. First, a video.



Here's what you need to do:

  1. In the left-hand pane, click on notebooks.
  2. Click on basic-classification.ipynb. The notebook will open.
  3. Click on the run menu and chose run all cells.
Jupyter will run each code cell in the notebook, displaying the results as the code completes. You'll see some of the fashion images that the notebook is using to traint the network, and at the end you'll see how well images are classified once training is complete.

If you're new to Deep Learning, Jupyter or TensorFlow you may not follow everything that's going on.

Don't worry.

The next posts will take a much slower-paced run through another notebook, with more detailed explanation, and introduce the ideas of model import and export, and  transfer learning.

To make sure you don't miss out on future posts, follow me (@rareblog) on twitter.



















1 comment: