Skip to content
Snippets Groups Projects
Commit 771f56f1 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

Fix errors on databases

parent b4d0a6d0
Branches
Tags
1 merge request!18Simplifications
Pipeline #
......@@ -17,12 +17,12 @@ You can download the raw data of the `UTFVP`_ database by following the link.
.. include:: links.rst
"""
from bob.bio.vein.database import UtfvpBioDatabase
from bob.bio.vein.database.utfvp import Database
utfvp_directory = "[YOUR_UTFVP_DIRECTORY]"
"""Value of ``~/.bob_bio_databases.txt`` for this database"""
database = UtfvpBioDatabase(
database = Database(
original_directory = utfvp_directory,
original_extension = '.png',
)
......
......@@ -15,12 +15,12 @@ the link.
"""
from bob.bio.vein.database import VerafingerBioDatabase
from bob.bio.vein.database.verafinger import Database
verafinger_directory = "[YOUR_VERAFINGER_DIRECTORY]"
"""Value of ``~/.bob_bio_databases.txt`` for this database"""
database = VerafingerBioDatabase(
database = Database(
original_directory = verafinger_directory,
original_extension = '.png',
)
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from .database import VeinBioFile
from .verafinger import VerafingerBioDatabase
from .utfvp import UtfvpBioDatabase
# gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')]
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# Tue 27 Sep 2016 16:49:05 CEST
# Fri 04 Nov 2016 14:46:53 CET
from .database import VeinBioFile
from bob.bio.base.database import BioDatabase
from bob.bio.base.database import BioFile, BioDatabase
class UtfvpBioDatabase(BioDatabase):
class File(BioFile):
"""
Implements extra properties of vein files for the UTFVP 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.client_id, path=f.path,
file_id=f.id)
self.__f = f
class Database(BioDatabase):
"""
Implements verification API for querying UTFVP Fingervein database.
"""
def __init__(self, **kwargs):
super(UtfvpBioDatabase, self).__init__(name='utfvp',
**kwargs)
super(Database, 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.id) for f in retval]
return [File(f) for f in retval]
......@@ -4,12 +4,11 @@
from bob.bio.base.database import BioFile, BioDatabase
from bob.bio.base.database.file import BioFile
class VerafingerBioFile(BioFile):
class File(BioFile):
"""
Implements extra properties of vein files
Implements extra properties of vein files for the Vera Fingervein database
Parameters:
......@@ -20,52 +19,54 @@ class VerafingerBioFile(BioFile):
def __init__(self, f):
super(VerafingerBioFile, self).__init__(
client_id=f.model_id,
path=f.path,
file_id=f.id,
)
self.f = f
super(File, self).__init__(client_id=f.model_id, path=f.path,
file_id=f.id)
self.__f = f
def roi(self):
"""Returns the binary mask from the ROI annotations available"""
from ..preprocessor.utils import poly_to_mask
points = self.f.roi()
# The size of images in this database is (250, 665) pixels (h, w)
return poly_to_mask((250, 665), self.__f.roi())
class VerafingerBioDatabase(BioDatabase):
class Database(BioDatabase):
"""
Implements verification API for querying Vera Fingervein database.
"""
def __init__(self, **kwargs):
super(VerafingerBioDatabase, self).__init__(name='verafinger',
**kwargs)
super(Database, 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):
......@@ -73,4 +74,5 @@ class VerafingerBioDatabase(BioDatabase):
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(f) for f in retval]
return [File(f) for f in retval]
......@@ -15,7 +15,15 @@ which can be used for vein experiments.
Database Interfaces
-------------------
.. automodule:: bob.bio.vein.database
Vera Fingervein Database
========================
.. automodule:: bob.bio.vein.database.verafinger
UTFVP Database
==============
.. automodule:: bob.bio.vein.database.utfvp
Pre-processors
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment