OpenGaze requires cmake, OpenCV 3.1.0 (or newer), Caffe, OpenFace, and boost. OpenFace relies on tbb, OpenBlas and dlib. Caffe relies on protobuf, glog, gflags, hdf5 and cuDNN.
Since we use convolutional neural networks as our model, the speed performance can be optimized with a powerful Nvidia GPU. Here we will show you how to install the driver and GPU library.
Install GPU driver and library
Install GPU driver:
Check if you already have the Nvidia driver with nvidia-smi, which should give you the GPU information. Note that we tested on driver version 384.130.
If you do not have the driver, then you can install the driver with sudo ubuntu-drivers autoinstall
Then reboot your computer
You now should test the Nvidia driver with nvidia-smi
CUDA is a parallel computing platform and programming model invented by NVIDIA. You can check with nvcc --version to see if you already have the GPU or not. We tested on version 9.0.176. You can install CUDA with the following steps:
Now you should have successfully installed all the dependencies.
Copy CMakeLists.txt.example and rename it to CMakeLists.txt.
Configure the build by modifying the CMakeLists.txt for your setup.
Set the Caffe install path with "CAFFE_INSTALL_DIR"
Set the OpenFace root directory with "OPENFACE_ROOT_DIR"
OpenGaze root path
Set the OpenGaze root path with "OPENGAZE_DIR", it will be the directory include Caffe models and camera calibration files etc. The defualt path is /home/USER_NAME/OpenGaze
Create an out-of-source build directory to store the compiled artifacts:
cd OpenGazemkdir buildcd buildcmake ..makesudo make install
Download the pre-trained gaze estimation models by running: ./download_models.sh
Note that all the configuration and model files will be located in the "~/OpenGaze" directory.
Go to "exe" folder, open "CMakeLists.txt" file, modify "OPENGAZE_DIR" if necessary. Then compile the test examples:
cd exe/mkdir buildcd build/cmake ..make
Make sure your camera is connected to your computer, and then test it with: ./bin/GazeVisualization -d -t camera -i 0
Or test it with an existing video file: ./bin/GazeVisualization -d -t video -i ../exe/test.mp4
Make the .deb package file
I use Checkinstall to make the .deb file. When you reach the make step before "sudo make install" for OpenGaze, you can just type sudo checkinstall --install=no
to make a .deb file.
Follow the instructions to edit the software description, version, and organization. At last, you will find the compressed .deb file.
The default GCC version is 7.X with Ubuntu 18.04, which is not compatible with CUDA 9.0 (only works with GCC <= 6). This complicated situation results: GCC 7.x requires CUDA 9.2 and CUDA 9.2 requires a Nvidia driver version >= 396.
If you try to install driver version 396 here, it will tell you there are some packages missing. However, you can install the driver from elsewhere.
After that, go to the "Software & Update" in Ubuntu 18 system, go to "Additional Drivers", select nvidia-driver-396, and "Apply Changes".
Reboot the computer, then test the driver installation with nvidia-smi.