diff --git a/bob/bio/face/config/database/replaymobile.py b/bob/bio/face/config/database/replaymobile.py new file mode 100644 index 0000000000000000000000000000000000000000..c8121dac036c6c4af24c973bfaee371363478659 --- /dev/null +++ b/bob/bio/face/config/database/replaymobile.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +from bob.bio.face.database import ReplayMobileBioDatabase + +replay_mobile_directory = "[YOUR_REPLAY_MOBILE_DIRECTORY]" + +replay_licit = ReplayMobileBioDatabase( + original_directory=replay_mobile_directory, + original_extension=".mov", + protocol='grandtest-licit', +) + +replay_spoof = ReplayMobileBioDatabase( + original_directory=replay_mobile_directory, + original_extension=".mov", + protocol='grandtest-spoof', +) diff --git a/bob/bio/face/database/__init__.py b/bob/bio/face/database/__init__.py index e6a26fe353122530a60f9909d47a78223299276e..494d31c95b076adc43678bc39f22acd6be52d3c6 100644 --- a/bob/bio/face/database/__init__.py +++ b/bob/bio/face/database/__init__.py @@ -16,6 +16,7 @@ from .xm2vts import XM2VTSBioDatabase from .frgc import FRGCBioDatabase from .cuhk_cufs import CUHK_CUFSBioDatabase from .scface import SCFaceBioDatabase +from .replaymobile import ReplayMobileBioDatabase # gets sphinx autodoc done right - don't remove it def __appropriate__(*args): diff --git a/bob/bio/face/database/replaymobile.py b/bob/bio/face/database/replaymobile.py new file mode 100644 index 0000000000000000000000000000000000000000..0d9d3849f93704ffb419b808f5255dbff6eaf370 --- /dev/null +++ b/bob/bio/face/database/replaymobile.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# vim: set fileencoding=utf-8 : + +""" The Replay-Mobile Database for face spoofing implementation of +bob.bio.base.database.BioDatabase interface.""" + +from .database import FaceBioFile +from bob.bio.base.database import BioDatabase + + +class ReplayMobileBioFile(FaceBioFile): + """FaceBioFile implementation of the Replay Mobile Database""" + + def __init__(self, f): + super(FaceBioFile, self).__init__(client_id=f.client_id, path=f.path, file_id=f.id) + self._f = f + + def load(self, directory=None, extension=None): + if extension in (None, '.mov'): + return self._f.load(directory, extension) + else: + return super(ReplayMobileBioFile, self).load(directory, extension) + + +class ReplayMobileBioDatabase(BioDatabase): + """ + Implements verification API for querying Replay Mobile database. + Please refer to low-level db self._db for more documentation + """ + __doc__ = __doc__ + + def __init__(self, max_number_of_frames=None, **kwargs): + # call base class constructors to open a session to the database + super(ReplayMobileBioDatabase, self).__init__(name='replay', **kwargs) + + from bob.db.replaymobile.verificationprotocol import Database as LowLevelDatabase + self._db = LowLevelDatabase(max_number_of_frames) + + def protocol_names(self): + return self._db.protocols() + + def groups(self): + return self._db.groups() + + def annotations(self, file): + return self._db.annotations(file) + + def model_ids_with_protocol(self, groups=None, protocol=None, **kwargs): + return self._db.model_ids_with_protocol(groups, protocol, **kwargs) + + def objects(self, groups=None, protocol=None, purposes=None, model_ids=None, **kwargs): + return self._db.objects(groups, protocol, purposes, model_ids, **kwargs) diff --git a/bob/bio/face/test/test_databases.py b/bob/bio/face/test/test_databases.py index f1928301a001fd755a4e2e044b957db9f1212c02..484611b1ea6a919f45c2d72673f34d9f77066ddb 100644 --- a/bob/bio/face/test/test_databases.py +++ b/bob/bio/face/test/test_databases.py @@ -214,3 +214,14 @@ def test_replay(): except IOError as e: raise SkipTest( "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + + +@db_available('replaymobile') +def test_replaymobile(): + database = bob.bio.base.load_resource('replaymobile', 'database', preferred_package='bob.bio.face') + try: + check_database(database, groups=('dev', 'eval')) + _check_annotations(database) + except IOError as e: + raise SkipTest( + "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) diff --git a/develop.cfg b/develop.cfg index d70bdd47b3155f232912b0f1dcbced4269391624..b786533e7b8207d56505c418979e00adaa181ac0 100644 --- a/develop.cfg +++ b/develop.cfg @@ -4,7 +4,26 @@ [buildout] parts = scripts -eggs = bob.bio.face +eggs = bob.extension + bob.blitz + bob.core + bob.io.base + bob.io.image + bob.learn.activation + bob.math + bob.learn.linear + bob.sp + bob.ip.base + bob.ip.color + bob.ip.draw + bob.ip.gabor + bob.learn.em + bob.measure + bob.db.base + bob.learn.boosting + bob.ip.facedetect + bob.ip.flandmark + bob.db.atnt bob.db.arface bob.db.banca bob.db.caspeal @@ -16,8 +35,11 @@ eggs = bob.bio.face bob.db.scface bob.db.xm2vts bob.db.replay + bob.db.replaymobile gridtk - + bob.bio.base + bob.bio.face + extensions = bob.buildout mr.developer auto-checkout = * @@ -37,11 +59,10 @@ develop = src/bob.extension src/bob.learn.em src/bob.measure src/bob.db.base - src/bob.db.atnt - src/bob.bio.base src/bob.learn.boosting src/bob.ip.facedetect src/bob.ip.flandmark + src/bob.db.atnt src/bob.db.arface src/bob.db.banca src/bob.db.caspeal @@ -53,6 +74,10 @@ develop = src/bob.extension src/bob.db.scface src/bob.db.xm2vts src/bob.db.replay + src/bob.db.replaymobile + src/gridtk + src/bob.bio.base + src/bob.bio.face . ; options for bob.buildout @@ -68,31 +93,34 @@ bob.io.base = git https://gitlab.idiap.ch/bob/bob.io.base bob.io.image = git https://gitlab.idiap.ch/bob/bob.io.image bob.learn.activation = git https://gitlab.idiap.ch/bob/bob.learn.activation bob.math = git https://gitlab.idiap.ch/bob/bob.math +bob.learn.linear = git https://gitlab.idiap.ch/bob/bob.learn.linear bob.sp = git https://gitlab.idiap.ch/bob/bob.sp bob.ip.base = git https://gitlab.idiap.ch/bob/bob.ip.base bob.ip.color = git https://gitlab.idiap.ch/bob/bob.ip.color bob.ip.draw = git https://gitlab.idiap.ch/bob/bob.ip.draw bob.ip.gabor = git https://gitlab.idiap.ch/bob/bob.ip.gabor -bob.learn.linear = git https://gitlab.idiap.ch/bob/bob.learn.linear bob.learn.em = git https://gitlab.idiap.ch/bob/bob.learn.em bob.measure = git https://gitlab.idiap.ch/bob/bob.measure bob.db.base = git https://gitlab.idiap.ch/bob/bob.db.base -bob.db.atnt = git https://gitlab.idiap.ch/bob/bob.db.atnt -bob.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base bob.learn.boosting = git https://gitlab.idiap.ch/bob/bob.learn.boosting bob.ip.facedetect = git https://gitlab.idiap.ch/bob/bob.ip.facedetect bob.ip.flandmark = git https://gitlab.idiap.ch/bob/bob.ip.flandmark +bob.db.atnt = git https://gitlab.idiap.ch/bob/bob.db.atnt bob.db.arface = git https://gitlab.idiap.ch/bob/bob.db.arface bob.db.banca = git https://gitlab.idiap.ch/bob/bob.db.banca bob.db.caspeal = git https://gitlab.idiap.ch/bob/bob.db.caspeal -bob.db.frgc = git https://gitlab.idiap.ch/bob/bob.db.frgc +bob.db.frgc = git https://gitlab.idiap.ch/bob/bob.db.frgc bob.db.gbu = git https://gitlab.idiap.ch/bob/bob.db.gbu -bob.db.lfw = git https://gitlab.idiap.ch/bob/bob.db.lfw +bob.db.lfw = git https://gitlab.idiap.ch/bob/bob.db.lfw bob.db.mobio = git https://gitlab.idiap.ch/bob/bob.db.mobio bob.db.multipie = git https://gitlab.idiap.ch/bob/bob.db.multipie bob.db.scface = git https://gitlab.idiap.ch/bob/bob.db.scface bob.db.xm2vts = git https://gitlab.idiap.ch/bob/bob.db.xm2vts bob.db.replay = git https://gitlab.idiap.ch/bob/bob.db.replay +bob.db.replaymobile = git https://gitlab.idiap.ch/bob/bob.db.replaymobile +gridtk = git https://gitlab.idiap.ch/bob/gridtk +bob.bio.base = git https://gitlab.idiap.ch/bob/bob.bio.base +bob.bio.face = git https://gitlab.idiap.ch/bob/bob.bio.face [scripts] recipe = bob.buildout:scripts diff --git a/setup.py b/setup.py index ea630ad3f0a77f6c5b227a1c2829d389fab571c3..eb06f3bd38a87a20c332b60d2d8848b2862f8085 100644 --- a/setup.py +++ b/setup.py @@ -124,6 +124,8 @@ setup( 'xm2vts = bob.bio.face.config.database.xm2vts:database', 'replay-img-licit = bob.bio.face.config.database.replay:replay_licit', 'replay-img-spoof = bob.bio.face.config.database.replay:replay_spoof', + 'replaymobile-img-licit = bob.bio.face.config.database.replaymobile:replaymobile_licit', + 'replaymobile-img-spoof = bob.bio.face.config.database.replaymobile:replaymobile_spoof', ], 'bob.bio.preprocessor': [