Python API¶
-
bob.db.swan.SWAN_FRAME_SHAPE= (3, 1280, 720)¶ Shape of the video frames in the swan database.
-
class
bob.db.swan.Database(original_directory=None, bio_file_class=<class 'bob.db.swan.SwanAudioBioFile'>, annotation_directory=None, annotation_extension='.json', annotation_type='json', name='swan', **kwargs)¶ Bases:
bob.bio.base_legacy.database.FileListBioDatabase,bob.db.swan.common.SwanVideoDatabaseWrapper class for the SWAN database for speaker recognition (http://www.idiap.ch/dataset/swan). This class defines a simple protocol for training, dev and and by splitting the audio files of the database in three main parts.
-
objects(groups=None, protocol=None, purposes=None, model_ids=None, classes=None, filter_samples=None, **kwargs)[source]¶ Returns a set of
bob.bio.base_legacy.database.BioFileobjects for the specific query by the user.- Parameters
protocol (str or
None) – The protocol to considerpurposes (str or [str] or
None) – The purposes required to be retrieved('enroll', 'probe')or a tuple with several of them. IfNoneis given (this is the default), it is considered the same as a tuple with all possible values. This field is ignored for the data from the'world', 'optional_world_1', 'optional_world_2'groups.model_ids (str or [str] or
None) – Only retrieves the files for the provided list of model ids (claimed client id). IfNoneis given (this is the default), no filter over the model_ids is performed.groups (str or [str] or
None) – One of the groups('dev', 'eval', 'world', 'optional_world_1', 'optional_world_2')or a tuple with several of them. IfNoneis given (this is the default), it is considered to be the existing subset of('world', 'dev', 'eval').classes (str or [str] or
None) –The classes (types of accesses) to be retrieved
('client', 'impostor')or a tuple with several of them. IfNoneis given (this is the default), it is considered the same as a tuple with all possible values.Note
Classes are not allowed to be specified when ‘probes_filename’ is used in the constructor.
- Returns
A list of
BioFileobjects considering all the filtering criteria.- Return type
[BioFile]
-
-
class
bob.db.swan.SwanAudioBioFile(new_rate=None, **kwargs)¶ Bases:
bob.db.swan.common.SwanAudioFile,bob.bio.spear_legacy.database.AudioBioFileSwanAudioBioFile are video files actually
-
class
bob.db.swan.SwanVideoBioFile(client_id, path, file_id, **kwargs)¶ Bases:
bob.db.swan.common.SwanVideoFileSwanVideoBioFile are video files actually
-
class
bob.db.swan.common.Client(site, id_in_site, gender, **kwargs)[source]¶ Bases:
objectA base class for SWAN clients
-
property
id¶
-
property
-
bob.db.swan.common.swan_file_metadata(path)[source]¶ Returns the metadata associated with a SWAN file recorded during the biometric recognition phase.
-
class
bob.db.swan.common.SwanFile(**kwargs)[source]¶ Bases:
objectA base class for SWAN bio files which can handle the metadata.
-
class
bob.db.swan.common.SwanVideoFile(client_id, path, file_id, **kwargs)[source]¶ Bases:
bob.bio.video_legacy.database.VideoBioFile,bob.db.swan.common.SwanFileA base class for SWAN video files
-
load(directory=None, extension=None, frame_selector=<bob.bio.video_legacy.utils.FrameSelector.FrameSelector object>)[source]¶ Loads the data at the specified location and using the given extension. Override it if you need to load differently.
- Parameters
- Returns
The loaded data (normally
numpy.ndarray).- Return type
-
property
frames¶ Yields the frames of the padfile one by one.
- Parameters
padfile (
SwanVideoFile) – The high-level pad file- Yields
numpy.array– A frame of the video. The size is (3, 1280, 720).
-
property
number_of_frames¶ Returns the number of frames in a video file.
- Parameters
padfile (
SwanVideoFile) – The high-level pad file- Returns
The number of frames.
- Return type
-
property
frame_shape¶ Returns the size of each frame in this database.
-
-
class
bob.db.swan.common.SwanAudioFile(new_rate=None, **kwargs)[source]¶ Bases:
bob.db.swan.common.SwanVideoFileA base class that extracts audio from SWAN video files
-
load(directory=None, extension=None)[source]¶ Loads the data at the specified location and using the given extension. Override it if you need to load differently.
- Parameters
- Returns
The loaded data (normally
numpy.ndarray).- Return type
-
-
class
bob.db.swan.common.SwanVideoDatabase(new_rate=None, **kwargs)[source]¶ Bases:
object-
property
frame_shape¶
-
property
-
class
bob.db.swan.query_pad.SwanAudioPadFile(new_rate=None, **kwargs)[source]¶ Bases:
bob.db.swan.common.SwanAudioFile,bob.pad.voice.database.PadVoiceFileSwanAudioPadFile are video files actually
-
class
bob.db.swan.query_pad.SwanVideoPadFile(client_id, path, file_id, **kwargs)[source]¶ Bases:
bob.db.swan.common.SwanVideoFile,bob.pad.face.database.VideoPadFileSwanVideoPadFile are video files actually
-
class
bob.db.swan.query_pad.Database(original_directory=None, pad_file_class=<class 'bob.db.swan.query_pad.SwanAudioPadFile'>, annotation_directory=None, annotation_extension='.json', annotation_type='json', name='swan', **kwargs)[source]¶ Bases:
bob.pad.base.database.FileListPadDatabase,bob.db.swan.common.SwanVideoDatabaseWrapper class for the SWAN database for PAD (http://www.idiap.ch/dataset/swan).
-
objects(groups=None, protocol=None, purposes=None, model_ids=None, classes=None, filter_samples=None, **kwargs)[source]¶ Returns a set of
PadFileobjects for the specific query by the user.Keyword Parameters:
- groupsstr or [str] or
None One of the groups (“dev”, “eval”, “train”) or a tuple with several of them. If ‘None’ is given (this is the default), it is considered the same as a tuple with all possible values.
- protocolstr or
None The protocol to consider
- purposesstr or [str] or
None The purposes required to be retrieved (“real”, “attack”) or a tuple with several of them. If ‘None’ is given (this is the default), it is considered the same as a tuple with all possible values.
- model_ids[various type]
This parameter is not supported in PAD databases yet
Returns: A list of
PadFileobjects considering all the filtering criteria.- groupsstr or [str] or
-