-
Notifications
You must be signed in to change notification settings - Fork 87
Getting started
Get openframeworks (clone repo or download prepackaged).
Get ofxMSATensorFlow (clone repo or prepackaged zip).
The source that you just downloaded above doesn't include any binaries (they're too big for a github repo). So for any examples that you'd like to try, download the associated example-XXX-data.tar.gz file from releases and extract to the corresponding folder.
e.g. from example-mnist-data.tar.gz/data
to ofxMSATensorFlow/example-mnist/bin/data
Download lib_TFXX_XXX.tar.gz
for your system/platform from releases. This contains the precompiled libtensorflow_cc.so
library you will need in the next step. NOPT vs OPT is Non-optimised vs Optimised (i.e. --config=opt). To use the GPU, you will need the relevant library (with CUDA in the .tar.gz name) and make sure to have the appropriate versions of CUDA and cuDNN installed.
Copy the libtensorflow_cc.so
file to ofxMSATensorFlow/libs/tensorflow/lib/[linux64 or osx]/libtensorflow_cc.so
Note that the libtensorflow_cc.so
file is a shared library, not a static library (as is the convention with openframeworks addons, making executables self-contained, and much easier to distribute). So when running an application that uses ofxMSATensorFlow, the operating system will need access to the libtensorflow_cc.so
file, and will need to know where to find it. You have a few options:
- If you already have a library folder that you use for common shared libraries (and is in your library search path), copy the
libtensorflow_cc.so
file in there. (Remember to reload the list. E.g.sudo ldconfig
on linux) - Or you can add
ofxMSATensorFlow/libs/tensorflow/[linux64 or osx]
to your library search path and update the dynamic library search. Instructions to do this on linux can be found here, instructions for osx here - Or you can run this script (linux only, make sure to run from this folder in terminal). This copies
libtensorflow_cc.so
to~/lib
(creating the folder if it doesn't exist), adds an entry in/etc/ld.so.conf.d/libtensorflow_cc.so.conf
, and runsldconfig
.
Note that if you are distributing your ofxMSATensorFlow application to another computer, you will also need to distribute the libtensorflow_cc.so
file, and repeat this step on that computer.
The ofxMSATensorFlow example project files are for QT Creator (currently my fav C++ IDE) and should work on both Linux and OSX. So the quickest way to get up and running would be to use QT Creator, even on OSX (instead of XCode). Follow instructions to download and set it up here (you do not need Qt SDK. just the IDE). It shouldn't be too hard to setup a new projects for other IDEs.
The awesome ProjectGenerator bundled with openframeworks can create working xcode projects with the addon. (Note, right now the ProjectGenerator adds the non-existent ofApp.h, ofApp.cpp, main.cpp files to the project causing it to not compile, just remove them from the src group).
To use another IDE just add the one library and set the header include paths in ofxMSATensorFlow/libs.