Rolf's Personal Playground

Jetson AI Fundamentals (Dana Sheahen)

2021-03-20, Material of Dana Sheahen

https://courses.nvidia.com/courses/course-v1:DLI+S-RX-02+V2/info

https://blogs.nvidia.com/blog/2016/07/29/whats-difference-artificial-intelligence-machine-learning-deep-learning-ai/


Fig.: JupyterLab Interface. Source: NVIDIA Course Getting Started with AI on Jetson Nano, Dana Sheahen

Get / run Docker Image

USB Cam Version

sudo docker run --runtime nvidia -it --rm --network host \
    --volume ~/nvdli-data:/nvdli-nano/data \
    --device /dev/video0 \
    nvcr.io/nvidia/dli/dli-nano-ai:v2.0.1-r32.5.0

# PW: dlinano

CSI Cam Version

# Two CSI cams version! video0, video1
sudo docker run --runtime nvidia -it --rm --network host \
    --volume ~/nvdli-data:/nvdli-nano/data \
    --volume /tmp/argus_socket:/tmp/argus_socket \
    --device /dev/video0 \
    --device /dev/video1 \
    nvcr.io/nvidia/dli/dli-nano-ai:v2.0.1-r32.5.0
    
# PW: dlinano

Change Keyboard Configuration on Console. Important!

Before you change the boot target (aka runlevel) to multi-user.target, i.e. without GUI, you should change the keyboard configuration first in case you are not using an English keyboard layout. A wrong keyboard layout can cause a lot of trouble. It can even prevent you from logging in when your password is using characters affected by the layout configuration.

Open a terminal window and execute sudo dpkg-reconfigure keyboard-configuration.

Test it on a tty terminal, too, because that is what you get if you change the runlevel to other than graphical.

Press <crtl> + <alt> + '1' to get to a tty terminal. Test your credentials. A wrong keyboard layout may compromise your password typing.

Change target / runlevel

systemctl get-default 

# change target of current session
systemctl isolate multi-user.target 
# systemctl isolate graphical.target # Use this to get back to graphical mode

# set default target
systemctl set-default multi-user.target
# systemctl set-default graphical.target # Use this to get back to graphical mode

Kitchen Experiments (2021-01-27)

Running the 'Hello AI World' Examples (Repo jetson-inference)

Software by Dustin Franklin, NVIDIA: https://github.com/dusty-nv/jetson-inference

For his examples I am using Jetpack 4.5

Start Docker Container

Input Streams are listed here:

* Video Streaming, camera settings, devices, input streams

The cameras must be connected before starting the docker container. The docker image detects the connected cams during the start phase.

cd jetson-inference
docker/run

It starts the docker container as an interactive session.

First camera test: video-viewer

Inside the running docker container instance the application video-viewer can be executed on the command line. It connects to the camera device defined in the first command line argument and opens a view port (window) to show the camera stream.

# My Jetson Nano 4BG B01 kit has two cams connected via flex flat band cable (ffc) 
video-viewer csi://0 
video-viewer csi://1 

video-viewer csi://0 & video-viewer csi://1 

# External USB cam is enumerated as video2
video-viewer v4l2:///dev/video2

Object Detection

python3 my-detection_video2.py

Semantic Segmentation

segnet --network=fcn-resnet18-mhp /dev/video2

Headless with Xfce4

Alternative to remote desktop! Usually remote desktop clients require a full desktop environment including connected monitor(!) which can be controlled remotely. I don't like it!

Let's go for some terminal based X11 solution!

TTY Console Keyboard

Press <alt>-<ctrl> F2 get a tty terminal. You may have to press <enter> to activate the screen.

login.

Then call localectl to list all locale tettings. In order to change the keyboard to German execute:

locale set-keymap de

When you login the next time the keyboard map is changed. Check it again with localectl.

VC Keymap: de should be set now.

Change the Desktop Environment

sudo -i
service --status-all
dpkg-reconfigure lightdm
# dpkg-reconfigure gdm3

Jetson Nano B01 - Dual RPi Cameras + how to get faster frame rates

Dual Cam Multi-Threading, Haar Face Detector

https://youtu.be/GQ3drRllX3I

Headless

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-18-04

https://www.tightvnc.com/download.php

https://freundschafter.com/research/how-to-install-xfce-and-vnc-on-a-headless-ubuntu-18-04/

Old

CompuLab Display Emulator (fit-Headless)

This emulator appears to the Jetson to be a HDMI monitor. X11 and the desktop

Allow X without HDMI at Boot:

Edit /etc/X11/xorg.conf

Section "Device"
...
...
Option "AllowEmptyInitialConfiguration" "true"
EndSection

Which will allow X11 to startup without a monitor attached.

Source: https://www.jetsonhacks.com/2016/05/03/jetson-allow-graphics-without-hdmi/

Boot Targets aka Runlevel

Source: https://www.tecmint.com/change-runlevels-targets-in-systemd/

systemctl get-default 

# change target of current session
systemctl isolate multi-user.target 
systemctl isolate graphical.target

# set default target
systemctl set-default multi-user.target
systemctl set-default graphical.target