Commit 2d9a724d authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Use all frames. Improve docs

parent 65f0b81f
Pipeline #14277 passed with stages
in 12 minutes and 55 seconds
from bob.pad.base.database import PadFile from bob.pad.base.database import PadFile
from bob.bio.video.database import VideoBioFile import bob.bio.video
class VideoPadFile(VideoBioFile, PadFile): class VideoPadFile(PadFile):
"""A simple base class that defines basic properties of File object for the """A simple base class that defines basic properties of File object for the
use in PAD experiments use in face PAD experiments.
""" """
def __init__(self, attack_type, client_id, path, file_id=None): def __init__(self, attack_type, client_id, path, file_id=None):
VideoBioFile.__init__( super(VideoPadFile, self).__init__(
self,
client_id=client_id,
path=path,
file_id=file_id,
)
PadFile.__init__(
self,
attack_type=attack_type, attack_type=attack_type,
client_id=client_id, client_id=client_id,
path=path, path=path,
file_id=file_id, file_id=file_id,
) )
def load(self, directory=None, extension='.avi',
frame_selector=bob.bio.video.FrameSelector(selection_style='all')):
"""Loads the video file and returns in a :any:`bob.bio.video.FrameContainer`.
Parameters
----------
directory : :obj:`str`, optional
The directory to load the data from.
extension : :obj:`str`, optional
The extension of the file to load.
frame_selector : :any:`bob.bio.video.FrameSelector`, optional
Which frames to select.
Returns
-------
:any:`bob.bio.video.FrameContainer`
The loaded frames inside a frame container.
"""
return frame_selector(self.make_path(directory, extension))
...@@ -41,6 +41,9 @@ class MIFSPadFile(VideoPadFile): ...@@ -41,6 +41,9 @@ class MIFSPadFile(VideoPadFile):
Extension of the video files in the MIFS database. Extension of the video files in the MIFS database.
Default: None Default: None
``frame_selector`` : ``FrameSelector``
The frame selector to use.
**Returns:** **Returns:**
``video_data`` : FrameContainer ``video_data`` : FrameContainer
......
...@@ -66,6 +66,9 @@ class MsuMfsdPadFile(VideoPadFile): ...@@ -66,6 +66,9 @@ class MsuMfsdPadFile(VideoPadFile):
Note: ``extension`` value is not used in the code of this method. Note: ``extension`` value is not used in the code of this method.
Default: None Default: None
``frame_selector`` : ``FrameSelector``
The frame selector to use.
**Returns:** **Returns:**
``video_data`` : FrameContainer ``video_data`` : FrameContainer
......
...@@ -48,32 +48,9 @@ class ReplayPadFile(VideoPadFile): ...@@ -48,32 +48,9 @@ class ReplayPadFile(VideoPadFile):
attack_type=attack_type, attack_type=attack_type,
file_id=f.id) file_id=f.id)
#========================================================================== def make_path(self, directory=None, extension='.mov'):
def load(self, directory=None, extension='.mov', frame_selector=FrameSelector(selection_style='all')): # path to the video file
""" return self.f.make_path(directory=directory, extension=extension)
Overridden version of the load method defined in the ``VideoPadFile``.
**Parameters:**
``directory`` : :py:class:`str`
String containing the path to the Replay database.
``extension`` : :py:class:`str`
Extension of the video files in the Replay database.
**Returns:**
``video_data`` : FrameContainer
Video data stored in the FrameContainer, see ``bob.bio.video.utils.FrameContainer``
for further details.
"""
path = self.f.make_path(
directory=directory, extension=extension) # path to the video file
video_data = frame_selector(path) # video data
return video_data # video data
#============================================================================== #==============================================================================
......
...@@ -59,6 +59,9 @@ class ReplayMobilePadFile(VideoPadFile): ...@@ -59,6 +59,9 @@ class ReplayMobilePadFile(VideoPadFile):
``extension`` : :py:class:`str` ``extension`` : :py:class:`str`
Extension of the video files in the Replay-Mobile database. Extension of the video files in the Replay-Mobile database.
``frame_selector`` : ``FrameSelector``
The frame selector to use.
**Returns:** **Returns:**
``video_data`` : FrameContainer ``video_data`` : FrameContainer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment