Commit 19cb2a68 authored by Richard Torenvliet's avatar Richard Torenvliet

Dlib should not use multiscale checking, made it faster

parent 73d3ee4c
FROM smvanveen/computer-vision:20161109143812
RUN git clone https://github.com/davisking/dlib.git
RUN (cd dlib; python setup.py install --yes USE_AVX_INSTRUCTIONS)
RUN apt-get install graphviz -y
COPY requirements.txt /tmp
RUN pip install -r /tmp/requirements.txt
WORKDIR /src
#COPY requirements.txt /tmp
#RUN python --version
cycler==0.10.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
pycallgraph==1.0.1
......@@ -199,7 +199,7 @@ def build_shape_feature_vectors(files, get_points, flattened=False):
return points
def sample_from_triangles(src, points2d_src, points2d_dst, triangles, dst):
def piecewise_transform(src, points2d_src, points2d_dst, triangles, dst):
"""
Get pixels from within the triangles [[p1, p2, p3]_0, .. [p1, p2, p3]_n].
......@@ -259,7 +259,7 @@ def build_texture_feature_vectors(
# empty colored image
dst = np.full((image.shape[0], image.shape[1], 3), fill_value=0, dtype=np.uint8)
sample_from_triangles(
piecewise_transform(
image,
Points.get_scaled_points(image.shape),
mean_points.get_scaled_points(image.shape),
......
......@@ -51,7 +51,8 @@ class Detector():
# The 1 in the second argument indicates that we should upsample the
# image 1 time. This will make everything bigger and allow us to
# detect more faces.
return self.detector(image, 1)
# 0 = no upsample
return self.detector(image, 0)
def detect_shape(self, image):
detections = self.detect_faces(image)
......
......@@ -125,10 +125,11 @@ def reconstruct_texture(src_image, dst_image, texture_model,
points2d_dst[:, 0] -= offset_x
points2d_dst[:, 1] -= offset_y
points2d_src = points2d_src * 1.1
# don't know why this was, removing still works, keeping it for a while.
#points2d_src = points2d_src * 1.1
# get the texture from the rectangles.
aam.sample_from_triangles(
aam.piecewise_transform(
r_texture,
points2d_dst, # turn src and dst around
points2d_output, # turn src and dst around
......@@ -141,7 +142,7 @@ def reconstruct_shape_texture(dataset_module, shape_model, texture_model,
image_filename, shape_components,
shape_eigenvalues_multiplier=[],
image_as_background=False):
"""Reconstructs shape and texture"""
"""Performs reconstruction for shape and texture."""
input_points = dataset_module.factory(filename=image_filename)
input_image = input_points.get_image()
......
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