Jetson TX2 is a power efficient embedded AI computing device from NVIDIA. It is a small computer, size of a credit card, but quite powerful. TX2 has 2 CPUs: ARM Cortex-A57 (quad-core) @ 2GHz and NVIDIA Denver2 (dual-core) @ 2GHz. And, of course, a computer from NVIDIA must have a GPU: 256-core Pascal @ 1300MHz. 8Gb memory is shared between CPU and GPU. All that computational might consumes just 7.5W of power. This is good hardware to run deep learning inference for embedded systems.
I’ve been playing with Jetson for a couple of days. My first objective is to flash it with all required software to be able to run Python programs that access camera input using OpenCV. Something simple: just get a video stream from a USB camera and output it to the screen.
Why I spent two days on this? First, it’s Linux, spending few days compiling libraries, installing dependencies and figuring out compatibility of different libraries is a typical experience when setting up a dev environment on Linux. I’m comparing it with Windows, where developer life is easier, perhaps, because Microsoft provides most developer tools, and you know that Microsoft builds great developer tools. Second, it’s ARM. Many libraries don’t have packages compiled for ARM architecture, so you would need to find where to get them or compile from source. Third, it’s cutting-edge technology where hardware, libraries, and frameworks are updates very often. With that breakneck speed, developers just don’t have time to rapidly update their software to be compatible with the latest version of everything else.
Below, I describe what I’ve tried to do, what issues I encountered and how I resolved them.
The first problem is how to flash the device with Ubuntu OS. The device comes with Ubuntu preinstalled, but it seemed like something was missing, e.g., I couldn’t find CUDA files. NVIDIA provides JetPack SDK that can flash your Jetson TX2 SDK with the latest OS image, install developer tools for the host PC and the TX2, and install the libraries and APIs, samples, and documentation. It is more than I need, but I thought it is a good start.
JetPack is intended to run on Ubuntu. I have Ubuntu machine for deep learning training, but I don’t connect it to a monitor. I tried to run JetPack on a VirtualBox VM on my Windows machine. Installation of software for the host PC (Ubuntu VM in that case) went fine, but it hanged on flashing the Jetson via USB. It seems like USB virtualization in VirtualBox doesn’t work well for this application. After all, I had to run JetPack on a physical PC with Ubuntu.
JetPack error messages are quite bad. If it fails, it typically tells you something like “Return code: 1”. I encountered an error once. The solution was to run chmod 7777 for the folder where the installer is located. It is certainly overkill, and some lower permissions would do, but it helped to unblock the process.
After JetPack flashed the OS and installed a bunch of software packages, I could connect to it via SSH. The next thing was to try to connect it to a monitor and see if I can use Ubuntu GUI. Jetson has HDMI port, so I connected it to my Dell U2713HM using HDMI-HDMI cable. Though it is a high-resolution monitor, it doesn’t support full resolution via HDMI. Jetson tried to send 2560×1440 video to the monitor, but it could accept only 1920×1080. The solution to this issue was to set the resolution in xorg.conf configuration file using guidance from here and here.
I also tried to set up remote desktop access to be able to connect from Windows or Mac. You can do it easily using this tutorial. The downside of the built-in remote desktop sharing is that it seems to work only from Linux to Linux. I haven’t found how to access it from Windows.
The third problem is to run Python with OpenCV. I found an example of code for capturing video from the camera, but I couldn’t run it because cv2 Python package was not installed.
This tutorial describes how to install OpenCV 3.4.0 with Python 3 on Jetson TX2. It is a long sequence of steps to install a lot of libraries, modify few lines of code here and there, and compile OpenCV from sources.
Finally, I managed to capture video from a USB camera (Logitech C270). It has to provide HD video, but I managed to get it working with OpenCV only using 640×480 resolution. This is what I got in the end:
In short, learnings:
- Don’t try to run JetPack on VM, start from a physical machine with Ubuntu right away.
- If you want to run OpenCV with Python 3, try this tutorial.
- If your monitor can’t accept full-screen resolution via HDMI, try to configure lower resolution in xorg.conf.
- Best Sources of Deep Learning News
- Jeff Dean’s Talk on Large-Scale Deep Learning
- Gamers Paid for Deep Learning and Self-Driving Cars Research
Source: Deep Learning on Medium