Updated test (markdown)
parent
f215277834
commit
61a711aa45
2 changed files with 222 additions and 1 deletions
222
Unix-installation.md
Normal file
222
Unix-installation.md
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
This installation was tested on the following configuration:
|
||||||
|
* OS: Ubuntu 16.04
|
||||||
|
* CUDA 9.0
|
||||||
|
* CUDNN 7.1
|
||||||
|
* OpenCV 3.4
|
||||||
|
* Caffe 1.0
|
||||||
|
* OpenFace 2.0
|
||||||
|
* Boost 1.5
|
||||||
|
|
||||||
|
**If you have Ubuntu 18.04, please refer to the [configuration information](https://github.molgen.mpg.de/perceptual/opengaze_old/wiki/Unix-Installation#ubuntu-1804).**
|
||||||
|
|
||||||
|
## Dependency installation
|
||||||
|
|
||||||
|
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
|
||||||
|
1. Install GPU driver:<br/>
|
||||||
|
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.<br/>
|
||||||
|
If you do not have the driver, then you can install the driver with `sudo ubuntu-drivers autoinstall`<br/>
|
||||||
|
Then reboot your computer<br/>
|
||||||
|
You now should test the Nvidia driver with `nvidia-smi` <br/>
|
||||||
|
|
||||||
|
2. Install CUDA <br/>
|
||||||
|
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:<br/>
|
||||||
|
|
||||||
|
```
|
||||||
|
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
|
||||||
|
chmod +x cuda_9.0.176_384.81_linux-run
|
||||||
|
sudo ./cuda_9.0.176_384.81_linux-run --override
|
||||||
|
```
|
||||||
|
Answer these questions as follows while installation begins:
|
||||||
|
- Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? n
|
||||||
|
- Install the CUDA 9.0 Toolkit? y
|
||||||
|
- Do you want to install a symbolic link at /usr/local/cuda? y
|
||||||
|
- Install the CUDA 10.0 Samples? n
|
||||||
|
|
||||||
|
Set up your paths: <br/>
|
||||||
|
```
|
||||||
|
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
|
||||||
|
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
|
||||||
|
echo 'export CPATH=/usr/local/cuda/include:$CPATH' >> ~/.bashrc
|
||||||
|
source ~/.bashrc
|
||||||
|
```
|
||||||
|
You can now test your CUDA installation with `nvcc --version`, which should show your nvcc version.<br/>
|
||||||
|
|
||||||
|
3. Install cuDNN<br/>
|
||||||
|
cuDNN is a GPU-accelerated library from Nvidia.<br/>
|
||||||
|
Go to [cuDNN archive](https://developer.nvidia.com/rdp/cudnn-archive) to download "cuDNN v7.1.4 (May 16, 2018), for CUDA 9.0", and then install it with:<br/>
|
||||||
|
```
|
||||||
|
tar -xzvf cudnn-9.0-linux-x64-v7.1.tgz
|
||||||
|
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
|
||||||
|
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
|
||||||
|
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
|
||||||
|
```
|
||||||
|
|
||||||
|
## Install OpenGaze with pre-compiled binary
|
||||||
|
You can easily install OpenGaze with our pre-compiled binary file.
|
||||||
|
1. Install other dependencies with `./install.sh`. This will install all the dependencies (tbb, boost, OpenBlas, dlib, protobuf, glog, gflags and hdf5) except OpenFace and Caffe.
|
||||||
|
2. Install OpenGaze with `sudo dpkg -i opengaze.deb`. This will install the OpenGaze library itself and also the OpenFace and Caffe library.
|
||||||
|
4. Compile the test example:
|
||||||
|
```
|
||||||
|
cd exe/
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
|
```
|
||||||
|
4. Run the test [Run the test](https://github.molgen.mpg.de/perceptual/opengaze_old/wiki/Unix-Installation#test-opengaze)<br/>
|
||||||
|
|
||||||
|
## Compile OpenGaze from source
|
||||||
|
If the pre-compiled file does not work for you, or you want to make changes to the OpenGaze source code, then you can compile it from source.<br/>
|
||||||
|
|
||||||
|
### Install OpenFace v2.0<br/>
|
||||||
|
1. Install
|
||||||
|
```
|
||||||
|
git clone https://github.com/TadasBaltrusaitis/OpenFace.git
|
||||||
|
cd OpenFace
|
||||||
|
```
|
||||||
|
Open the file 'install.sh', and change the "BUILD_SHARED_LIBS=OFF" to "BUILD_SHARED_LIBS=ON" for OpenCV. Then run
|
||||||
|
```
|
||||||
|
./install.sh
|
||||||
|
```
|
||||||
|
**Warning:** It requires typing a "Y" in the middle of the installation. Do not leave it unattended. <br/>
|
||||||
|
|
||||||
|
2. Download the necessary models:
|
||||||
|
Open the file "download_models.sh", set your OpenGaze root directory, which defualt value is "~/OpenGaze".<br/>
|
||||||
|
```
|
||||||
|
chmod +x download_models.sh
|
||||||
|
./download_models.sh
|
||||||
|
```
|
||||||
|
3. Test it:
|
||||||
|
```
|
||||||
|
cd build/
|
||||||
|
cp ../lib/local/LandmarkDetector/model/patch_experts/cen_patches_0.25_of.dat ./bin/model/patch_experts/
|
||||||
|
cp ../lib/local/LandmarkDetector/model/patch_experts/cen_patches_0.35_of.dat ./bin/model/patch_experts/
|
||||||
|
cp ../lib/local/LandmarkDetector/model/patch_experts/cen_patches_0.50_of.dat ./bin/model/patch_experts/
|
||||||
|
cp ../lib/local/LandmarkDetector/model/patch_experts/cen_patches_1.00_of.dat ./bin/model/patch_experts/
|
||||||
|
./bin/FaceLandmarkVid -f "../samples/changeLighting.wmv" -f "../samples/2015-10-15-15-14.avi"
|
||||||
|
```
|
||||||
|
For more details, please visit the OpenFace installation [guidelines](https://github.com/TadasBaltrusaitis/OpenFace/wiki/Unix-Installation).<br/>
|
||||||
|
|
||||||
|
### Install Caffe:<br/>
|
||||||
|
Install general dependencies: <br/>
|
||||||
|
|
||||||
|
`sudo apt-get install cmake libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler libgflags-dev libgoogle-glog-dev liblmdb-dev`<br/>
|
||||||
|
Download Caffe:<br/>
|
||||||
|
`git clone https://github.com/BVLC/caffe.git`<br/>
|
||||||
|
Download OpenGaze:<br/>
|
||||||
|
`git clone https://github.molgen.mpg.de/perceptual/opengaze.git`<br/>
|
||||||
|
Copy the customized layers from OpenGaze to caffe:<br/>
|
||||||
|
`cp -r opengaze/caffe-layers/include caffe/`
|
||||||
|
`cp -r opengaze/caffe-layers/src caffe/`<br/>
|
||||||
|
Compile:<br/>
|
||||||
|
```
|
||||||
|
cd caffe/
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DUSE_CUDNN=1 -DOPENCV_VERSION=3 -DBLAS=Open
|
||||||
|
make all
|
||||||
|
make install
|
||||||
|
```
|
||||||
|
For details please visit the [Caffe website](http://caffe.berkeleyvision.org/installation.html).
|
||||||
|
|
||||||
|
Now you should have successfully installed all the dependencies.
|
||||||
|
|
||||||
|
## Compile OpenGaze
|
||||||
|
|
||||||
|
Configure the build by modifying the **CMakeLists.txt** for your setup.
|
||||||
|
|
||||||
|
1. **Caffe**<br/>
|
||||||
|
Set the Caffe install path with "CAFFE_INSTALL_DIR"<br/>
|
||||||
|
|
||||||
|
2. **OpenFace**<br/>
|
||||||
|
Set the OpenFace root directory with "OPENFACE_ROOT_DIR"
|
||||||
|
|
||||||
|
3. **OpenGaze root path**<br/>
|
||||||
|
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`
|
||||||
|
|
||||||
|
3. **Create an out-of-source build directory to store the compiled artifacts**:<br/>
|
||||||
|
```
|
||||||
|
cd OpenGaze
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
## Test OpenGaze
|
||||||
|
Download the pre-trained gaze estimation models by running:<br/>
|
||||||
|
`./download_models.sh` <br/>
|
||||||
|
Note that all the configuration and model files will be located in the "~/OpenGaze" directory.<br/>
|
||||||
|
Go to "exe" folder, open "CMakeLists.txt" file, modify "OPENGAZE_DIR" if necessary. Then compile the test examples:
|
||||||
|
```
|
||||||
|
cd exe/
|
||||||
|
mkdir build
|
||||||
|
cd build/
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
|
```
|
||||||
|
Make sure your camera is connected to your computer, and then test it with:<br/>
|
||||||
|
`./bin/GazeVisualization -d -t camera -i 0`<br/>
|
||||||
|
Or test it with an existing video file:<br/>
|
||||||
|
`./bin/GazeVisualization -d -t video -i ../exe/test.mp4`<br/>
|
||||||
|
|
||||||
|
### Make the .deb package file
|
||||||
|
I use [Checkinstall](https://wiki.debian.org/CheckInstall) to make the .deb file. When you reach the `make` step before "sudo make install" for OpenGaze, you can just type <br/>
|
||||||
|
`sudo checkinstall --install=no`
|
||||||
|
to make a .deb file.<br/>
|
||||||
|
Follow the instructions to edit the software description, version, and organization. At last, you will find the compressed .deb file.<br/>
|
||||||
|
|
||||||
|
## Ubuntu 18.04
|
||||||
|
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. <br/>
|
||||||
|
|
||||||
|
### Install Nvidia driver
|
||||||
|
Add the Nvidia ppa: <br/>
|
||||||
|
```
|
||||||
|
sudo apt update
|
||||||
|
sudo apt upgrade
|
||||||
|
sudo add-apt-repository ppa:graphics-drivers/ppa
|
||||||
|
sudo apt update
|
||||||
|
sudo apt upgrade
|
||||||
|
```
|
||||||
|
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.<br/>
|
||||||
|
After that, go to the "Software & Update" in Ubuntu 18 system, go to "Additional Drivers", select `nvidia-driver-396`, and "Apply Changes".<br/>
|
||||||
|
Reboot the computer, then test the driver installation with `nvidia-smi`. <br/>
|
||||||
|
|
||||||
|
### Install CUDA
|
||||||
|
```
|
||||||
|
wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda_9.2.148_396.37_linux
|
||||||
|
chmod +x cuda_9.2.148_396.37_linux
|
||||||
|
sudo ./cuda_9.2.148_396.37_linux --override
|
||||||
|
```
|
||||||
|
|
||||||
|
Answer the following questions while installation begins:
|
||||||
|
- You are attempting to install on an unsupported configuration. Do you wish to continue? y
|
||||||
|
- Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81? n
|
||||||
|
- Install the CUDA 9.0 Toolkit? y
|
||||||
|
- Do you want to install a symbolic link at /usr/local/cuda? y
|
||||||
|
- Install the CUDA 10.0 Samples? n
|
||||||
|
|
||||||
|
and set up your paths: <br/>
|
||||||
|
```
|
||||||
|
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
|
||||||
|
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
|
||||||
|
echo 'export CPATH=/usr/local/cuda/include:$CPATH' >> ~/.bashrc
|
||||||
|
source ~/.bashrc
|
||||||
|
```
|
||||||
|
You can now test your CUDA installation with `nvcc --version`, which should show your nvcc version.<br/>
|
||||||
|
|
||||||
|
### Install cuDNN
|
||||||
|
Go to the [cuDNN archive](https://developer.nvidia.com/rdp/cudnn-archive) to download the "cuDNN v7.1.4 (May 16, 2018), for CUDA 9.2", and then install it with:<br/>
|
||||||
|
```
|
||||||
|
tar -xzvf cudnn-9.2-linux-x64-v7.1.tgz
|
||||||
|
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
|
||||||
|
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
|
||||||
|
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
|
||||||
|
```
|
||||||
|
|
||||||
|
You now can go compile it from the source, and note that the pre-compiled file is only for Ubuntu 16.04.
|
1
test.md
1
test.md
|
@ -1 +0,0 @@
|
||||||
test
|
|
Loading…
Reference in a new issue