Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
py-3d-face-reconstruction
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
py-3d-face-reconstruction
Commits
4fcc4cd1
Commit
4fcc4cd1
authored
Jan 14, 2018
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify build script - removed unused libraries and fixed building texture.so
parent
426b9854
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
96 deletions
+52
-96
Dockerfile
Dockerfile
+23
-30
actions.mk
actions.mk
+2
-4
makefile
makefile
+20
-20
src/reconstruction/build.mk
src/reconstruction/build.mk
+2
-2
src/reconstruction/setup.py
src/reconstruction/setup.py
+5
-40
No files found.
Dockerfile
View file @
4fcc4cd1
...
@@ -4,10 +4,7 @@ FROM smvanveen/computer-vision:20161109143812
...
@@ -4,10 +4,7 @@ FROM smvanveen/computer-vision:20161109143812
COPY
requirements.txt /tmp
COPY
requirements.txt /tmp
RUN
pip
install
-r
/tmp/requirements.txt
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 update
-y
RUN
apt-get
install
libsuitesparse-dev
-y
# extra packages:
# extra packages:
# graphviz: for cProfiling using pycallgraph.
# graphviz: for cProfiling using pycallgraph.
...
@@ -19,42 +16,37 @@ RUN apt-get install -y \
...
@@ -19,42 +16,37 @@ RUN apt-get install -y \
libatlas-base-dev
\
libatlas-base-dev
\
libeigen3-dev
libeigen3-dev
WORKDIR
/libs
WORKDIR
/libs
# install dlib
# install dlib
RUN
git clone https://github.com/davisking/dlib.git
RUN
git clone https://github.com/davisking/dlib.git
RUN
(
cd
dlib
;
python setup.py
install
--yes
USE_AVX_INSTRUCTIONS
)
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)
# install eos (face-recosntruction, (3D Morphable Face Model fitting library)
RUN
git clone
--recursive
\
#RUN git clone --recursive \
https://github.com/patrikhuber/eos.git
# https://github.com/patrikhuber/eos.git
#
# remove dependency on opencv 2.4.3, opencv 3.0 works fine
## remove dependency on opencv 2.4.3, opencv 3.0 works fine
WORKDIR
/libs/eos
#WORKDIR /libs/eos
RUN
git checkout devel
#RUN git checkout devel
#
# needed for master branch
## needed for master branch
#RUN sed -i 's/2.4.3//g' CMakeLists.txt
##RUN sed -i 's/2.4.3//g' CMakeLists.txt
#
RUN
mkdir
build
#RUN mkdir build
WORKDIR
/libs/eos/build
#WORKDIR /libs/eos/build
RUN
cmake ../
\
#RUN cmake ../ \
-DCMAKE_INSTALL_PREFIX
=
/usr/local/eos
\
# -DCMAKE_INSTALL_PREFIX=/usr/local/eos \
-DEOS_GENERATE_PYTHON_BINDINGS
=
on
\
# -DEOS_GENERATE_PYTHON_BINDINGS=on \
-DEOS_BUILD_CERES_EXAMPLE
=
on
\
# -DEOS_BUILD_UTILS=on \
-DEOS_BUILD_UTILS
=
on
\
# -DEOS_BUILD_EXAMPLES=on
-DEOS_BUILD_EXAMPLES
=
on
#
#RUN make && make install
RUN
make
&&
make
install
#
#ENV PYTHONPATH=/usr/local/eos/bin/:$PYTHONPATH
ENV
PYTHONPATH=/usr/local/eos/bin/:$PYTHONPATH
WORKDIR
/libs
WORKDIR
/libs
RUN
pip
install
-U
pytest
RUN
git clone https://github.com/pybind/pybind11.git
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
;
mkdir
build
;
cd
build
;
cmake
-DPYBIND11_PYTHON_VERSION
=
2.7 ..
)
;
RUN
(
cd
pybind11/build
;
make
-j4
&&
make
install
)
;
RUN
(
cd
pybind11/build
;
make
-j4
&&
make
install
)
;
...
@@ -62,3 +54,4 @@ 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?
#TODO, remove the tmp libs folder in production?
WORKDIR
/src
WORKDIR
/src
actions.mk
View file @
4fcc4cd1
.PHONY
:=
train_model show_pca test_model show_reconstruction
.PHONY
:=
train_model show_pca test_model show_reconstruction
DEBUG_LEVEL
=
*
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
;
\
(
cd
data
;
mkdir
-p
imm_face_db
;
\
tar
-xvzf
imm_face_db.tar.gz
-C
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/
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
)
(
cd
data/
;
bzip2
-d
shape_predictor_68_face_landmarks.dat.bz2
)
...
@@ -16,7 +16,6 @@ data/imm_face_db.tar.gz:
...
@@ -16,7 +16,6 @@ data/imm_face_db.tar.gz:
runnit
:
runnit
:
$(BASE_DOCKER_CMD)
python main.py
$(BASE_DOCKER_CMD)
python main.py
## IMM Dataset
## IMM Dataset
data/pca_imm_shape_model.npy
:
data/pca_imm_shape_model.npy
:
$(BASE_DOCKER_CMD)
python main.py
\
$(BASE_DOCKER_CMD)
python main.py
\
...
@@ -51,7 +50,6 @@ data/pca_ibug_texture_model.npy:
...
@@ -51,7 +50,6 @@ data/pca_ibug_texture_model.npy:
--shape_type
ibug
--shape_type
ibug
## END OF IBUG
## END OF IBUG
test_model
:
test_model
:
$(BASE_DOCKER_CMD)
python main.py
\
$(BASE_DOCKER_CMD)
python main.py
\
--reconstruct
\
--reconstruct
\
...
...
makefile
View file @
4fcc4cd1
...
@@ -15,7 +15,7 @@ $(info $(TARGETS))
...
@@ -15,7 +15,7 @@ $(info $(TARGETS))
DEPENDENCIES
:=
data/imm_face_db
DEPENDENCIES
:=
data/imm_face_db
TARGETS
:=
data/shape_predictor_68_face_landmarks.dat
\
TARGETS
:=
data/shape_predictor_68_face_landmarks.dat
\
src/reconstruction/texture.so
\
src/reconstruction/texture.so
\
src/reconstruction/fit.so
\
data/imm_face_db
\
data/pca_ibug_shape_model.npy
\
data/pca_ibug_shape_model.npy
\
data/pca_ibug_texture_model.npy
data/pca_ibug_texture_model.npy
...
@@ -47,22 +47,22 @@ $(SITE_PACKAGES)/cv%:
...
@@ -47,22 +47,22 @@ $(SITE_PACKAGES)/cv%:
#src/reconstruction/fit.so: src/reconstruction/fit-model.cpp
#src/reconstruction/fit.so: src/reconstruction/fit-model.cpp
# $(BASE_DOCKER_CMD) /bin/bash -c '(cd reconstruction; python setup.py build_ext --inplace)'
# $(BASE_DOCKER_CMD) /bin/bash -c '(cd reconstruction; python setup.py build_ext --inplace)'
src/reconstruction/fit.so
:
src/reconstruction/fit-model.cpp
#
src/reconstruction/fit.so: src/reconstruction/fit-model.cpp
$(BASE_DOCKER_CMD)
/bin/bash
-c
\
#
$(BASE_DOCKER_CMD) /bin/bash -c \
'(cd reconstruction; \
#
'(cd reconstruction; \
clang++ -fPIC -O3 -shared -std=c++14 \
#
clang++ -fPIC -O3 -shared -std=c++14 \
-I/usr/local/include/pybind11/include/ \
#
-I/usr/local/include/pybind11/include/ \
-I/usr/local/eos/include/ \
#
-I/usr/local/eos/include/ \
-I/usr/local/eos/3rdparty/glm/ \
#
-I/usr/local/eos/3rdparty/glm/ \
-I/usr/local/eos/3rdparty/cereal-1.1.1/include/ \
#
-I/usr/local/eos/3rdparty/cereal-1.1.1/include/ \
-I/usr/local/include/opencv2/ \
#
-I/usr/local/include/opencv2/ \
-I/usr/include/boost/ \
#
-I/usr/include/boost/ \
-L/usr/local/eos/bin/ \
#
-L/usr/local/eos/bin/ \
-L/usr/lib/x86_64-linux-gnu/ \
#
-L/usr/lib/x86_64-linux-gnu/ \
-L/usr/local/lib/ \
#
-L/usr/local/lib/ \
-lboost_program_options \
#
-lboost_program_options \
-lboost_filesystem \
#
-lboost_filesystem \
-lopencv_world \
#
-lopencv_world \
`python-config --cflags --ldflags` \
#
`python-config --cflags --ldflags` \
$(
notdir
$^
)
-o
$(
notdir
$@
)
\
#
$(notdir $^) -o $(notdir $@) \
)'
#
)'
src/reconstruction/build.mk
View file @
4fcc4cd1
...
@@ -9,8 +9,8 @@ else
...
@@ -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
HALIDE_LINK
:=
https://github.com/halide/Halide/releases/download/release_2016_04_27/halide-linux-64-gcc53-trunk-2f11b9fce62f596e832907b82d87e8f75c53dd07.tgz
endif
endif
texture.so
:
src/reconstruction/texture.pyx
src/reconstruction/
texture.so
:
src/reconstruction/texture.pyx
(
cd
src/reconstruction
;
python setup.py build_ext
--inplace
)
$(BASE_DOCKER_CMD)
bash
-c
"(cd reconstruction; python setup.py build_ext --inplace)"
halide_2016_04_27.tar.gz
:
halide_2016_04_27.tar.gz
:
wget
-O
data/halide_2016_04_27.tar.gz
$(HALIDE_LINK)
wget
-O
data/halide_2016_04_27.tar.gz
$(HALIDE_LINK)
...
...
src/reconstruction/setup.py
View file @
4fcc4cd1
...
@@ -12,46 +12,11 @@ from Cython.Build import cythonize
...
@@ -12,46 +12,11 @@ from Cython.Build import cythonize
# -g -I vendor/halide/include -L vendor/halide/bin -lHalide -o $@ -std=c++11
# -g -I vendor/halide/include -L vendor/halide/bin -lHalide -o $@ -std=c++11
extensions
=
[
extensions
=
[
Extension
(
Extension
(
'texture'
,
'texture'
,
[
'texture.pyx'
],
[
'texture.pyx'
],
include_dirs
=
[
np
.
get_include
()],
),
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'],
#)
]
setup
(
setup
(
ext_modules
=
cythonize
(
extensions
),
ext_modules
=
cythonize
(
extensions
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment