-
Notifications
You must be signed in to change notification settings - Fork 201
Ubuntu Installation Guide
This is a CPU-only installation guide for Ubuntu 16.04 (other versions were not tested but should work as well).
wget https://dl.bintray.com/boostorg/release/1.65.1/source/boost_1_65_1.tar.gz
tar -xzf boost_1_65_1.tar.gz
rm boost_1_65_1.tar.gz
cd boost_1_65_1
./bootstrap.sh
sudo ./b2 install -j 4
Note: Boost version must be 1.65.1 or newer for the python binding.
git clone https://github.com/xianyi/OpenBLAS
cd OpenBLAS
make FC=gfortran -j4
sudo make PREFIX=/usr/local install
Note: The alternatives to OpenBLAS (ATLAS and MKL) were tested but OpenBLAS achieved the best performance.
Media I/O:
sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev
Video I/O:
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev
Parallelism and linear algebra libraries:
sudo apt-get install -y libtbb-dev libeigen3-dev
Note: OpenCV 3.2.0 is used here but other versions above 3.0.0 should also work.
sudo apt-get install -y cmake
sudo apt-get install -y unzip
wget https://github.com/opencv/opencv/archive/3.2.0.zip
unzip 3.2.0.zip
rm 3.2.0.zip
cd opencv-3.2.0
mkdir build
cd build
cmake -DWITH_TBB=ON -DWITH_XINE=ON ..
make -j8
sudo make install
sudo ldconfig
sudo apt-get install libx11-dev libatlas-base-dev
sudo apt-get install libgtk-3-dev libboost-python-dev
sudo apt install libomp-dev
wget http://dlib.net/files/dlib-19.8.tar.bz2
tar xvf dlib-19.8.tar.bz2
rm dlib-19.8.tar.bz2
cd dlib-19.8/
mkdir build
cd build
cmake -DCMAKE_CXX_FLAGS=-fPIC ..
make -j8
sudo make install
Note: Version 19.8 was the latest version at the moment of testing, any version above 18.18 should be fine.
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libopenblas-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
git clone https://github.com/BVLC/caffe
cd caffe
git checkout 1.0
mkdir build
cd build
cmake -DCPU_ONLY=ON -DBUILD_python=OFF -DBUILD_python_layer=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ..
cmake -DBLAS=Open -DUSE_OPENMP=ON ..
make all -j8
make test
make runtest
sudo make install
Skip this if you don't intend to use the Python interface.
wget https://repo.anaconda.com/archive/Anaconda2-5.2.0-Linux-x86_64.sh
bash Anaconda2-5.2.0-Linux-x86_64.sh
rm Anaconda2-5.2.0-Linux-x86_64.sh
Note: The Python interface was only tested with Python 2.7.
git clone https://github.com/YuvalNirkin/face_swap
cd face_swap
mkdir build
cd build
cmake -DWITH_BOOST_STATIC=OFF -DBUILD_INTERFACE_PYTHON=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_APPS=ON -DBUILD_TESTS=OFF cmake -DCMAKE_INSTALL_PREFIX=~/installations/face_swap -DCMAKE_BUILD_TYPE=Release ..
make -j8
sudo make install
- Set -DBUILD_INTERFACE_PYTHON=OFF if you don't require Python binding.
- Use -DCMAKE_INSTALL_PREFIX="path" to change the installation path
Add the following line to the end of ~/.profile:
export PYTHONPATH=$PYTHONPATH:~/installations/face_swap/interfaces/python
Make the changes available for the current shell session:
source ~/.profile
Now download the required models to "data" in the installation directory:
cd ~/installations/face_swap/data
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
bzip2 -d shape_predictor_68_face_landmarks.dat.bz2
wget https://github.com/YuvalNirkin/face_swap/releases/download/0.9/3dmm_cnn_resnet_101.zip
unzip 3dmm_cnn_resnet_101.zip
wget https://github.com/YuvalNirkin/face_segmentation/releases/download/1.0/face_seg_fcn8s.zip
unzip face_seg_fcn8s.zip
wget https://github.com/YuvalNirkin/face_segmentation/releases/download/1.1/face_seg_fcn8s_300_no_aug.zip
unzip face_seg_fcn8s_300_no_aug.zip
rm *.zip