CogBits' software relies on Torch7 an open-source environment for state-of-the-art machine learning algorithms.
This page summarizes key steps in deploying Torch7 and additional packages to enable CogBits' software.
Note: additional information is available on Torch7's main website, in particular, exhaustive install instructions are available here.
We provide regularly updated documentation here. It's a mirror of the main documentation, but also provides documentation for extra packages.
Copyright (C) 2012, CogBits, LLC, all rights reserved.
If you want to try Torch quickly, or you're having trouble installing it on your machine, you can download this virtual machine image, and import it into VirtualBox. That'll give you a clean Ubuntu 12 install, with Torch7 plus all sorts of extra packages pre-installed. Just fire up a terminal, and try:
First install Xcode, and the command line tools (in the latest versions, these are not installed by default, you have to find them in Xcode->Preferences...->Downloads: Command Line Tools). This will give you a basic gcc and g++.
Then to install Torch's dependencies, using a package manager like Homebrew really simplifies things (get it here: Homebrew).
$ brew install git readline cmake gnuplot wget qt libjpeg opencv ffmpeg boost
You will also need to install GCC >= 4.6 to get proper multithreading support for Torch7 (a knonw MacOS issue); the easiest way to do that is to install GFortran for its binaries: GFortran (a dmg package, installs in seconds); then export CC and CXX to point to the new GCC, before building Torch7:
$ export CC=/usr/bin/gfortran/bin/gcc $ export CXX=/usr/bin/gfortran/bin/g++
On Ubuntu, things are much more straightforward, using Aptitude:
$ sudo apt-get install gcc g++ $ sudo apt-get install cmake libreadline5-dev git-core gnuplot $ sudo apt-get install libqt4-core libqt4-gui libqt4-dev $ sudo apt-get install ffmpeg libboost-dev libpng-dev libjpeg-dev
(these names change from one distribution to the other, please check look for the equivalent name in your distribution)
You should now be ready to install Torch:
$ git clone https://github.com/andresy/torch $ cd torch $ mkdir build; cd build $ cmake ..
At this stage make sure that the cmake logs correctly activated openmp, and is using the correct versions of CC and CXX (on Mac OS X). If you want to use a particular BLAS library (OpenBLAS is great), also check that it was properly found. You can easily modify the cmake variables by using:
$ ccmake .
which will fire up a terminal-based editor.
Now that you're happy with cmake's config, build and install:
$ make $ make install
Torch7 comes with its own package manager (which works a lot like Aptitude or Homebrew), to simplify 3rd-party extensions. CogBits' software relies on multiple packages, which can be installed like this:
$ torch-pkg install imgraph videograph image opencv camera nnx ffmpeg inline unsup
An exhaustive list of the packages we support can be found here.
Note1: you might need to be root to install these, if Torch was also installed in a root directory)
Note2: You might want to install these packages one by one and make sure that all of them get successfully built, you can also check that they are properly installed by running Torch, and loading them:
$ torch t7> require 'imgraph' t7>
(if no error, the package is installed!)
$ torch-pkg download tutorials $ cd tutorials
Once you have this repo, you can try a couple of (open-source) demos, just to make sure everything works.
You can also install the tutorials, which will generate documentation for them:
$ torch-pkg install tutorials