Commit 3cb2d93a authored by Richard Torenvliet's avatar Richard Torenvliet

Move to using Docker

parent 6867bcfd
FROM smvanveen/computer-vision:20160120173546
RUN pip install dlib
WORKDIR /src
#COPY requirements.txt /tmp
#RUN python --version
......@@ -6,9 +6,19 @@ $ source bin/activate
$ make show_reconstruction
~~~~
Will get the data needed for this tool.
# Imm dataset
Will get the data needed for this tool.
# IBUG + dlib
For the IBUG dataset we use dlib to detect landmarks. You will need the train
file for that. http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
~~~bash
$ 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
~~~
## References
1. [imm_dataset](http://www.imm.dtu.dk/~aam/datasets/datasets.html, "Imm dataset")
TARGETS += data/pca_shape_train_model.npy
.PHONY := train_model show_pca test_model show_reconstruction
DEBUG_LEVEL=*
data/imm_face_db: data/imm_face_db.tar.gz
(cd data; mkdir -p imm_face_db; \
......@@ -13,38 +14,44 @@ train_shape: data/pca_imm_shape_model.npy data/pca_ibug_shape_model.npy
data/imm_face_db.tar.gz:
(cd data; wget http://www.imm.dtu.dk/~aam/datasets/imm_face_db.tar.gz)
runnit:
$(BASE_DOCKER_CMD) python main.py
compile_texture: src/reconstruction/texture.pyx
$(BASE_DOCKER_CMD) /bin/bash -c '(cd reconstruction; python setup.py build_ext --inplace)'
data/pca_imm_shape_model.npy:
python src/main.py \
$(BASE_DOCKER_CMD) python main.py \
--save_pca_shape \
--files `./scripts/imm_train_set.sh` \
--model_shape_file data/pca_imm_shape_model \
--model_shape_file /data/pca_imm_shape_model \
--shape_type imm
data/pca_ibug_shape_model.npy:
python src/main.py \
$(BASE_DOCKER_CMD) python main.py \
--save_pca_shape \
--files `./scripts/ibug_train_set.sh` \
--model_shape_file data/pca_ibug_shape_model \
--model_shape_file /data/pca_ibug_shape_model \
--shape_type ibug
data/pca_ibug_texture_model.npy:
python src/main.py \
$(BASE_DOCKER_CMD) python main.py \
--save_pca_texture \
--files `./scripts/ibug_train_set.sh` \
--model_texture_file data/pca_ibug_texture_model \
--model_shape_file data/pca_ibug_shape_model.npy \
--model_texture_file /data/pca_ibug_texture_model \
--model_shape_file /data/pca_ibug_shape_model.npy \
--shape_type ibug
data/pca_imm_texture_model.npy:
python src/main.py \
$(BASE_DOCKER_CMD) python main.py \
--save_pca_texture \
--files `./scripts/imm_train_set.sh` \
--model_texture_file data/pca_imm_texture_model \
--model_shape_file data/pca_imm_shape_model.npy \
--model_texture_file /data/pca_imm_texture_model \
--model_shape_file /data/pca_imm_shape_model.npy \
--shape_type imm
test_model:
python src/main.py \
$(BASE_DOCKER_CMD) python main.py \
--reconstruct \
--files `./scripts/imm_test_set.sh` \
--model_texture_file data/pca_imm_texture_model \
......@@ -52,11 +59,11 @@ test_model:
--n_components 6
show_reconstruction:
python src/main.py \
$(BASE_DOCKER_CMD) python main.py \
--reconstruct \
--files data/imm_face_db/*.asf \
--model_texture_file data/pca_imm_texture_model.npy \
--model_shape_file data/pca_imm_shape_model.npy \
--model_texture_file /data/pca_imm_texture_model.npy \
--model_shape_file /data/pca_imm_shape_model.npy \
--shape_type imm \
--n_components 6
......@@ -98,7 +105,7 @@ test:
.PHONY:= server
server:
(cd src/; python -m tornado.autoreload server.py)
#(cd src/; python -m tornado.autoreload server.py)
.PHONY:= ember
ember:
......
VIRTUALENV := venv
PYTHON := python2.7
PYTHON_BIN_PATH := /usr/local/bin/$(PYTHON)
SITE_PACKAGES := $(VIRTUALENV)/lib/$(PYTHON)/site-packages
OPENCV := $(SITE_PACKAGES)/cv.py $(SITE_PACKAGES)/cv2.so
TARGETS := $(OPENCV) $(VIRTUALENV) data reconstruction
include build.mk
all: $(TARGETS)
#VIRTUALENV := venv
#PYTHON := python2.7
#PYTHON_BIN_PATH := /usr/local/bin/$(PYTHON)
#SITE_PACKAGES := $(VIRTUALENV)/lib/$(PYTHON)/site-packages
#OPENCV := $(SITE_PACKAGES)/cv.py $(SITE_PACKAGES)/cv2.so
#TARGETS := $(OPENCV) $(VIRTUALENV) data reconstruction
VERSION:=v0.1
IMAGE_TAG:= icyrizard/face-reconstruction.git:$(VERSION)
DEBUG:=1
BASE_DOCKER_CMD:= docker run \
--rm \
--volume /Users/richard/Documents/sighthub/face-reconstruction/data:/data \
--volume /Users/richard/Documents/sighthub/face-reconstruction/src:/src \
-e "DEBUG=$(DEBUG)" \
$(IMAGE_TAG)
include actions.mk
include src/reconstruction/build.mk
all: $(TARGETS)
data: data/imm_face_db
reconstruction: texture.so
OS := $(shell uname)
build: requirements.txt
@(source $(VIRTUALENV)/bin/activate; \
pip install -r requirements.txt; \
);
docker build -t $(IMAGE_TAG) .
#@(source $(VIRTUALENV)/bin/activate; \
# pip install -r requirements.txt; \
#);
run-bash:
$(BASE_DOCKER_CMD) --interactive --tty $(IMAGE_TAG) /bin/bash
$(VIRTUALENV):
virtualenv -p $(PYTHON_BIN_PATH) venv
......@@ -30,3 +41,5 @@ $(VIRTUALENV):
$(SITE_PACKAGES)/cv%:
@/bin/ln -s `scripts/get_site_package_location.sh`/$(shell basename $@) $@
@ls $@
cycler==0.10.0
Cython==0.24
matplotlib==1.5.1
numpy==1.11.0
matplotlib==1.5.3
pyparsing==2.1.2
python-dateutil==2.5.3
pytz==2016.4
requests==2.10.0
six==1.10.0
tornado==4.4.2
files=`ls data/imm_face_db/ | grep -E "^[0-3][0-9].*.jpg"`
for f in $files; do
echo "data/imm_face_db/$f"
echo "/data/imm_face_db/$f"
done
files=`ls data/imm_face_db/ | grep -E "^[4][0-9].*.asf"`
for f in $files; do
echo "data/imm_face_db/$f"
echo "/data/imm_face_db/$f"
done
files=`ls data/imm_face_db/ | grep -E "^[0-3][0-9].*.asf"`
for f in $files; do
echo "data/imm_face_db/$f"
echo "/data/imm_face_db/$f"
done
......@@ -5,9 +5,9 @@
"""
import cv2
import numpy as np
from matplotlib.tri import Triangulation
import cv2
# local imports
import pca
......
......@@ -133,7 +133,7 @@ def pca(data, mean_values, variance_percentage=90):
i += 1
n_components = i
logger.debug('%s components form %s% of the variance', n_components, variance_percentage)
logger.debug('%s components form %s percent of the variance', n_components, variance_percentage)
return U, s, Vt, n_components
......
......@@ -3,8 +3,8 @@ from distutils.core import setup
from distutils.extension import Extension
import os
os.environ["CXX"] = "clang++"
os.environ["CC"] = "clang++"
os.environ["CXX"] = "g++"
os.environ["CC"] = "g++"
from Cython.Build import cythonize
......@@ -16,18 +16,18 @@ extensions = [
'texture',
['texture.pyx'],
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(
# '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(
......
......@@ -8,9 +8,7 @@ import logging
import logging.config
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
LANDMARK_DETECTOR_PATH = dir_path + '/../data/shape_predictor_68_face_landmarks.dat'
LANDMARK_DETECTOR_PATH = '/data/shape_predictor_68_face_landmarks.dat'
#logging.basicConfig(level=logging.INFO,
# format='%(asctime)s %(levelname)s %(name)s: %(message)s')
......
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