diff --git a/.gitignore b/.gitignore index ed9a575aa8621dae4d9a9606e34651550c2b9f1f..5345d2f13cbac9471e6270e0c470e55a843f4216 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ .mr.developer.cfg eggs/ develop-eggs/ -xbob.example.faceverify.egg-info/ +bob.example.faceverify.egg-info/ src/ bin/ dist/ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..befdba6a218f851168f85620ee4701252da293af --- /dev/null +++ b/.travis.yml @@ -0,0 +1,34 @@ +language: python +matrix: + include: + - python: 2.6 + - python: 2.7 + env: + - secure: lzPxGD45F6DRm108SBxkcsnM+zVH7p59/s34WVc6ZVlRI792xajoTJBC7pE087W01HPiofkVigqjCbsZvgDI9JggPgtOhE9Ugifzpm1vXRTZOlBXDx3fTsH/FxcHfWYRx8M3rnONgdNoyeBvw8mz+TKm6zCtNdZ+0IZEXSIDvhU= + - secure: ZgUPtwmsOIGnb4aevKHxm2YqTRsKKt+2MAcsgqhG8ClD4OOEUV7nyo2tVZt3RcoURjZGoCaLfWYI4MkzfwD/m1GjA1BcEi5DeLUEYvEIv3N69+eTldZBHCONL3heLbrmNHBLP0tyxHV9eSd2B1qsknn4ndyGXJm6Llu9J8Frv8E= + - python: 3.2 + env: + - NUMPYSPEC===1.8.0 + - python: 3.3 + env: + - NUMPYSPEC===1.8.0 +before_install: +- sudo add-apt-repository -y ppa:biometrics/bob +- sudo apt-get update -qq +- sudo apt-get install -qq --force-yes libjpeg8-dev libnetpbm10-dev libpng12-dev libtiff4-dev libgif-dev libboost-all-dev libblitz1-dev libhdf5-serial-dev +- sudo apt-get install -qq --force-yes dvipng texlive-latex-base texlive-latex-extra texlive-math-extra +- if [ -n "${NUMPYSPEC}" ]; then sudo apt-get install -qq libatlas-dev libatlas-base-dev liblapack-dev gfortran; fi +- if [ -n "${NUMPYSPEC}" ]; then pip install --upgrade pip setuptools; fi +- if [ -n "${NUMPYSPEC}" ]; then pip install --find-links http://wheels.astropy.org/ --find-links http://wheels2.astropy.org/ --use-wheel numpy$NUMPYSPEC sphinx nose matplotlib; fi +- pip install cpp-coveralls +install: +- python bootstrap.py +- CFLAGS=-coverage ./bin/buildout +script: +- ./bin/python -c 'from bob.ip.gabor import get_config; print(get_config())' +- ./bin/coverage run --source=bob.example.faceverify ./bin/nosetests -sv +- ./bin/sphinx-build -b doctest doc sphinx +- ./bin/sphinx-build -b html doc sphinx +after_success: +- coveralls --build-root=`pwd` --exclude=src +- ./src/bob.extension/scripts/upload-sphinx.sh diff --git a/xbob/__init__.py b/bob/__init__.py similarity index 100% rename from xbob/__init__.py rename to bob/__init__.py diff --git a/xbob/example/__init__.py b/bob/example/__init__.py similarity index 100% rename from xbob/example/__init__.py rename to bob/example/__init__.py diff --git a/xbob/example/faceverify/__init__.py b/bob/example/faceverify/__init__.py similarity index 100% rename from xbob/example/faceverify/__init__.py rename to bob/example/faceverify/__init__.py diff --git a/xbob/example/faceverify/dct_ubm.py b/bob/example/faceverify/dct_ubm.py similarity index 89% rename from xbob/example/faceverify/dct_ubm.py rename to bob/example/faceverify/dct_ubm.py index d4ff433f4a54e5be58312de51b118425cd4cc35b..e78a37b7bf3bbff6b417b3dc25ea4f6ca667406c 100644 --- a/xbob/example/faceverify/dct_ubm.py +++ b/bob/example/faceverify/dct_ubm.py @@ -19,8 +19,14 @@ from __future__ import print_function -import bob -import xbob.db.atnt +# import required bob modules +import bob.db.atnt +import bob.io.base +import bob.io.image +import bob.ip.base +import bob.learn.misc +import bob.measure + import os, sys import numpy import matplotlib @@ -51,7 +57,7 @@ def load_images(db, group = None, purpose = None, client_id = None, database_dir images = {} for k in files: # load image and linearize it into a vector - images[k.id] = bob.io.load(k.make_path(database_directory, image_extension)).astype(numpy.float64) + images[k.id] = bob.io.base.load(k.make_path(database_directory, image_extension)).astype(numpy.float64) return images @@ -61,7 +67,7 @@ DCT_BLOCK_OVERLAP = 11 NUMBER_OF_DCT_COMPONENTS = 45 # create a DCT block extractor model -dct_extractor = bob.ip.DCTFeatures(DCT_BLOCK_SIZE, DCT_BLOCK_SIZE, DCT_BLOCK_OVERLAP, DCT_BLOCK_OVERLAP, NUMBER_OF_DCT_COMPONENTS) +dct_extractor = bob.ip.base.DCTFeatures(NUMBER_OF_DCT_COMPONENTS, (DCT_BLOCK_SIZE, DCT_BLOCK_SIZE), (DCT_BLOCK_OVERLAP, DCT_BLOCK_OVERLAP)) def extract_feature(image): """Extracts the DCT features for the given image""" @@ -82,11 +88,11 @@ def train(training_features, number_of_gaussians = NUMBER_OF_GAUSSIANS): input_size = training_set.shape[1] # create the KMeans and UBM machine - kmeans = bob.machine.KMeansMachine(number_of_gaussians, input_size) - ubm = bob.machine.GMMMachine(number_of_gaussians, input_size) + kmeans = bob.learn.misc.KMeansMachine(number_of_gaussians, input_size) + ubm = bob.learn.misc.GMMMachine(number_of_gaussians, input_size) # create the KMeansTrainer - kmeans_trainer = bob.trainer.KMeansTrainer() + kmeans_trainer = bob.learn.misc.KMeansTrainer() # train using the KMeansTrainer kmeans_trainer.train(kmeans, training_set) @@ -100,7 +106,7 @@ def train(training_features, number_of_gaussians = NUMBER_OF_GAUSSIANS): ubm.weights = weights # train the GMM - trainer = bob.trainer.ML_GMMTrainer() + trainer = bob.learn.misc.ML_GMMTrainer() trainer.train(ubm, training_set) return ubm @@ -111,7 +117,7 @@ def enroll(model_features, ubm, gmm_trainer): # create array set used for enrolling enroll_set = numpy.vstack(model_features.values()) # create a GMM from the UBM - gmm = bob.machine.GMMMachine(ubm) + gmm = bob.learn.misc.GMMMachine(ubm) # train the GMM gmm_trainer.train(gmm, enroll_set) @@ -126,7 +132,7 @@ def stats(probe_feature, ubm): probe_feature = numpy.vstack([probe_feature]) # Accumulate statistics - gmm_stats = bob.machine.GMMStats(ubm.dim_c, ubm.dim_d) + gmm_stats = bob.learn.misc.GMMStats(ubm.dim_c, ubm.dim_d) gmm_stats.init() ubm.acc_statistics(probe_feature, gmm_stats) @@ -137,7 +143,7 @@ def main(): """This function will perform an a DCT block extraction and a UBM/GMM modeling test on the AT&T database""" # use the bob.db interface to retrieve information about the Database - atnt_db = xbob.db.atnt.Database() + atnt_db = bob.db.atnt.Database() # Check the existence of the AT&T database and download it if not # Also check if the AT&T database directory is overwritten by the command line @@ -160,7 +166,7 @@ def main(): ##################################################################### ### GMM model enrollment print("Enrolling GMM models") - gmm_trainer = bob.trainer.MAP_GMMTrainer() + gmm_trainer = bob.learn.misc.MAP_GMMTrainer() gmm_trainer.max_iterations = 1 gmm_trainer.set_prior_gmm(ubm) @@ -196,7 +202,7 @@ def main(): negative_scores = [] print("Computing scores") - distance_function = bob.machine.linear_scoring + distance_function = bob.learn.misc.linear_scoring # iterate through models and probes and compute scores for model_id, model_gmm in models.iteritems(): diff --git a/xbob/example/faceverify/eigenface.py b/bob/example/faceverify/eigenface.py similarity index 95% rename from xbob/example/faceverify/eigenface.py rename to bob/example/faceverify/eigenface.py index 47b1a1cea7f7d284766921aac70cdfd0d25ce888..f5aac9632503496bb48a50d9e7cd4068038d0e72 100644 --- a/xbob/example/faceverify/eigenface.py +++ b/bob/example/faceverify/eigenface.py @@ -19,8 +19,13 @@ from __future__ import print_function -import bob -import xbob.db.atnt +# import required bob modules +import bob.db.atnt +import bob.io.base +import bob.io.image +import bob.learn.linear +import bob.measure + import os, sys import numpy, scipy.spatial import matplotlib @@ -42,7 +47,7 @@ def load_images(db, group = None, purpose = None, database_directory = None, ima images = {} for k in files: # load image and linearize it into a vector - images[k.id] = bob.io.load(k.make_path(database_directory, image_extension)).astype(numpy.float64) + images[k.id] = bob.io.base.load(k.make_path(database_directory, image_extension)).astype(numpy.float64) return images @@ -52,7 +57,7 @@ KEPT_EIGENFACES = 5 def train(training_images): """Trains the PCA module with the given list of training images""" # perform training using a PCA trainer - pca_trainer = bob.trainer.PCATrainer() + pca_trainer = bob.learn.linear.PCATrainer() # create array set used for training # iterate through the training examples and linearize the images @@ -79,7 +84,7 @@ def main(): """This function will perform an eigenface test on the AT&T database""" # use the bob.db interface to retrieve information about the Database - atnt_db = xbob.db.atnt.Database() + atnt_db = bob.db.atnt.Database() # Check the existence of the AT&T database and download it if not # Also check if the AT&T database directory is overwritten by the command line diff --git a/xbob/example/faceverify/gabor_graph.py b/bob/example/faceverify/gabor_graph.py similarity index 85% rename from xbob/example/faceverify/gabor_graph.py rename to bob/example/faceverify/gabor_graph.py index a09484941a14a634edcbf857e55e952909b19479..a7fd622275cfbd09003cf2ed2a867d3ad1a0cbe0 100644 --- a/xbob/example/faceverify/gabor_graph.py +++ b/bob/example/faceverify/gabor_graph.py @@ -19,8 +19,14 @@ from __future__ import print_function -import bob -import xbob.db.atnt +# import required bob modules +import bob.db.atnt +import bob.io.base +import bob.io.image +import bob.ip.base +import bob.ip.gabor +import bob.measure + import os, sys import numpy, math import matplotlib @@ -35,7 +41,7 @@ from .utils import atnt_database_directory # To preprocess the AT&T images, we use the TanTriggs algorithm -preprocessor = bob.ip.TanTriggs() +preprocessor = bob.ip.base.TanTriggs() def load_images(db, group = None, purpose = None, database_directory = None, image_extension = '.pgm'): """Reads the images for the given group and the given purpose from the given database""" @@ -45,38 +51,38 @@ def load_images(db, group = None, purpose = None, database_directory = None, ima images = {} for k in files: # load image and linearize it into a vector - images[k.id] = bob.io.load(k.make_path(database_directory, image_extension)).astype(numpy.float64) + images[k.id] = bob.io.base.load(k.make_path(database_directory, image_extension)).astype(numpy.float64) # preprocess the images images[k.id] = preprocessor(images[k.id]) return images # define Gabor wavelet transform class globally since it is reused for all images -gabor_wavelet_transform = bob.ip.GaborWaveletTransform(k_max = 0.25 * math.pi) -# create empty Gabor jet image including Gabor phases in the required size to avoid re-calculation -gabor_jet_image = gabor_wavelet_transform.empty_jet_image(numpy.ndarray((112,92)), True) +gabor_wavelet_transform = bob.ip.gabor.Transform(k_max = 0.25 * math.pi) +# pre-allocate Gabor wavelet transform image in the desired size +trafo_image = numpy.ndarray((gabor_wavelet_transform.number_of_wavelets, 112, 92), numpy.complex128) -def extract_feature(image, graph_machine): +def extract_feature(image, graph): """Extracts the Gabor graphs from the given image""" # perform Gabor wavelet transform on the image - gabor_wavelet_transform.compute_jets(image, gabor_jet_image) + gabor_wavelet_transform.transform(image, trafo_image) # extract the Gabor graphs from the feature image - gabor_graph = graph_machine(gabor_jet_image) + gabor_graph = graph.extract(trafo_image) # return the extracted graph return gabor_graph # define a certain Gabor jet similarity function that should be used -SIMILARITY_FUNCTION = bob.machine.GaborJetSimilarity(bob.machine.gabor_jet_similarity_type.PHASE_DIFF_PLUS_CANBERRA, gabor_wavelet_transform) +SIMILARITY_FUNCTION = bob.ip.gabor.Similarity('PhaseDiffPlusCanberra', gabor_wavelet_transform) def main(): """This function will perform Gabor graph comparison test on the AT&T database.""" # use the bob.db interface to retrieve information about the Database - atnt_db = xbob.db.atnt.Database() + atnt_db = bob.db.atnt.Database() # Check the existence of the AT&T database and download it if not # Also check if the AT&T database directory is overwritten by the command line @@ -90,7 +96,7 @@ def main(): print("Creating Gabor graph machine") # create a machine that will produce tight Gabor graphs with inter-node distance (4,4) - graph_machine = bob.machine.GaborGraphMachine((8,6), (104,86), (4,4)) + graph_machine = bob.ip.gabor.Graph(first=(8,6), last=(104,86), step=(4,4)) ##################################################################### ### extract Gabor graph features for all model and probe images @@ -133,9 +139,9 @@ def main(): model_count += 1 for probe_key, probe_feature in probe_features.iteritems(): # compute local scores for each model gabor jet and each probe jet - scores = numpy.ndarray((len(model), probe_feature.shape[0]), dtype = numpy.float) + scores = numpy.ndarray((len(model), len(probe_feature)), dtype = numpy.float) for model_feature_index in range(len(model)): - for gabor_jet_index in range(probe_feature.shape[0]): + for gabor_jet_index in range(len(probe_feature)): scores[model_feature_index, gabor_jet_index] = SIMILARITY_FUNCTION(model[model_feature_index][gabor_jet_index], probe_feature[gabor_jet_index]) # the final score is computed as the average over all positions, taking the most similar model jet diff --git a/xbob/example/faceverify/tests/__init__.py b/bob/example/faceverify/tests/__init__.py similarity index 65% rename from xbob/example/faceverify/tests/__init__.py rename to bob/example/faceverify/tests/__init__.py index 69b0f3034aeb8ae08e8a8f7c938543269781e30a..275beaefe3dce08a0666c89b09f761f8594d06a7 100644 --- a/xbob/example/faceverify/tests/__init__.py +++ b/bob/example/faceverify/tests/__init__.py @@ -24,13 +24,17 @@ import os, sys import unittest from nose.plugins.skip import SkipTest -import bob +import bob.io.base +import bob.learn.linear +import bob.ip.gabor +import bob.learn.misc + import numpy, numpy.linalg -import xbob.db.atnt +import bob.db.atnt import pkg_resources -import xbob.example.faceverify +import bob.example.faceverify regenerate_references = False @@ -60,7 +64,8 @@ class FaceVerifyExampleTest(unittest.TestCase): shutil.rmtree(self.m_temp_dir) def resource(self, f): - return pkg_resources.resource_filename('xbob.example.faceverify.tests', f) + return pkg_resources.resource_filename('bob.example.faceverify.tests', f) + def test00_database(self): # test that the database exists @@ -70,15 +75,16 @@ class FaceVerifyExampleTest(unittest.TestCase): for d in subdirs: self.assertTrue(set(files).issubset(os.listdir(os.path.join(self.m_database_dir,d)))) + def test01_eigenface(self): # test the eigenface algorithm try: - from xbob.example.faceverify.eigenface import load_images, train, extract_feature, DISTANCE_FUNCTION + from bob.example.faceverify.eigenface import load_images, train, extract_feature, DISTANCE_FUNCTION except ImportError as e: - raise SkipTest("Skipping the tests since importing from faceverify.eigenface raised exception '%s'"%e) + raise SkipTest("Skipping the tests since importing from bob.example.faceverify.eigenface raised exception '%s'"%e) # open database - atnt_db = xbob.db.atnt.Database() + atnt_db = bob.db.atnt.Database() # test if all training images are loaded images = load_images(atnt_db, group = 'world', database_directory = self.m_database_dir) self.assertEqual(len(images), 200) @@ -86,10 +92,10 @@ class FaceVerifyExampleTest(unittest.TestCase): # test that the training works (for speed reasons, we limit the number of training files) pca = train(images) if regenerate_references: - pca.save(bob.io.HDF5File(self.resource('pca_projector.hdf5'), 'w')) + pca.save(bob.io.base.HDF5File(self.resource('pca_projector.hdf5'), 'w')) # load PCA reference and check that it is still similar - pca_ref = bob.machine.LinearMachine(bob.io.HDF5File(self.resource('pca_projector.hdf5'))) + pca_ref = bob.learn.linear.Machine(bob.io.base.HDF5File(self.resource('pca_projector.hdf5'))) self.assertTrue(pca_ref.is_similar_to(pca)) # check the the projection is the same @@ -97,12 +103,12 @@ class FaceVerifyExampleTest(unittest.TestCase): probe = extract_feature(images[2], pca) if regenerate_references: - bob.io.save(model, self.resource('pca_model.hdf5')) - bob.io.save(probe, self.resource('pca_probe.hdf5')) + bob.io.base.save(model, self.resource('pca_model.hdf5')) + bob.io.base.save(probe, self.resource('pca_probe.hdf5')) # load model and probe reference - model_ref = bob.io.load(self.resource('pca_model.hdf5')) - probe_ref = bob.io.load(self.resource('pca_probe.hdf5')) + model_ref = bob.io.base.load(self.resource('pca_model.hdf5')) + probe_ref = bob.io.base.load(self.resource('pca_probe.hdf5')) self.assertTrue(numpy.allclose(model_ref, model)) self.assertTrue(numpy.allclose(probe_ref, probe)) @@ -114,47 +120,48 @@ class FaceVerifyExampleTest(unittest.TestCase): def test02_gabor_graph(self): # test the gabor phase algorithm try: - from xbob.example.faceverify.gabor_graph import load_images, extract_feature, SIMILARITY_FUNCTION + from bob.example.faceverify.gabor_graph import load_images, extract_feature, SIMILARITY_FUNCTION except ImportError as e: - raise SkipTest("Skipping the tests since importing from faceverify.gabor_phase raised exception '%s'"%e) + raise SkipTest("Skipping the tests since importing from bob.example.faceverify.gabor_graph raised exception '%s'"%e) # open database - atnt_db = xbob.db.atnt.Database() + atnt_db = bob.db.atnt.Database() # test if all training images are loaded images = load_images(atnt_db, group = 'world', database_directory = self.m_database_dir) self.assertEqual(len(images), 200) # extract features; for test purposes we wil use smaller features with inter-node-distance 8 - graph_machine = bob.machine.GaborGraphMachine((0,0), (111,91), (8,8)) + graph_machine = bob.ip.gabor.Graph((0,0), (111,91), (8,8)) # check the the projection is the same model = extract_feature(images[1], graph_machine) probe = extract_feature(images[2], graph_machine) if regenerate_references: - bob.io.save(model, self.resource('gabor_model.hdf5')) - bob.io.save(probe, self.resource('gabor_probe.hdf5')) + bob.ip.gabor.save_jets(model, bob.io.base.HDF5File(self.resource('gabor_model.hdf5'), 'w')) + bob.ip.gabor.save_jets(probe, bob.io.base.HDF5File(self.resource('gabor_probe.hdf5'), 'w')) # load model and probe reference - model_ref = bob.io.load(self.resource('gabor_model.hdf5')) - probe_ref = bob.io.load(self.resource('gabor_probe.hdf5')) - self.assertTrue(numpy.allclose(model_ref, model)) - self.assertTrue(numpy.allclose(probe_ref, probe)) + model_ref = bob.ip.gabor.load_jets(bob.io.base.HDF5File(self.resource('gabor_model.hdf5'))) + probe_ref = bob.ip.gabor.load_jets(bob.io.base.HDF5File(self.resource('gabor_probe.hdf5'))) + for i in range(len(model_ref)): + self.assertTrue(numpy.allclose(model_ref[i].jet, model[i].jet)) + self.assertTrue(numpy.allclose(probe_ref[i].jet, probe[i].jet)) # compute score - score = graph_machine.similarity(model, probe, SIMILARITY_FUNCTION) + score = numpy.mean([SIMILARITY_FUNCTION.similarity(model[i], probe[i]) for i in range(len(model))]) self.assertAlmostEqual(score, 0.414937662799) def test03_dct_ubm(self): # test the UBM/GMM algorithm try: - from xbob.example.faceverify.dct_ubm import load_images, extract_feature, train, enroll, stats, NUMBER_OF_GAUSSIANS + from bob.example.faceverify.dct_ubm import load_images, extract_feature, train, enroll, stats, NUMBER_OF_GAUSSIANS except ImportError as e: - raise SkipTest("Skipping the tests since importing from faceverify.dct_ubm raised exception '%s'"%e) + raise SkipTest("Skipping the tests since importing from bob.example.faceverify.dct_ubm raised exception '%s'"%e) # open database - atnt_db = xbob.db.atnt.Database() + atnt_db = bob.db.atnt.Database() # test if all training images are loaded images = load_images(atnt_db, group = 'world', database_directory = self.m_database_dir) keys = sorted(images.keys()) @@ -163,9 +170,9 @@ class FaceVerifyExampleTest(unittest.TestCase): # test that the original DCT extraction works dct_feature = extract_feature(images[1]) if regenerate_references: - bob.io.save(dct_feature, self.resource('dct_feature.hdf5')) + bob.io.base.save(dct_feature, self.resource('dct_feature.hdf5')) - feature_ref = bob.io.load(self.resource('dct_feature.hdf5')) + feature_ref = bob.io.base.load(self.resource('dct_feature.hdf5')) self.assertTrue(numpy.allclose(feature_ref, dct_feature)) # extract features for several images @@ -180,15 +187,15 @@ class FaceVerifyExampleTest(unittest.TestCase): for i in keys[:10]: trainset[i] = features[i] ubm = train(trainset, number_of_gaussians = 2) if regenerate_references: - ubm.save(bob.io.HDF5File(self.resource('dct_ubm.hdf5'), 'w')) + ubm.save(bob.io.base.HDF5File(self.resource('dct_ubm.hdf5'), 'w')) # load PCA reference and check that it is still similar - ubm_ref = bob.machine.GMMMachine(bob.io.HDF5File(self.resource('dct_ubm.hdf5'))) + ubm_ref = bob.learn.misc.GMMMachine(bob.io.base.HDF5File(self.resource('dct_ubm.hdf5'))) self.assertTrue(ubm_ref.is_similar_to(ubm)) # enroll a model with two features - enroller = bob.trainer.MAP_GMMTrainer() + enroller = bob.learn.misc.MAP_GMMTrainer() enroller.max_iterations = 1 enroller.set_prior_gmm(ubm) # model = enroll({i : features[i] for i in keys[10:12]}, ubm, enroller) @@ -196,20 +203,20 @@ class FaceVerifyExampleTest(unittest.TestCase): for i in keys[10:12]: enrollset[i] = features[i] model = enroll(enrollset, ubm, enroller) if regenerate_references: - model.save(bob.io.HDF5File(self.resource('dct_model.hdf5'), 'w')) + model.save(bob.io.base.HDF5File(self.resource('dct_model.hdf5'), 'w')) - model_ref = bob.machine.GMMMachine(bob.io.HDF5File(self.resource('dct_model.hdf5'))) + model_ref = bob.learn.misc.GMMMachine(bob.io.base.HDF5File(self.resource('dct_model.hdf5'))) self.assertTrue(model_ref.is_similar_to(model)) # compute probe statistics probe = stats(features[keys[12]], ubm) if regenerate_references: - probe.save(bob.io.HDF5File(self.resource('dct_probe.hdf5'), 'w')) + probe.save(bob.io.base.HDF5File(self.resource('dct_probe.hdf5'), 'w')) - probe_ref = bob.machine.GMMStats(bob.io.HDF5File(self.resource('dct_probe.hdf5'))) + probe_ref = bob.learn.misc.GMMStats(bob.io.base.HDF5File(self.resource('dct_probe.hdf5'))) self.assertTrue(probe_ref.is_similar_to(probe)) # compute score - score = bob.machine.linear_scoring([model], ubm, [probe])[0,0] + score = bob.learn.misc.linear_scoring([model], ubm, [probe])[0,0] self.assertAlmostEqual(score, 6975.2165874138391) diff --git a/xbob/example/faceverify/tests/dct_feature.hdf5 b/bob/example/faceverify/tests/dct_feature.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/dct_feature.hdf5 rename to bob/example/faceverify/tests/dct_feature.hdf5 diff --git a/xbob/example/faceverify/tests/dct_model.hdf5 b/bob/example/faceverify/tests/dct_model.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/dct_model.hdf5 rename to bob/example/faceverify/tests/dct_model.hdf5 diff --git a/xbob/example/faceverify/tests/dct_probe.hdf5 b/bob/example/faceverify/tests/dct_probe.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/dct_probe.hdf5 rename to bob/example/faceverify/tests/dct_probe.hdf5 diff --git a/xbob/example/faceverify/tests/dct_ubm.hdf5 b/bob/example/faceverify/tests/dct_ubm.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/dct_ubm.hdf5 rename to bob/example/faceverify/tests/dct_ubm.hdf5 diff --git a/bob/example/faceverify/tests/gabor_model.hdf5 b/bob/example/faceverify/tests/gabor_model.hdf5 new file mode 100644 index 0000000000000000000000000000000000000000..3244215773b159c03e769604cb106a3ca96dd64e Binary files /dev/null and b/bob/example/faceverify/tests/gabor_model.hdf5 differ diff --git a/bob/example/faceverify/tests/gabor_probe.hdf5 b/bob/example/faceverify/tests/gabor_probe.hdf5 new file mode 100644 index 0000000000000000000000000000000000000000..a6be2757df123f9c5f2724673da566fbf2464fb0 Binary files /dev/null and b/bob/example/faceverify/tests/gabor_probe.hdf5 differ diff --git a/xbob/example/faceverify/tests/pca_model.hdf5 b/bob/example/faceverify/tests/pca_model.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/pca_model.hdf5 rename to bob/example/faceverify/tests/pca_model.hdf5 diff --git a/xbob/example/faceverify/tests/pca_probe.hdf5 b/bob/example/faceverify/tests/pca_probe.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/pca_probe.hdf5 rename to bob/example/faceverify/tests/pca_probe.hdf5 diff --git a/xbob/example/faceverify/tests/pca_projector.hdf5 b/bob/example/faceverify/tests/pca_projector.hdf5 similarity index 100% rename from xbob/example/faceverify/tests/pca_projector.hdf5 rename to bob/example/faceverify/tests/pca_projector.hdf5 diff --git a/xbob/example/faceverify/utils.py b/bob/example/faceverify/utils.py similarity index 100% rename from xbob/example/faceverify/utils.py rename to bob/example/faceverify/utils.py diff --git a/buildout.cfg b/buildout.cfg index 7d21d76a6a93188ef12c6565c5150c456233403f..2719550ebd5290ea0f27ed31bbcd3bf0d4fa78b1 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -1,14 +1,54 @@ ; vim: set fileencoding=utf-8 : -; Manuel Guenther <Manuel.Guenther@idiap.ch> -; Tue Sep 4 14:34:37 CEST 2012 - -; This is the configuration file for buildout. +; Andre Anjos <andre.anjos@idiap.ch> +; Mon 16 Apr 08:29:18 2012 CEST [buildout] parts = scripts -develop = . -eggs = xbob.example.faceverify +eggs = bob.example.faceverify +extensions = bob.buildout + mr.developer +auto-checkout = * +develop = src/bob.extension + src/bob.blitz + src/bob.core + src/bob.io.base + src/bob.io.image + src/bob.sp + src/bob.math + src/bob.measure + src/bob.learn.activation + src/bob.learn.linear + src/bob.learn.misc + src/bob.ip.base + src/bob.ip.gabor + src/bob.db.base + src/bob.db.verification.utils + src/bob.db.atnt + . + +; options for bob.buildout extension +debug = true +verbose = true 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.sp = git https://github.com/bioidiap/bob.sp +bob.math = git https://github.com/bioidiap/bob.math +bob.measure = git https://github.com/bioidiap/bob.measure +bob.learn.activation = git https://github.com/bioidiap/bob.learn.activation +bob.learn.linear = git https://github.com/bioidiap/bob.learn.linear +bob.learn.misc = git https://github.com/bioidiap/bob.learn.misc +bob.ip.base = git https://github.com/bioidiap/bob.ip.base +bob.ip.gabor = git https://github.com/bioidiap/bob.ip.gabor +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.atnt = git https://github.com/bioidiap/bob.db.atnt + + [scripts] -recipe = xbob.buildout:scripts +recipe = bob.buildout:scripts diff --git a/setup.py b/setup.py index e04a747c6a50469938a0b6e7fd6a4faedafd5ce8..e9e4f1022d309f634d6843648e92787b4310f5f3 100644 --- a/setup.py +++ b/setup.py @@ -27,10 +27,10 @@ setup( # This is the basic information about your project. Modify all this # information before releasing code publicly. - name='xbob.example.faceverify', - version='1.0.0', + name='bob.example.faceverify', + version='2.0.0a0', description='Example for using Bob to create face verification systems', - url='http://pypi.python.org/pypi/xbob.example.faceverify', + url='http://pypi.python.org/pypi/bob.example.faceverify', license='GPLv3', author='Manuel Guenther', author_email='manuel.guenther@idiap.ch', @@ -49,17 +49,22 @@ setup( # privileges when using buildout. install_requires=[ - "setuptools", - "bob >= 1.2.0", # base signal proc./machine learning library - "xbob.db.atnt", # the AT&T (ORL) database of images + "setuptools", + "bob.io.image", # image IO + "bob.ip.base", # tan-triggs, dct-blocks + "bob.ip.gabor", # gabor graph + "bob.learn.linear", # eigenfaces + "bob.learn.misc", # ubm-gmm + "bob.measure", # computing ROC + "bob.db.atnt", # the AT&T (ORL) database of images ], # This package is good examples of namespace implementations # using several layers. You can check them out here: # https://github.com/idiap/bob/wiki/Satellite-Packages namespace_packages = [ - 'xbob', - 'xbob.example', + 'bob', + 'bob.example', ], # This entry defines which scripts you will have inside the 'bin' directory @@ -67,25 +72,28 @@ setup( # entry under 'console_scripts' is like this: # script-name-at-bin-directory = module.at.your.library:function entry_points={ - 'console_scripts': [ - 'eigenface.py = xbob.example.faceverify.eigenface:main', - 'gabor_graph.py = xbob.example.faceverify.gabor_graph:main', - 'dct_ubm.py = xbob.example.faceverify.dct_ubm:main' - ], + 'console_scripts': + [ + 'eigenface.py = bob.example.faceverify.eigenface:main', + 'gabor_graph.py = bob.example.faceverify.gabor_graph:main', + 'dct_ubm.py = bob.example.faceverify.dct_ubm:main' + ], # bob unittest declaration - 'bob.test': [ - 'faceverify = xbob.example.faceverify.tests:FaceVerifyExampleTest', - ], - }, + 'bob.test': + [ + 'faceverify = faceverify.tests:FaceVerifyExampleTest', + ], + }, classifiers = [ - 'Development Status :: 5 - Production/Stable', + 'Development Status :: 4 - Beta', 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 'Intended Audience :: Education', 'Intended Audience :: Science/Research', 'Natural Language :: English', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - ], + ], + ) diff --git a/xbob/example/faceverify/tests/gabor_model.hdf5 b/xbob/example/faceverify/tests/gabor_model.hdf5 deleted file mode 100644 index 910adb7ddd2f84fc85c26aba47653e1cbc69de9a..0000000000000000000000000000000000000000 Binary files a/xbob/example/faceverify/tests/gabor_model.hdf5 and /dev/null differ diff --git a/xbob/example/faceverify/tests/gabor_probe.hdf5 b/xbob/example/faceverify/tests/gabor_probe.hdf5 deleted file mode 100644 index 353c03beafd7503ac8a15db1d31dfec20c2905ab..0000000000000000000000000000000000000000 Binary files a/xbob/example/faceverify/tests/gabor_probe.hdf5 and /dev/null differ