diff --git a/bob/pad/face/database/__init__.py b/bob/pad/face/database/__init__.py index a2f0469af1a62518e0817611b1d075c292b23973..12814bda6532ef69b43c9f4ac5425c6001f2d8ba 100644 --- a/bob/pad/face/database/__init__.py +++ b/bob/pad/face/database/__init__.py @@ -1,3 +1,4 @@ +from .database import VideoPadFile from .replay import ReplayPadDatabase from .replay_mobile import ReplayMobilePadDatabase from .msu_mfsd import MsuMfsdPadDatabase @@ -8,8 +9,8 @@ from .mifs import MIFSPadDatabase # gets sphinx autodoc done right - don't remove it def __appropriate__(*args): """Says object was actually declared here, and not in the import module. - Fixing sphinx warnings of not being able to find classes, when path is shortened. - Parameters: + Fixing sphinx warnings of not being able to find classes, when path is + shortened. Parameters: *args: An iterable of objects to modify @@ -22,6 +23,7 @@ def __appropriate__(*args): __appropriate__( + VideoPadFile, ReplayPadDatabase, ReplayMobilePadDatabase, MsuMfsdPadDatabase, diff --git a/bob/pad/face/database/aggregated_db.py b/bob/pad/face/database/aggregated_db.py index c8072e246b76f888f5f632124729ac26a3b7b71b..75e91b3291f7b83d0074b0bfedecbf5954301659 100644 --- a/bob/pad/face/database/aggregated_db.py +++ b/bob/pad/face/database/aggregated_db.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #============================================================================== -from bob.pad.base.database import PadFile # Used in ReplayPadFile class +from bob.pad.face.database import VideoPadFile # Used in ReplayPadFile class from bob.pad.base.database import PadDatabase @@ -21,7 +21,7 @@ import numpy as np #============================================================================== -class AggregatedDbPadFile(PadFile): +class AggregatedDbPadFile(VideoPadFile): """ A high level implementation of the File class for the Aggregated Database uniting 4 databases: REPLAY-ATTACK, REPLAY-MOBILE, MSU MFSD and Mobio. @@ -190,7 +190,7 @@ class AggregatedDbPadFile(PadFile): #========================================================================== def load(self, directory=None, extension='.mov'): """ - Overridden version of the load method defined in the ``PadFile``. + Overridden version of the load method defined in the ``VideoPadFile``. **Parameters:** diff --git a/bob/pad/face/database/database.py b/bob/pad/face/database/database.py new file mode 100644 index 0000000000000000000000000000000000000000..5d029071f585acdb20d7169e63ceda7f928ad946 --- /dev/null +++ b/bob/pad/face/database/database.py @@ -0,0 +1,23 @@ +from bob.pad.base.database import PadFile +from bob.bio.video.database import VideoBioFile + + +class VideoPadFile(VideoBioFile, PadFile): + """A simple base class that defines basic properties of File object for the + use in PAD experiments + """ + + def __init__(self, attack_type, client_id, path, file_id=None): + VideoBioFile.__init__( + self, + client_id=client_id, + path=path, + file_id=file_id, + ) + PadFile.__init__( + self, + attack_type=attack_type, + client_id=client_id, + path=path, + file_id=file_id, + ) diff --git a/bob/pad/face/database/mifs.py b/bob/pad/face/database/mifs.py index f15ee12b8e855917585b33f55da3acd64a782d1d..d66cc4af01c0f568ac88102914c3e6e906a38eff 100644 --- a/bob/pad/face/database/mifs.py +++ b/bob/pad/face/database/mifs.py @@ -10,14 +10,14 @@ from bob.bio.video import FrameSelector, FrameContainer import bob.io.base import numpy as np -from bob.pad.base.database import PadFile # Used in ReplayPadFile class +from bob.pad.face.database import VideoPadFile # Used in ReplayPadFile class from bob.pad.base.database import FileListPadDatabase #============================================================================== -class MIFSPadFile(PadFile): +class MIFSPadFile(VideoPadFile): """ A high level implementation of the File class for the MIFS database. """ @@ -29,7 +29,7 @@ class MIFSPadFile(PadFile): #========================================================================== def load(self, directory=None, extension=None, frame_selector=FrameSelector(selection_style='all')): """ - Overridden version of the load method defined in the ``PadFile``. + Overridden version of the load method defined in the ``VideoPadFile``. **Parameters:** diff --git a/bob/pad/face/database/msu_mfsd.py b/bob/pad/face/database/msu_mfsd.py index 5432ced1c37f3fb25afdf887ea1b2845dab4bf19..6783d888873c33b3573f4fac6d2955216632d87e 100644 --- a/bob/pad/face/database/msu_mfsd.py +++ b/bob/pad/face/database/msu_mfsd.py @@ -5,7 +5,7 @@ # Used in ReplayMobilePadFile class from bob.bio.video import FrameSelector, FrameContainer -from bob.pad.base.database import PadFile # Used in MsuMfsdPadFile class +from bob.pad.face.database import VideoPadFile # Used in MsuMfsdPadFile class from bob.pad.base.database import PadDatabase @@ -15,7 +15,7 @@ import numpy as np #============================================================================== -class MsuMfsdPadFile(PadFile): +class MsuMfsdPadFile(VideoPadFile): """ A high level implementation of the File class for the MSU MFSD database. """ @@ -53,7 +53,7 @@ class MsuMfsdPadFile(PadFile): #========================================================================== def load(self, directory=None, extension=None, frame_selector=FrameSelector(selection_style='all')): """ - Overridden version of the load method defined in the ``PadFile``. + Overridden version of the load method defined in the ``VideoPadFile``. **Parameters:** diff --git a/bob/pad/face/database/replay.py b/bob/pad/face/database/replay.py index 203136c0a41e3f3e0cbe0ca13145bd0789fb82be..8a9ff58faa62266434d5053bf76460fbd9cd1b5f 100644 --- a/bob/pad/face/database/replay.py +++ b/bob/pad/face/database/replay.py @@ -6,14 +6,14 @@ # Used in ReplayMobilePadFile class from bob.bio.video import FrameSelector, FrameContainer -from bob.pad.base.database import PadFile # Used in ReplayPadFile class +from bob.pad.face.database import VideoPadFile # Used in ReplayPadFile class from bob.pad.base.database import PadDatabase #============================================================================== -class ReplayPadFile(PadFile): +class ReplayPadFile(VideoPadFile): """ A high level implementation of the File class for the REPLAY-ATTACK database. """ @@ -51,7 +51,7 @@ class ReplayPadFile(PadFile): #========================================================================== def load(self, directory=None, extension='.mov', frame_selector=FrameSelector(selection_style='all')): """ - Overridden version of the load method defined in the ``PadFile``. + Overridden version of the load method defined in the ``VideoPadFile``. **Parameters:** diff --git a/bob/pad/face/database/replay_mobile.py b/bob/pad/face/database/replay_mobile.py index 843dee928dbb091e9f339f78b428e6417adad433..75c23b7a51c9dff08e61c1d4a61da5a5dcc9ce98 100644 --- a/bob/pad/face/database/replay_mobile.py +++ b/bob/pad/face/database/replay_mobile.py @@ -5,13 +5,13 @@ # Used in ReplayMobilePadFile class from bob.bio.video import FrameSelector, FrameContainer -from bob.pad.base.database import PadFile # Used in ReplayMobilePadFile class +from bob.pad.face.database import VideoPadFile # Used in ReplayMobilePadFile class from bob.pad.base.database import PadDatabase #============================================================================== -class ReplayMobilePadFile(PadFile): +class ReplayMobilePadFile(VideoPadFile): """ A high level implementation of the File class for the Replay-Mobile database. """ @@ -49,7 +49,7 @@ class ReplayMobilePadFile(PadFile): #========================================================================== def load(self, directory=None, extension='.mov', frame_selector=FrameSelector(selection_style='all')): """ - Overridden version of the load method defined in the ``PadFile``. + Overridden version of the load method defined in the ``VideoPadFile``. **Parameters:** diff --git a/doc/api.rst b/doc/api.rst index 74a89cd7966719c5036ee9a6c69aa9c3fd0de4a9..d1dde96805b2dc695f9ba42f30a4d856d008d75a 100644 --- a/doc/api.rst +++ b/doc/api.rst @@ -12,6 +12,11 @@ This section lists all the functionality available in this library allowing to r Database Interfaces ------------------------------ +Base classes +============ + +.. autoclass:: bob.pad.face.database.VideoPadFile + REPLAY-ATTACK Database ========================