Commit e783bf2e authored by André Anjos's avatar André Anjos 💬

Add support for 3D Fingervein Database

parent 6e23462a
#!/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.
"""
......@@ -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
"""
......
#!/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]
......@@ -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.
......
......@@ -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',
......
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