~~NOTOC~~
====== 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/
* Install JetPack 4.5.1 on SD card
* Get the right Docker container. The list of different software combinations can be found here: \\ https://ngc.nvidia.com/catalog/containers/nvidia:dli:dli-nano-ai
{{https://dli-lms.s3.amazonaws.com/data/c-rx-02/images/jupyter_legend.png?400&direct}} \\
//Fig.: JupyterLab Interface.// Source: NVIDIA Course [[https://courses.nvidia.com/courses/course-v1:DLI+S-RX-02+V2/info|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 '' + + '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:
* [[https://github.com/dusty-nv/jetson-inference/blob/master/docs/aux-streaming.md|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
{{ workshops:nvidia_jetson:jetson:playground:rolf:desk_setup_img_20210127_230325.jpg?direct&600 |}}
{{ workshops:nvidia_jetson:jetson:playground:rolf:object_detection_img_20210127_230454.jpg?direct&600 |}}
{{ workshops:nvidia_jetson:jetson:playground:rolf:object_detection_vid_20210127_230401.mp4 |}}
==== 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!
* https://opensource.com/article/21/1/remote-configuration-xfce4
* [[https://www.jetsonhacks.com/2020/11/07/save-1gb-of-memory-use-lxde-on-your-jetson/|Save 1GB of Memory! Use LXDE on your Jetson]], by Jim from JetsonHacks
{{youtube>9bACmWg0bvs?medium}}
===== TTY Console Keyboard =====
Press ''- F2'' get a tty terminal. You may have to press 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
{{youtube>GQ3drRllX3I?medium}}
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/
* Run level 0 is matched by poweroff.target (and runlevel0.target is a symbolic link to poweroff.target).
* Run level 1 is matched by rescue.target (and runlevel1.target is a symbolic link to rescue.target).
* Run level 3 is emulated by multi-user.target (and runlevel3.target is a symbolic link to multi-user.target).
* Run level 5 is emulated by graphical.target (and runlevel5.target is a symbolic link to graphical.target).
* Run level 6 is emulated by reboot.target (and runlevel6.target is a symbolic link to reboot.target).
* Emergency is matched by emergency.target.
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