Skip to content
Snippets Groups Projects
Commit 3df9949e authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch 'add-fargo' into 'master'

Add Fargo database

See merge request !52
parents 5a403b50 6ade4a79
No related branches found
No related tags found
1 merge request!52Add Fargo database
Pipeline #29977 passed
#!/usr/bin/env python
from bob.bio.face.database import FargoBioDatabase
fargo_directory = "[YOUR_FARGO_DIRECTORY]"
database = FargoBioDatabase(
original_directory=fargo_directory,
original_extension=".png",
protocol='mc-rgb'
)
...@@ -20,6 +20,9 @@ from .scface import SCFaceBioDatabase ...@@ -20,6 +20,9 @@ from .scface import SCFaceBioDatabase
from .replaymobile import ReplayMobileBioDatabase from .replaymobile import ReplayMobileBioDatabase
from .msu_mfsd_mod import MsuMfsdModBioDatabase from .msu_mfsd_mod import MsuMfsdModBioDatabase
from .fargo import FargoBioDatabase
# gets sphinx autodoc done right - don't remove it # gets sphinx autodoc done right - don't remove it
......
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""
FARGO database implementation of bob.bio.base.database.Database interface.
It is an extension of an SQL-based database interface, which directly talks to FARGO database, for
verification experiments (good to use in bob.bio.base framework).
"""
import os
import bob.db.base
from .database import FaceBioFile
from bob.bio.base.database import BioDatabase
class FargoBioDatabase(BioDatabase):
"""
FARGO database implementation of :py:class:`bob.bio.base.database.BioDatabase` interface.
It is an extension of the database interface, which directly talks to ATNT database, for
verification experiments (good to use in bob.bio.base framework).
"""
def __init__(
self,
original_directory=None,
original_extension='.png',
protocol='mc-rgb',
**kwargs
):
# call base class constructors to open a session to the database
super(FargoBioDatabase, self).__init__(
name='fargo',
original_directory=original_directory,
original_extension=original_extension,
protocol=protocol,
**kwargs)
from bob.db.fargo.query import Database as LowLevelDatabase
self._db = LowLevelDatabase(original_directory, original_extension, protocol=protocol)
def objects(self, groups=None, purposes=None, protocol=None, model_ids=None, **kwargs):
retval = self._db.objects(protocol=protocol, groups=groups, purposes=purposes, model_ids=model_ids, **kwargs)
return [FaceBioFile(client_id=f.client_id, path=f.path, file_id=f.id) for f in retval]
def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs):
return self._db.model_ids(groups=groups, protocol=protocol)
def annotations(self, file):
if self.annotation_directory is None:
return None
annotation_file = os.path.join(self.annotation_directory, file.path + self.annotation_extension)
return bob.db.base.read_annotation_file(annotation_file, 'eyecenter')
...@@ -390,3 +390,13 @@ def test_ijbc(): ...@@ -390,3 +390,13 @@ def test_ijbc():
raise SkipTest( raise SkipTest(
"The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'" % e) "The annotations could not be queried; probably the annotation files are missing. Here is the error: '%s'" % e)
@db_available('fargo')
def test_fargo():
database = bob.bio.base.load_resource(
'fargo', 'database', preferred_package='bob.bio.face')
try:
check_database(database)
except IOError as e:
raise SkipTest(
"The database could not queried; Here is the error: '%s'" % e)
...@@ -136,6 +136,8 @@ setup( ...@@ -136,6 +136,8 @@ setup(
'replay-img-spoof = bob.bio.face.config.database.replay:replay_spoof', 'replay-img-spoof = bob.bio.face.config.database.replay:replay_spoof',
'replaymobile-img-licit = bob.bio.face.config.database.replaymobile:replaymobile_licit', 'replaymobile-img-licit = bob.bio.face.config.database.replaymobile:replaymobile_licit',
'replaymobile-img-spoof = bob.bio.face.config.database.replaymobile:replaymobile_spoof', 'replaymobile-img-spoof = bob.bio.face.config.database.replaymobile:replaymobile_spoof',
'fargo = bob.bio.face.config.database.fargo:database',
], ],
'bob.bio.annotator': [ 'bob.bio.annotator': [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment