From 98bd8a0941bca9354efba5ba515c0597cc344757 Mon Sep 17 00:00:00 2001 From: fernchen Date: Thu, 9 Jul 2020 13:48:32 +0800 Subject: [PATCH] [CI][Caffe Frontend] add caffe environment --- docker/Dockerfile.ci_cpu | 4 ++ docker/install/ubuntu_install_caffe.sh | 93 ++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 docker/install/ubuntu_install_caffe.sh diff --git a/docker/Dockerfile.ci_cpu b/docker/Dockerfile.ci_cpu index aa77b06367681..cbeee182dd77c 100644 --- a/docker/Dockerfile.ci_cpu +++ b/docker/Dockerfile.ci_cpu @@ -74,3 +74,7 @@ RUN bash /install/ubuntu_install_tflite.sh # TensorFlow deps COPY install/ubuntu_install_tensorflow.sh /install/ubuntu_install_tensorflow.sh RUN bash /install/ubuntu_install_tensorflow.sh + +# Caffe deps +COPY install/ubuntu_install_caffe.sh /install/ubuntu_install_caffe.sh +RUN bash /install/ubuntu_install_caffe.sh diff --git a/docker/install/ubuntu_install_caffe.sh b/docker/install/ubuntu_install_caffe.sh new file mode 100644 index 0000000000000..ea175e22921db --- /dev/null +++ b/docker/install/ubuntu_install_caffe.sh @@ -0,0 +1,93 @@ +#!/bin/bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -e +set -u +set -o pipefail + +# Prerequisite +apt-get update --fix-missing + +export DEBIAN_FRONTEND=noninteractive +apt-get install -y tzdata +ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime +dpkg-reconfigure --frontend noninteractive tzdata + +apt-get install libprotobuf-dev -y +apt-get install libleveldb-dev -y +apt-get install libsnappy-dev -y +apt-get install libopencv-dev -y +apt-get install libhdf5-serial-dev -y +apt-get install protobuf-compiler -y +apt-get install libgflags-dev -y +apt-get install libgoogle-glog-dev -y +apt-get install liblmdb-dev -y +apt-get install libatlas-base-dev -y +apt-get install --no-install-recommends libboost-all-dev -y +apt-get install gfortran -y + +cd / +mkdir caffe +cd caffe +wget https://github.com/weiliu89/caffe/archive/ssd.zip -O ssd.zip +unzip ssd.zip +rm ssd.zip +cd caffe-ssd + +echo "CPU_ONLY := 1" >> Makefile.config +echo "OPENCV_VERSION := 3" >> Makefile.config +echo "BLAS := open" >> Makefile.config +echo "PYTHON_LIBRARIES := boost_python3 python3.6m" >> Makefile.config +echo "PYTHON_INCLUDE := /usr/include/python3.6m /usr/lib/python3.6/dist-packages/numpy/core/include /usr/local/lib/python3.6/dist-packages/numpy/core/include" >> Makefile.config +echo "PYTHON_LIB := /usr/lib" >> Makefile.config +echo "WITH_PYTHON_LAYER := 1" >> Makefile.config +echo INCLUDE_DIRS := $\(PYTHON_INCLUDE\) /usr/local/include /usr/include/hdf5/serial >> Makefile.config +echo LIBRARY_DIRS := $\(PYTHON_LIB\) /usr/local/lib /usr/lib /usr/lib/x86_64-linux-gnu/hdf5/serial >> Makefile.config +echo "BUILD_DIR := build" >> Makefile.config +echo "DISTRIBUTE_DIR := distribute" >> Makefile.config +echo "Q ?= @" >> Makefile.config + + +make -j8 +make test -j8 +make runtest -j8 + +echo export PYTHONPATH=/caffe/caffe-ssd/python >> /etc/profile +cd ./python + +rm requirements.txt +echo "Cython>=0.19.2" >> requirements.txt +echo "numpy>=1.7.1" >> requirements.txt +echo "scipy>=0.13.2" >> requirements.txt +echo "scikit-image>=0.9.3" >> requirements.txt +echo "h5py>=2.2.0" >> requirements.txt +echo "leveldb>=0.191" >> requirements.txt +echo "networkx>=1.8.1" >> requirements.txt +echo "nose>=1.3.0" >> requirements.txt +echo "pandas>=0.12.0" >> requirements.txt +echo "python-dateutil>=2.6.0" >> requirements.txt +echo "protobuf>=2.5.0" >> requirements.txt +echo "python-gflags>=2.0" >> requirements.txt +echo "pyyaml>=3.10" >> requirements.txt +echo "Pillow>=2.3.0" >> requirements.txt +echo "six>=1.1.0" >> requirements.txt + +for req in $(cat requirements.txt); do pip3 install $req -i https://pypi.tuna.tsinghua.edu.cn/simple some-package; done + +cd .. +make pycaffe