Commit 4fcc4cd1 authored by Richard Torenvliet's avatar Richard Torenvliet

Simplify build script - removed unused libraries and fixed building texture.so

parent 426b9854
......@@ -4,10 +4,7 @@ FROM smvanveen/computer-vision:20161109143812
COPY requirements.txt /tmp
RUN pip install -r /tmp/requirements.txt
RUN apt-get install software-properties-common -y
RUN add-apt-repository ppa:bzindovic/suitesparse-bugfix-1319687 -y
RUN apt-get update -y
RUN apt-get install libsuitesparse-dev -y
# extra packages:
# graphviz: for cProfiling using pycallgraph.
......@@ -19,42 +16,37 @@ RUN apt-get install -y \
libatlas-base-dev \
libeigen3-dev
WORKDIR /libs
# install dlib
RUN git clone https://github.com/davisking/dlib.git
RUN (cd dlib; python setup.py install --yes USE_AVX_INSTRUCTIONS)
RUN git clone https://ceres-solver.googlesource.com/ceres-solver
RUN (cd ceres-solver; make -j3)
RUN (cd ceres-solver; make install)
# install eos (face-recosntruction, (3D Morphable Face Model fitting library)
RUN git clone --recursive \
https://github.com/patrikhuber/eos.git
# remove dependency on opencv 2.4.3, opencv 3.0 works fine
WORKDIR /libs/eos
RUN git checkout devel
# needed for master branch
#RUN sed -i 's/2.4.3//g' CMakeLists.txt
RUN mkdir build
WORKDIR /libs/eos/build
RUN cmake ../ \
-DCMAKE_INSTALL_PREFIX=/usr/local/eos \
-DEOS_GENERATE_PYTHON_BINDINGS=on \
-DEOS_BUILD_CERES_EXAMPLE=on \
-DEOS_BUILD_UTILS=on \
-DEOS_BUILD_EXAMPLES=on
RUN make && make install
ENV PYTHONPATH=/usr/local/eos/bin/:$PYTHONPATH
#RUN git clone --recursive \
# https://github.com/patrikhuber/eos.git
#
## remove dependency on opencv 2.4.3, opencv 3.0 works fine
#WORKDIR /libs/eos
#RUN git checkout devel
#
## needed for master branch
##RUN sed -i 's/2.4.3//g' CMakeLists.txt
#
#RUN mkdir build
#WORKDIR /libs/eos/build
#RUN cmake ../ \
# -DCMAKE_INSTALL_PREFIX=/usr/local/eos \
# -DEOS_GENERATE_PYTHON_BINDINGS=on \
# -DEOS_BUILD_UTILS=on \
# -DEOS_BUILD_EXAMPLES=on
#
#RUN make && make install
#
#ENV PYTHONPATH=/usr/local/eos/bin/:$PYTHONPATH
WORKDIR /libs
RUN pip install -U pytest
RUN git clone https://github.com/pybind/pybind11.git
RUN (cd pybind11; mkdir build; cd build; cmake -DPYBIND11_PYTHON_VERSION=2.7 ..);
RUN (cd pybind11/build; make -j4 && make install);
......@@ -62,3 +54,4 @@ RUN (cd pybind11/build; make -j4 && make install);
#TODO, remove the tmp libs folder in production?
WORKDIR /src
.PHONY := train_model show_pca test_model show_reconstruction
DEBUG_LEVEL=*
data/imm_face_db: # data/imm_face_db.tar.gz
data/imm_face_db: data/imm_face_db.tar.gz
(cd data; mkdir -p imm_face_db; \
tar -xvzf imm_face_db.tar.gz -C imm_face_db \
)
shape_predictor_68_face_landmarks.dat:
data/shape_predictor_68_face_landmarks.dat:
wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2 -P data/
(cd data/; bzip2 -d shape_predictor_68_face_landmarks.dat.bz2)
......@@ -16,7 +16,6 @@ data/imm_face_db.tar.gz:
runnit:
$(BASE_DOCKER_CMD) python main.py
## IMM Dataset
data/pca_imm_shape_model.npy:
$(BASE_DOCKER_CMD) python main.py \
......@@ -51,7 +50,6 @@ data/pca_ibug_texture_model.npy:
--shape_type ibug
## END OF IBUG
test_model:
$(BASE_DOCKER_CMD) python main.py \
--reconstruct \
......
......@@ -15,7 +15,7 @@ $(info $(TARGETS))
DEPENDENCIES:= data/imm_face_db
TARGETS:= data/shape_predictor_68_face_landmarks.dat \
src/reconstruction/texture.so \
src/reconstruction/fit.so \
data/imm_face_db \
data/pca_ibug_shape_model.npy \
data/pca_ibug_texture_model.npy
......@@ -47,22 +47,22 @@ $(SITE_PACKAGES)/cv%:
#src/reconstruction/fit.so: src/reconstruction/fit-model.cpp
# $(BASE_DOCKER_CMD) /bin/bash -c '(cd reconstruction; python setup.py build_ext --inplace)'
src/reconstruction/fit.so: src/reconstruction/fit-model.cpp
$(BASE_DOCKER_CMD) /bin/bash -c \
'(cd reconstruction; \
clang++ -fPIC -O3 -shared -std=c++14 \
-I/usr/local/include/pybind11/include/ \
-I/usr/local/eos/include/ \
-I/usr/local/eos/3rdparty/glm/ \
-I/usr/local/eos/3rdparty/cereal-1.1.1/include/ \
-I/usr/local/include/opencv2/ \
-I/usr/include/boost/ \
-L/usr/local/eos/bin/ \
-L/usr/lib/x86_64-linux-gnu/ \
-L/usr/local/lib/ \
-lboost_program_options \
-lboost_filesystem \
-lopencv_world \
`python-config --cflags --ldflags` \
$(notdir $^) -o $(notdir $@) \
)'
#src/reconstruction/fit.so: src/reconstruction/fit-model.cpp
# $(BASE_DOCKER_CMD) /bin/bash -c \
# '(cd reconstruction; \
# clang++ -fPIC -O3 -shared -std=c++14 \
# -I/usr/local/include/pybind11/include/ \
# -I/usr/local/eos/include/ \
# -I/usr/local/eos/3rdparty/glm/ \
# -I/usr/local/eos/3rdparty/cereal-1.1.1/include/ \
# -I/usr/local/include/opencv2/ \
# -I/usr/include/boost/ \
# -L/usr/local/eos/bin/ \
# -L/usr/lib/x86_64-linux-gnu/ \
# -L/usr/local/lib/ \
# -lboost_program_options \
# -lboost_filesystem \
# -lopencv_world \
# `python-config --cflags --ldflags` \
# $(notdir $^) -o $(notdir $@) \
# )'
......@@ -9,8 +9,8 @@ else
HALIDE_LINK:=https://github.com/halide/Halide/releases/download/release_2016_04_27/halide-linux-64-gcc53-trunk-2f11b9fce62f596e832907b82d87e8f75c53dd07.tgz
endif
texture.so: src/reconstruction/texture.pyx
(cd src/reconstruction; python setup.py build_ext --inplace)
src/reconstruction/texture.so: src/reconstruction/texture.pyx
$(BASE_DOCKER_CMD) bash -c "(cd reconstruction; python setup.py build_ext --inplace)"
halide_2016_04_27.tar.gz:
wget -O data/halide_2016_04_27.tar.gz $(HALIDE_LINK)
......
......@@ -12,46 +12,11 @@ from Cython.Build import cythonize
# -g -I vendor/halide/include -L vendor/halide/bin -lHalide -o $@ -std=c++11
extensions = [
Extension(
'texture',
['texture.pyx'],
include_dirs=[np.get_include()], ),
Extension(
'fit',
['fit-model.cpp'],
language="c++",
include_dirs=[
'/usr/local/eos/include/', # path need to be changed in future
'/usr/local/eos/3rdparty/glm/',
'/usr/local/eos/3rdparty/cereal-1.1.1/include/',
'/usr/local/include/opencv2/',
'/usr/include/boost/'
],
library_dirs=[
'/usr/local/eos/bin',
'/usr/lib/x86_64-linux-gnu/',
'/usr/local/lib/'
],
libraries=[
'boost_program_options',
'boost_filesystem',
'opencv_world'
],
extra_compile_args=['-std=c++14'], )
#include_dirs=[np.get_include()], ),
#Extension(
# 'halide',
# ['texture_halide.cpp'],
# language="c++",
# include_dirs=[
# '../../vendor/halide/include',
# '../../vendor/halide'
# ],
# library_dirs=['../../vendor/halide/bin'],
# libraries=['Halide'],
# extra_compile_args=['-std=c++11'],
#)
]
Extension(
'texture',
['texture.pyx'],
include_dirs=[np.get_include()], ),
]
setup(
ext_modules=cythonize(extensions),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment