has been familiar with docker for a long time when it's docker, and since it's been a weapon, it has never been a chance to use it. These days, it's time to use Docker in the Caffe environment.

requirements: build an independent container, which installs all the dependencies of Caffe and runs it directly when you need to run the code.

advantages: it can solve a variety of dependency problems, such as the software needs to install GCC 4.7, and the other need to install GCC 4.8 and other mutually exclusive environmental requirements.

Docker installs and uses

docker for the installation and basic use of my two Blogs: install and use text .

constructs mirrored

to build mirrors in two ways:

1, write Dockerfile, and the advantage is to be easy to share;

2, from the container in commit, is simple and convenient, but not easy to share.

requires a large number of dependencies because of the installation of the Caffe environment, and because of network reasons, these dependencies are often not loaded once enough. For the sake of convenience, it starts a basic container directly, and then installs the dependency package from it.

select the basic ubuntu:14.04 to start the construction environment,

1, start the container:

2, depending on the package to install

into the container, all operations are just the same.

first installs some basic tools:

 apt-get install WGet apt-get install unzip apt-get install. UB has a one button installation on top, but it can't be installed in the container. After that, I executed it in a sentence. 

 #opencv runs arch=$(uname -m) if. Essential checkinstall cmake pkg-config yasm sudo apt-get -y install libtiff4-dev libjpeg-dev libjasper-dev Thon-dev python-numpy sudo apt-get -y install libtbb-dev sudo apt-get -y install libqt4-dev F/faac/faac_1.28-6.debian.tar.gz VI /etc/hosts ifconfig sudo apt-get -y install x264 v4l-utils ffmpeg WGet UILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D. So.conf.d/opencv.conf'sudo ldconfig CD..

caffe and python dependency package:

 sudo apt-get install Lags-dev libgoogle-glog-dev liblmdb-dev sudo apt-get install libatlas-base-dev

installs cuda:

. The small trick is how to import data from the host host to the container. Ufs/mnt/92562f161e51994949dd8496360265e5d54d32fbe301d693300916cd56d4e0a2/home/crw/Caffe sudo CP cudnn-7.0-linux-x64-v3.0-prod.tgz /var/lib/docker/aufs/mnt/92562f161e51994949dd8496360265e5d54d32fbe301d693300916cd56d4e0a2/home/crw/Caffe sudo CP caffe-master.zip /var/lib/docker/aufs/mnt/92562f161e51 994949dd8496360265e5d54d32fbe301d693300916cd56d4e0a2/home/crw/Caffe

, which is a long string of numbers, is the complete id of your container and can be copied with the command

docker inspect -f'{{.Id}}'ubuntu_caffe #ubuntu_caffe is the name of the container

./cuda_*_linux.run -extract=`pwd`. Inux-x64-v3.0-prod.tgz CP cuda/include/cudnn.h /usr/local/cuda/include/ CP cuda/lib64/* /usr/local/cuda/lib64/

installation caffe:

 CD caffe-15.12.07/ CD python/ apt-get install python-pip for req in $(cat requirements.txt); The order is not well installed. 

 apt-get install python-scipy for req in $(cat requirements.txt); /p> 
 make pycaffe

, finally, a new path to facilitate the disk mapping of

 MKDIR /media/crw/MyBook

. A container that turns the Caffe GPU environment good. The

starts the Caffe startup container:

 sudo docker run -ti  --device /dev/nvidia0:/dev/nvidia0 1, the graphics card is used directly, 
2, file mapping, mount a host host disk to the container path, set here the same, can reduce some unnecessary trouble.

runs the Caffe model and trains

. There will be hints that CUDA can not be found. Set up the environment variables.

 $export CUDA_HOME=/usr/local/cuda $export LD_LIBRARY_PATH=${CUDA_HOME}/lib64 $PATH=${CUDA_HOME}/bin:${PATH} $export PATH
 CD /media/crw/MyBook/Experience/FaceRecognition/Softmax/try3_3 above is the whole part of this article, hoping to learn from everyone Help, and I hope you will support the script home. 

This paper fixed link:http://www.script-home.com/building-method-of-caffe-environment-based-on-docker.html | Script Home | +Copy Link

Article reprint please specify:Building method of Caffe environment based on docker | Script Home

You may also be interested in these articles!