diff --git a/bob/bio/vein/configurations/database/__init__.py b/bob/bio/vein/configurations/database/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/bob/bio/vein/configurations/database/biowave_test.py b/bob/bio/vein/configurations/database/biowave_test.py new file mode 100644 index 0000000000000000000000000000000000000000..0fd6d9b23a1d2d3e751afc7ce8dc5c075642d316 --- /dev/null +++ b/bob/bio/vein/configurations/database/biowave_test.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from bob.bio.vein.database import BiowaveTestBioDatabase + +biowave_test_image_directory = "[YOUR_BIOWAVE_TEST_IMAGE_DIRECTORY]" + +database = BiowaveTestBioDatabase( + original_directory=biowave_test_image_directory, + original_extension='.png', + protocol='all' +) diff --git a/bob/bio/vein/configurations/database/utfvp.py b/bob/bio/vein/configurations/database/utfvp.py new file mode 100644 index 0000000000000000000000000000000000000000..87e5b246f1b7fdc9f7c6d89264b22e819e63fc7e --- /dev/null +++ b/bob/bio/vein/configurations/database/utfvp.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from bob.bio.vein.database import UtfvpBioDatabase + +utfvp_directory = "[YOUR_UTFVP_DIRECTORY]" + +database = UtfvpBioDatabase( + original_directory = utfvp_directory, + extension = ".png", + ) + diff --git a/bob/bio/vein/configurations/database/verafinger.py b/bob/bio/vein/configurations/database/verafinger.py new file mode 100644 index 0000000000000000000000000000000000000000..4c5228b47d0bbf99d335e7bf44daa5f77d21ea86 --- /dev/null +++ b/bob/bio/vein/configurations/database/verafinger.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python + +from bob.bio.vein.database import VerafingerBioDatabase + +vera_finger_directory = "[YOUR_VERAFINGER_DIRECTORY]" + +database = VerafingerBioDatabase( + original_directory = vera_finger_directory, + original_extension = '.png', + ) + diff --git a/bob/bio/vein/configurations/databases.py b/bob/bio/vein/configurations/databases.py deleted file mode 100644 index 796abd82066a2af8b9482fd8ba977aa0e0b5a688..0000000000000000000000000000000000000000 --- a/bob/bio/vein/configurations/databases.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -# vim: set fileencoding=utf-8 : - -import bob.bio.db - -verafinger = bob.bio.db.VerafingerBioDatabase( - original_directory = '/idiap/project/vera/databases/VERA-fingervein', - original_extension = '.png', - ) - -utfvp = bob.bio.db.UtfvpBioDatabase( - original_directory = '/idiap/resource/database/UTFVP/data', - extension = ".png", - ) diff --git a/bob/bio/vein/database/__init__.py b/bob/bio/vein/database/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1be8375267bfa7fdde81321179cc112c981121eb --- /dev/null +++ b/bob/bio/vein/database/__init__.py @@ -0,0 +1,10 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : + +from .database import VeinBioFile +from .biowave_test import BiowaveTestBioDatabase +from .verafinger import VerafingerBioDatabase +from .utfvp import UtfvpBioDatabase + +# gets sphinx autodoc done right - don't remove it +__all__ = [_ for _ in dir() if not _.startswith('_')] diff --git a/bob/bio/vein/database/biowave_test.py b/bob/bio/vein/database/biowave_test.py new file mode 100644 index 0000000000000000000000000000000000000000..dc6d57cc6594f8e5239d4dd4febb2d373831c3d5 --- /dev/null +++ b/bob/bio/vein/database/biowave_test.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Teodors Eglitis <teodors.eglitis@idiap.ch> +# Wed 20 Jul + +""" + BIOWAVE_TEST database implementation of bob.bio.db.BioDatabase interface. + It is an extension of an SQL-based database interface, which directly talks to BIOWAVE_TEST database for + verification experiments (good to use in bob.bio.base framework). +""" + +from .database import VeinBioFile +from bob.bio.base.database import BioDatabase, BioFile + + +class BiowaveTestBioDatabase(BioDatabase): + """ + Implements verification API for querying BIOWAVE_TEST database. + """ + + def __init__( + self, + **kwargs + ): + # before it was also "name" in the init. + # + # the BioDatabase class is defined in: + # bob.bio.db/bob/bio/db/database.py + # + # In this -- the high level implementation we call base class constructors to + # open a session to the database. We use **kwargs so that we could pass + # the arguments later, e.g. from the default database configuration. + + super(BiowaveTestBioDatabase, self).__init__(name='biowave_test', **kwargs) + + from bob.db.biowave_test.query import Database as LowLevelDatabase + self.__db = LowLevelDatabase() + + def client_id_from_model_id(self, model_id, group='dev'): + """Required as ``model_id != client_id`` on this database""" + return self.__db.client_id_from_model_id(model_id) + + def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs): + return self.__db.model_ids(protocol=protocol, groups=groups) + + def objects(self, protocol=None, groups=None, purposes=None, model_ids=None, **kwargs): + retval = self.__db.objects(protocol=protocol, groups=groups, purposes=purposes, model_ids=model_ids) + return [VeinBioFile(client_id=f.client_id, path=f.path, file_id=f.file_id) for f in retval] + + # the methodes are derived from: + # bob.bio.db/bob/bio/db/database.py + # this means that methodes defined there need to have certain arguments, e.g.: + # model_ids_with_protocol: + # groups; + # protocol; + # objects: + # groups; + # protocol; + # purposes; + # model_ids; + # If you have some other arguments to pass, use **kwargs, if your methods doesn't have some + # arguments, just don't pass them (e.g. see the model_ids). diff --git a/bob/bio/vein/database/database.py b/bob/bio/vein/database/database.py new file mode 100644 index 0000000000000000000000000000000000000000..3a252f358e2cf6405a7a696f2281e3476b2c0c5f --- /dev/null +++ b/bob/bio/vein/database/database.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : +# Tiago de Freitas Pereira <tiago.pereira@idiap.ch> +# Wed 20 July 14:43:22 CEST 2016 + +""" + Verification API for bob.db.voxforge +""" + +from bob.bio.base.database.file import BioFile + + +class VeinBioFile(BioFile): + def __init__(self, client_id, path, file_id): + """ + Initializes this File object with an File equivalent for + VoxForge database. + """ + super(VeinBioFile, self).__init__(client_id=client_id, path=path, file_id=file_id) + + self.__f = f + + diff --git a/bob/bio/vein/database/utfvp.py b/bob/bio/vein/database/utfvp.py new file mode 100644 index 0000000000000000000000000000000000000000..fe27084e5e18f9cb3f6886c175c1bb6d1092bdef --- /dev/null +++ b/bob/bio/vein/database/utfvp.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : + +from .database import VeinBioFile +from bob.bio.base.database import BioDatabase, BioFile + + +class UtfvpBioDatabase(BioDatabase): + """ + Implements verification API for querying UTFVP Fingervein database. + """ + + def __init__(self, **kwargs): + + super(UtfvpBioDatabase, self).__init__(name='utfvp', + **kwargs) + from bob.db.utfvp.query import Database as LowLevelDatabase + self.__db = LowLevelDatabase() + + def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs): + protocol = protocol if protocol is not None else self.protocol + return self.__db.model_ids(groups=groups, protocol=protocol) + + def objects(self, groups=None, protocol=None, purposes=None, + model_ids=None, **kwargs): + + retval = self.__db.objects(groups=groups, protocol=protocol, + purposes=purposes, model_ids=model_ids, **kwargs) + return [VeinBioFile(client_id=f.client_id, path=f.path, file_id=f.file_id) for f in retval] diff --git a/bob/bio/vein/database/verafinger.py b/bob/bio/vein/database/verafinger.py new file mode 100644 index 0000000000000000000000000000000000000000..5725b6e9bbdceb1b21ce1b9897553d2c6e188ef1 --- /dev/null +++ b/bob/bio/vein/database/verafinger.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : + + +from .database import VeinBioFile +from bob.bio.base.database import BioDatabase, BioFile + + +class VerafingerBioDatabase(BioDatabase): + """ + Implements verification API for querying Vera Fingervein database. + """ + + def __init__(self, **kwargs): + + super(VerafingerBioDatabase, self).__init__(name='verafinger', + **kwargs) + from bob.db.verafinger.query import Database as LowLevelDatabase + self.__db = LowLevelDatabase() + + self.low_level_group_names = ('train', 'dev') + self.high_level_group_names = ('world', 'dev') + + 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 [VeinBioFile(client_id=f.client_id, path=f.path, file_id=f.file_id) for f in retval] diff --git a/develop.cfg b/develop.cfg index 789100ef8c376b9fec1bcff976ba79679d22bd9e..f98552a8a54faada530843f8d86b8c3f9aab049b 100644 --- a/develop.cfg +++ b/develop.cfg @@ -1,5 +1,6 @@ ; vim: set fileencoding=utf-8 : -; Fri 19 Aug 2016 13:14:15 CEST +; Manuel Guenther <manuel.guenther@idiap.ch> +; Thu Oct 9 16:51:06 CEST 2014 [buildout] parts = scripts @@ -12,7 +13,6 @@ eggs = bob.bio.vein extensions = bob.buildout mr.developer - auto-checkout = * develop = src/bob.extension src/bob.blitz @@ -28,10 +28,10 @@ develop = src/bob.extension src/bob.db.verafinger src/bob.db.utfvp src/bob.db.putvein + src/bob.db.biowave_test src/bob.learn.activation src/bob.learn.linear src/bob.learn.em - src/bob.bio.db src/bob.bio.base . @@ -55,11 +55,13 @@ bob.db.base = git git@gitlab.idiap.ch:bob/bob.db.base bob.db.verafinger = git git@gitlab.idiap.ch:bob/bob.db.verafinger bob.db.utfvp = git git@gitlab.idiap.ch:bob/bob.db.utfvp bob.db.putvein = git git@gitlab.idiap.ch:bob/bob.db.putvein +bob.db.biowave_test = git git@gitlab.idiap.ch:bob/bob.db.biowave_test bob.learn.activation = git git@gitlab.idiap.ch:bob/bob.learn.activation bob.learn.linear = git git@gitlab.idiap.ch:bob/bob.learn.linear bob.learn.em = git git@gitlab.idiap.ch:bob/bob.learn.em -bob.bio.db = git git@gitlab.idiap.ch:bob/bob.bio.db bob.bio.base = git git@gitlab.idiap.ch:bob/bob.bio.base + [scripts] recipe = bob.buildout:scripts +dependent-scripts = true diff --git a/requirements.txt b/requirements.txt index 28095bc1f293b9a84737b63301ca2f8707656944..5b4ee81863853e897b7413582460194e3e55677b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ bob.io.matlab bob.io.image bob.ip.base bob.bio.base -bob.bio.db bob.db.utfvp bob.db.verafinger bob.db.putvein +bob.db.biowave_test \ No newline at end of file diff --git a/setup.py b/setup.py index 57a676678bcdeee616877e84bb65fca2d4a8c8cc..dad90b06385255f6626cd20740a99ef005cd2a2a 100644 --- a/setup.py +++ b/setup.py @@ -32,8 +32,8 @@ setup( entry_points={ 'bob.bio.database': [ - 'verafinger = bob.bio.vein.configurations.databases:verafinger', - 'utfvp = bob.bio.vein.configurations.databases:utfvp', + 'verafinger = bob.bio.vein.configurations.database.verafinger:database', + 'utfvp = bob.bio.vein.configurations.database.utfvp:database', ], 'bob.bio.preprocessor': [