diff --git a/bob/bio/vein/configurations/fv3d.py b/bob/bio/vein/configurations/fv3d.py new file mode 100644 index 0000000000000000000000000000000000000000..9fbc0ff1feead8db61ef96e29c586906556f52b8 --- /dev/null +++ b/bob/bio/vein/configurations/fv3d.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : + +"""`3D Fingervein`_ is a database for biometric fingervein recognition + +The `3D Fingervein`_ Database for finger vein recognition consists of 13614 +images from 141 subjects collected in various acquisition campaigns. + +You can download the raw data of the `3D Fingervein`_ database by following +the link. +""" + + +from ..database.fv3d import Database + +fv3d_directory = "[YOUR_FV3D_DIRECTORY]" +"""Value of ``~/.bob_bio_databases.txt`` for this database""" + +database = Database( + original_directory = fv3d_directory, + original_extension = '.png', + ) +"""The :py:class:`bob.bio.base.database.BioDatabase` derivative with fv3d +database settings + +.. warning:: + + This class only provides a programmatic interface to load data in an orderly + manner, respecting usage protocols. It does **not** contain the raw + datafiles. You should procure those yourself. + +Notice that ``original_directory`` is set to ``[YOUR_FV3D_DIRECTORY]``. You +must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this value +to the place where you actually installed the `3D Fingervein`_ Database, as +explained in the section :ref:`bob.bio.vein.baselines`. +""" + +protocol = 'central' +"""The default protocol to use for tests + +You may modify this at runtime by specifying the option ``--protocol`` on the +command-line of ``verify.py`` or using the keyword ``protocol`` on a +configuration file that is loaded **after** this configuration resource. +""" diff --git a/bob/bio/vein/configurations/verafinger.py b/bob/bio/vein/configurations/verafinger.py index 3acfe0cb5c52e802f6fc0d18cda8ecd4b2304494..f1b7c72cb7850c69b73fe34ebca8248cb09e6ee5 100644 --- a/bob/bio/vein/configurations/verafinger.py +++ b/bob/bio/vein/configurations/verafinger.py @@ -10,8 +10,6 @@ Occidentale in Sion, in Switzerland. The reference citation is [TVM14]_. You can download the raw data of the `VERA Fingervein`_ database by following the link. - -.. include:: links.rst """ diff --git a/bob/bio/vein/database/fv3d.py b/bob/bio/vein/database/fv3d.py new file mode 100644 index 0000000000000000000000000000000000000000..28d2886f2d9f4f6b2a5fecacc11ebb89e3996388 --- /dev/null +++ b/bob/bio/vein/database/fv3d.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Fri 13 Jan 2017 14:46:06 CET + + +import numpy +from bob.bio.base.database import BioFile, BioDatabase + + +class File(BioFile): + """ + Implements extra properties of vein files for the Vera Fingervein database + + + Parameters: + + f (object): Low-level file (or sample) object that is kept inside + + """ + + def __init__(self, f): + + super(File, self).__init__(client_id=f.finger.unique_name, path=f.path, + file_id=f.id) + self.__f = f + + + def load(self, *args, **kwargs): + """(Overrides base method) Loads both image and mask""" + + image = super(File, self).load(*args, **kwargs) + + # image is upside, whereas this package requires fingers to be horizontal + return numpy.rot90(image) + + +class Database(BioDatabase): + """ + Implements verification API for querying Vera Fingervein database. + """ + + def __init__(self, **kwargs): + + super(Database, self).__init__(name='fv3d', **kwargs) + from bob.db.fv3d.query import Database as LowLevelDatabase + self.__db = LowLevelDatabase() + + self.low_level_group_names = ('train', 'dev', 'eval') + self.high_level_group_names = ('world', 'dev', 'eval') + + + def groups(self): + + return self.convert_names_to_highlevel(self.__db.groups(), + self.low_level_group_names, self.high_level_group_names) + + + def client_id_from_model_id(self, model_id, group='dev'): + """Required as ``model_id != client_id`` on this database""" + + return self.__db.finger_name_from_model_id(model_id) + + + def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs): + + groups = self.convert_names_to_lowlevel(groups, + self.low_level_group_names, self.high_level_group_names) + return self.__db.model_ids(groups=groups, protocol=protocol) + + + def objects(self, groups=None, protocol=None, purposes=None, + model_ids=None, **kwargs): + + groups = self.convert_names_to_lowlevel(groups, + self.low_level_group_names, self.high_level_group_names) + retval = self.__db.objects(groups=groups, protocol=protocol, + purposes=purposes, model_ids=model_ids, **kwargs) + + return [File(f) for f in retval] diff --git a/doc/baselines.rst b/doc/baselines.rst index a0bc3ddb6703c687eff61280ce6350e70faa8349..418b790e8470ab6d7e05bf09d3a8228f4516d018 100644 --- a/doc/baselines.rst +++ b/doc/baselines.rst @@ -74,6 +74,7 @@ is available on the section :ref:`bob.bio.vein.resources`. [YOUR_VERAFINGER_DIRECTORY] = /complete/path/to/verafinger [YOUR_UTFVP_DIRECTORY] = /complete/path/to/utfvp + [YOUR_FV3D_DIRECTORY] = /complete/path/to/fv3d Notice it is rather important to use the strings as described above, otherwise ``bob.bio.base`` will not be able to correctly load your images. diff --git a/setup.py b/setup.py index 78a4761d545589f9b4db2ec974b8ac990587dff6..e1f01705511df020a1f22c556be99260d7e3a443 100644 --- a/setup.py +++ b/setup.py @@ -35,6 +35,7 @@ setup( # databases 'verafinger = bob.bio.vein.configurations.verafinger', 'utfvp = bob.bio.vein.configurations.utfvp', + 'fv3d = bob.bio.vein.configurations.fv3d', # baselines 'mc = bob.bio.vein.configurations.maximum_curvature',