Python API¶
The VERA Database for finger verification
-
class
bob.db.verafinger.Client(id, gender, age)[source]¶ Bases:
sqlalchemy.ext.declarative.api.BaseUnique clients in the database, referred by a single integer
-
gender_choices= ('M', 'F')¶
-
id¶
-
gender¶
-
age¶
-
-
class
bob.db.verafinger.Database(original_directory=None, original_extension=None)[source]¶ Bases:
bob.db.base.SQLiteDatabaseThe dataset class opens and maintains a connection opened to the Database.
It provides many different ways to probe for the characteristics of the data and for the data itself inside the database.
-
finger_name_from_model_id(model_id)[source]¶ Returns the first unique finger name in the database given a
model_id
-
model_ids(protocol=None, groups=None)[source]¶ Returns a set of models for a given protocol/group
- Parameters
protocol (
str,list, optional) – One or more of the supported protocols. If not set, returns data from all protocolsgroups (
str,list, optional) – One or more of the supported groups. If not set, returns data from all groups. Notice this parameter should either not set or set todev. Otherwise, this method will return an empty list given we don’t have a test set, only a development set.
- Returns
A list of string corresponding model identifiers with the specified filtering criteria
- Return type
-
objects(protocol=None, groups=None, purposes=None, model_ids=None, genders=None, sides=None, sizes=None, sources=None, sessions=None)[source]¶ Returns objects filtered by criteria
- Parameters
protocol (
str,list, optional) – One or more of the supported protocols. If not set, returns data from all protocolsgroups (
str,list, optional) – One or more of the supported groups. If not set, returns data from all groupspurposes (
str,list, optional) – One or more of the supported purposes. If not set, returns data for all purposesmodel_ids (
str,list, optional) – If set, limit output using the provided model identifiersgenders (
str,list, optional) – If set, limit output using the provided gender identifierssides (
str,list, optional) – If set, limit output using the provided side identifiersizes (
str,list, optional) – If set, limit output using the provided size identifiersources (
str,list, optional) – If set, limit output using the provided source identifiersessions (
str,list, optional) – If set, limit output using the provided session identifiers
- Returns
A list of
Fileobjects corresponding to the filtering criteria.- Return type
-
-
class
bob.db.verafinger.File(size, source, finger, session)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base,bob.db.base.FileUnique files in the database, referred by a string
Files have the format
full/bf/001-M/001_L_1(i.e. <size>/<source>/<client>-<gender>/<client>_<side>_<session>)-
id¶
-
size_choices= ('full', 'cropped')¶
-
source_choices= ('bf', 'pa')¶
-
finger_id¶
-
session_choices= ('1', '2')¶
-
size¶
-
source¶
-
finger¶
-
session¶
-
model_id¶
-
property
path¶
-
load(directory=None, extension='.png')[source]¶ Loads the image for this file entry
- Parameters
directory (str) – The path to the root of the dataset installation. This is, normally, the path leading to file named
metadata.csvand directoriesfull,cropped,annotationsandprotocols, but can be anything else. This behavior makes this function re-usable in the context of preprocessing and feature extraction, where intermediate files may be produced by your processing pipeline and can be reloaded using the same API.extension (str) – The extension to use for loading the file in question. If not passed, the default
.pngis used.
- Returns
- A 2D array of unsigned integers corresponding to the input
image for this file in (y,x) notation (Bob-style).
- Return type
-
roi(directory)[source]¶ Loads region-of-interest annotations for a particular image
The returned points (see return value below) correspond to a polygon in the 2D space delimiting the finger image. It is up to you to generate a mask out of these annotations.
- Parameters
directory (str) – The path to the root of the dataset installation. This is, forcebly, the path leading to file named
metadata.csvand directoriesfull,cropped,annotationsandprotocols.- Returns
- A 2D array of 16-bit unsigned integers corresponding to
annotations for the given fingervein image. Points are loaded in (y,x) format so, the first column of the returned array correspond to the y-values while the second column to the x-values of each coordinate.
- Return type
-
-
class
bob.db.verafinger.Finger(client, side)[source]¶ Bases:
sqlalchemy.ext.declarative.api.BaseUnique fingers in the database, referred by a string
Fingers have the format
003_L(i.e. <client>_<finger>)-
id¶
-
client_id¶
-
side_choices= ('L', 'R')¶
-
client¶
-
side¶
-
property
unique_name¶ Unique name for this finger in the database
-
-
class
bob.db.verafinger.PADDatabase(original_directory=None, original_extension=None)[source]¶ Bases:
bob.db.base.SQLiteDatabaseThe dataset class opens and maintains a connection opened to the Database.
It provides many different ways to probe for the characteristics of the data and for the data itself inside the database.
-
objects(protocol=None, groups=None, purposes=None, genders=None, sides=None, sizes=None, sources=None, sessions=None)[source]¶ Returns objects filtered by criteria
- Parameters
protocol (
str,list, optional) – One or more of the supported protocols. If not set, returns data from all protocolsgroups (
str,list, optional) – One or more of the supported groups. If not set, returns data from all groupspurposes (
str,list, optional) – One or more of the supported purposes. If not set, returns data for all purposesgenders (
str,list, optional) – If set, limit output using the provided gender identifierssides (
str,list, optional) – If set, limit output using the provided side identifiersizes (
str,list, optional) – If set, limit output using the provided size identifiersources (
str,list, optional) – If set, limit output using the provided source identifiersessions (
str,list, optional) – If set, limit output using the provided session identifiers
- Returns
A list of
Fileobjects corresponding to the filtering criteria.- Return type
-
-
class
bob.db.verafinger.PADProtocol(name)[source]¶ Bases:
sqlalchemy.ext.declarative.api.BaseVERA presentation attack detection protocols
-
id¶
-
name¶
-
-
class
bob.db.verafinger.PADSubset(protocol, group, purpose)[source]¶ Bases:
sqlalchemy.ext.declarative.api.BaseVERA protocol subsets for presentation attack detection
-
id¶
-
protocol_id¶
-
group_choices= ('train', 'dev', 'eval')¶
-
purpose_choices= ('real', 'attack')¶
-
files¶
-
protocol¶
-
group¶
-
purpose¶
-