Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Original repository source: https://github.com/anhttran/3dmm_cnn
- #
- # Installation instructions:
- # 1. download the repository with model files included
- # (or download/recreate model files, as described on the repository home page)
- # 2. download and install CUDA for Ubuntu 16.04:
- # wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_9.2.88-1_amd64.deb
- # sudo dpkg -i cuda-repo-ubuntu1604_9.2.88-1_amd64.deb
- # sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/7fa2af80.pub
- # sudo apt-get update
- # sudo apt-get install cuda
- # 3. Do
- # conda create -n=3dmm_cnn python=2.7.*
- # source activate 3dmm_cnn
- # 4. Then
- # bash install.sh
- # Following this guide to install Caffe: https://yangcha.github.io/Caffe-Conda/
- ENV_NAME="3dmm_cnn"
- echo "The script installs the library and all its requirements in a separate virtual environment ($ENV_NAME)"
- #echo "------------- Updating Conda -------------"
- #conda update
- echo "------------- Ubuntu packages -------------"
- echo "------------- (requires sudo) -------------"
- sudo apt-get update
- # for 3dmm_cnn:
- sudo apt install cmake libboost-all-dev freeglut3-dev libglew-dev libhdf5-dev
- # for Caffe:
- sudo apt-get install -y build-essential cmake git pkg-config libprotobuf-dev libleveldb-dev libsnappy-dev protobuf-compiler libatlas-base-dev libgflags-dev libgoogle-glog-dev liblmdb-dev
- sudo apt-get install -y --no-install-recommends libboost-all-dev
- echo "------------- Conda packages -------------"
- conda install numpy cython scikit-image ipython h5py nose pandas protobuf pyyaml jupyter scikit-image pillow
- # first two for 3dmm_cnn, others for Caffe
- # the following might be needed:
- #conda install msgpack
- #conda install python-dateutil
- pip install dlib
- echo "------------- OpenCV -------------"
- conda install -c menpo opencv3
- echo "------------- Dlib C++ library -------------"
- tar xvf dlib-19.13.tar.bz2
- mv dlib-19.13 dlib
- cd dlib
- mkdir build
- cd build
- cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=../bin ..
- make clean
- sudo ldconfig
- make
- make install
- echo "------------- Caffe -------------"
- cd ../.. # returning to 3dmm_cnn home dir
- git clone https://github.com/BVLC/caffe.git
- cd caffe
- mkdir build
- cd build
- echo "---- Building Caffe ----"
- cmake ..
- make all
- make install
- echo "---- Installing pip dependencies for Caffe ----"
- cd ../python
- for req in $(cat requirements.txt); do pip install $req; done
- echo "---- Building Python bindings for Caffe ----"
- cd ../build
- make runtest
- cd ../python
- export PYTHONPATH=`pwd`${PYTHONPATH:+:${PYTHONPATH}}
- echo "export PYTHONPATH=`pwd`${PYTHONPATH:+:${PYTHONPATH}}" >> ~/.bashrc
- echo "---- Verifying Caffe works ----"
- echo "---- (the Caffe version should be printed below, if everything is OK) ----"
- CUDA_DEVICE=0
- CUDA_VISIBLE_DEVICES=$CUDA_DEVICE python -c "import caffe;print caffe.__version__"
- # ----------------
- # Running:
- #cd $3DMM_CNN_DIR
- #cd demoCode
- #CUDA_VISIBLE_DEVICES=$CUDA_DEVICE python testBatchModel.py input.txt output 1 # where $CUDA_DEVICES is e.g. 0
Advertisement
Add Comment
Please, Sign In to add comment