iTorch is an IPython Kernel for Torch from Facebook with plotting (using Bokeh.js plots) and visualization of images, video and audio. This video shows you how to install iTorch on the Jetson, and gives a quick run through of the iTorch demonstration notebook. Looky here:
iTorch Prerequisites and Installation
iTorch requires that Torch 7 be installed on the Jetson before being installed. You can learn how to install Torch 7 from this JetsonHacks blog entry.
There are also other requirements. Some of the libraries provided through the normal Ubuntu repositories are not current enough to run iTorch, therefore it is necessary to compile and install Zeromq from source. IPython needs to be a version greater than 2.0, so it is loaded using the Python Pip facility. There are several other bits and pieces needed as prerequisites. Also, the most common Gstreamer plugins should be made available so that video and audio in common formats can be used. Installation takes about 5 minutes. Here’s a script to take care of the prerequisites and install iTorch on the Jetson TK1:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|# Install Python prerequisites on NVIDIA Jetson TK1 for iTorch|
|# This is for https://github.com/facebook/iTorch|
|# L4T 21.3, Torch 7 (http://torch.ch)|
|# Python 2.7 or greater must be installed before running this script|
|# Torch 7 should already be installed before running this script|
|# iPython is loaded using pip, as repository version is 1.x version, > 2.0 is needed|
|# Need to compile from source as repository version libzmq3-dev is not the correct revision|
|tar xzvf zeromq-4.0.5.tar.gz|
|sudo make install|
|sudo apt-get install python-dev -y|
|sudo apt-get install python-pip -y|
|sudo pip install ipython|
|sudo apt-get install python-zmq -y|
|sudo apt-get install python-markupsafe -y|
|sudo apt-get install python-jsonschema -y|
|sudo pip install jinja2|
|sudo pip install tornado|
|sudo luarocks install luacrypto|
|sudo luarocks install env|
|sudo luarocks install lzmq|
|sudo luarocks install lbase64|
|sudo luarocks install uuid|
|# add some decoders for iTorch audio and video|
|sudo apt-get install gstreamer1.0-libav -y|
|# Install iTorch|
|git clone https://github.com/facebook/iTorch.git|
|sudo env "PATH=$PATH" luarocks make|
|sudo chown -R $USER $(dirname $(ipython locate profile))|
iTorch may be used in several manners, command line, Qt mode, and notebook mode. In the video, there is a demonstration of notebook mode. iTorch in notebook mode works like any other IPython notebook, and enables a larger degree of freedom and interactivity with Torch than through the usual command line tools.
Once installed, you can replicate the video demo by running the iTorch notebook server:
$ sudo itorch notebook
which will start up the iTorch notebook server and open a web page. The demo is located in iTorch_Demo.ipynb, in the iTorch directory.
In the demonstration, the Chromium browser is used. The Chromium browser is installed from the postFlash script used after an initial JetPack installation. Here’s a JetsonHacks blog entry on the subject.
Torch 7 tends to use a lot of memory. If you use Torch, you will probably need to have a swap file set up. You can refresh your memory on how to do that here on another blog entry on JetsonHacks.
This installation installs iTorch on a NVIDIA Jetson TK1 running Linux for Tegra (L4T) 21.3 with CUDA 6.5. The installation was done over a fresh JetPack L4T 21.3 installation, right after Torch 7 was installed. For more information about doing a fresh install, see this blog entry on JetsonHacks.