Skip to content
Snippets Groups Projects
Commit f9982baf authored by Manuel Günther's avatar Manuel Günther
Browse files

Improved build system

parent 050c1380
Branches
Tags
No related merge requests found
...@@ -25,7 +25,6 @@ import os ...@@ -25,7 +25,6 @@ import os
import numpy import numpy
import math import math
import tempfile import tempfile
import facereclib
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import pkg_resources import pkg_resources
...@@ -112,60 +111,3 @@ def test_lgbphs(): ...@@ -112,60 +111,3 @@ def test_lgbphs():
reference *= 2. reference *= 2.
assert abs(lgbphs.score(model2, feature2) - reference) < 1e-5 assert abs(lgbphs.score(model2, feature2) - reference) < 1e-5
assert abs(lgbphs.score_for_multiple_probes(model2, [feature2, feature2]) - reference) < 1e-5 assert abs(lgbphs.score_for_multiple_probes(model2, [feature2, feature2]) - reference) < 1e-5
"""
def test09_plda(self):
# read input
feature = facereclib.utils.load(self.input_dir('linearize.hdf5'))
# assure that the config file is readable
tool = self.config('pca+plda')
self.assertTrue(isinstance(tool, facereclib.tools.PLDA))
# here, we use a reduced complexity for test purposes
tool = facereclib.tools.PLDA(
subspace_dimension_of_f = 2,
subspace_dimension_of_g = 2,
subspace_dimension_pca = 10,
plda_training_iterations = 1,
INIT_SEED = seed_value,
)
self.assertFalse(tool.performs_projection)
self.assertTrue(tool.requires_enroller_training)
# train the projector
t = tempfile.mkstemp('pca+plda.hdf5', prefix='frltest_')[1]
tool.train_enroller(facereclib.utils.tests.random_training_set_by_id(feature.shape, count=20, minimum=0., maximum=255.), t)
if regenerate_refs:
import shutil
shutil.copy2(t, self.reference_dir('pca+plda_enroller.hdf5'))
# load the projector file
tool.load_enroller(self.reference_dir('pca+plda_enroller.hdf5'))
# compare the resulting machines
test_file = bob.io.base.HDF5File(t)
test_file.cd('/pca')
pca_machine = bob.learn.linear.Machine(test_file)
test_file.cd('/plda')
plda_machine = bob.learn.em.PLDABase(test_file)
# TODO: compare the PCA machines
#self.assertEqual(pca_machine, tool.m_pca_machine)
# TODO: compare the PLDA machines
#self.assertEqual(plda_machine, tool.m_plda_base_machine)
os.remove(t)
# enroll model
model = tool.enroll([feature])
if regenerate_refs:
model.save(bob.io.base.HDF5File(self.reference_dir('pca+plda_model.hdf5'), 'w'))
# TODO: compare the models with the reference
#reference_model = tool.read_model(self.reference_dir('pca+plda_model.hdf5'))
#self.assertEqual(model, reference_model)
# score
sim = tool.score(model, feature)
self.assertAlmostEqual(sim, 0.)
# score with a concatenation of the probe
self.assertAlmostEqual(tool.score_for_multiple_probes(model, [feature, feature]), 0.)
"""
...@@ -4,17 +4,35 @@ ...@@ -4,17 +4,35 @@
[buildout] [buildout]
parts = scripts parts = scripts
eggs = bob.learn.linear eggs = bob.bio.face
bob.learn.em gridtk
bob.bio.base
bob.bio.gmm
bob.bio.face
extensions = bob.buildout extensions = bob.buildout
mr.developer
develop = ../../bob/layers/1/bob.learn.linear auto-checkout = *
../../bob/layers/1/bob.learn.em develop = src/bob.extension
../bob.bio.base src/bob.blitz
../bob.bio.gmm src/bob.core
src/bob.io.base
src/bob.io.image
src/bob.learn.activation
src/bob.math
src/bob.learn.linear
src/bob.sp
src/bob.ip.base
src/bob.ip.color
src/bob.ip.draw
src/bob.ip.gabor
src/bob.learn.em
src/bob.measure
src/bob.db.base
src/bob.db.verification.utils
src/bob.db.verification.filelist
src/bob.db.atnt
src/bob.bio.base
src/bob.learn.boosting
src/bob.ip.facedetect
src/bob.ip.flandmark
. .
; options for bob.buildout ; options for bob.buildout
...@@ -22,6 +40,32 @@ debug = true ...@@ -22,6 +40,32 @@ debug = true
verbose = true verbose = true
newest = false newest = false
[sources]
bob.extension = git https://github.com/bioidiap/bob.extension
bob.blitz = git https://github.com/bioidiap/bob.blitz
bob.core = git https://github.com/bioidiap/bob.core
bob.io.base = git https://github.com/bioidiap/bob.io.base
bob.io.image = git https://github.com/bioidiap/bob.io.image
bob.learn.activation = git https://github.com/bioidiap/bob.learn.activation
bob.math = git https://github.com/bioidiap/bob.math
bob.sp = git https://github.com/bioidiap/bob.sp
bob.ip.base = git https://github.com/bioidiap/bob.ip.base
bob.ip.color = git https://github.com/bioidiap/bob.ip.color
bob.ip.draw = git https://github.com/bioidiap/bob.ip.draw
bob.ip.gabor = git https://github.com/bioidiap/bob.ip.gabor
bob.learn.linear = git https://github.com/bioidiap/bob.learn.linear
bob.learn.em = git https://github.com/bioidiap/bob.learn.em
bob.measure = git https://github.com/bioidiap/bob.measure
bob.db.base = git https://github.com/bioidiap/bob.db.base
bob.db.verification.utils = git https://github.com/bioidiap/bob.db.verification.utils
bob.db.verification.filelist = git https://github.com/bioidiap/bob.db.verification.filelist
bob.db.atnt = git https://github.com/bioidiap/bob.db.atnt
bob.bio.base = git https://github.com/bioidiap/bob.bio.base
bob.learn.boosting = git https://github.com/bioidiap/bob.learn.boosting
bob.ip.facedetect = git https://github.com/bioidiap/bob.ip.facedetect
bob.ip.flandmark = git https://github.com/bioidiap/bob.ip.flandmark
[scripts] [scripts]
recipe = bob.buildout:scripts recipe = bob.buildout:scripts
dependent-scripts = true dependent-scripts = true
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
# allows you to test your package with new python dependencies w/o requiring # allows you to test your package with new python dependencies w/o requiring
# administrative interventions. # administrative interventions.
from setuptools import setup, find_packages from setuptools import setup, find_packages, dist
dist.Distribution(dict(setup_requires=['bob.extension']))
from bob.extension.utils import load_requirements
install_requires = load_requirements()
# The only thing we do in this file is to call the setup() function with all # The only thing we do in this file is to call the setup() function with all
# parameters that define our package. # parameters that define our package.
...@@ -64,11 +68,7 @@ setup( ...@@ -64,11 +68,7 @@ setup(
# on the current system will be installed locally and only visible to the # on the current system will be installed locally and only visible to the
# scripts of this package. Don't worry - You won't need administrative # scripts of this package. Don't worry - You won't need administrative
# privileges when using buildout. # privileges when using buildout.
install_requires = [ install_requires = install_requires,
'setuptools',
'bob.bio.base',
'bob.bio.gmm',
],
# Your project should be called something like 'bob.<foo>' or # Your project should be called something like 'bob.<foo>' or
# 'bob.<foo>.<bar>'. To implement this correctly and still get all your # 'bob.<foo>.<bar>'. To implement this correctly and still get all your
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment