22
pyVerif Biometric Verification Toolkit, version 0.1 API Documentation April 9, 2008 Contents Contents 1 1 Package pyVerif 3 1.1 Modules ................................................ 3 2 Module pyVerif.Executor 4 2.1 Class Executor ............................................ 4 2.1.1 Methods ............................................ 4 2.2 Class ExecutorErrors ......................................... 5 2.2.1 Class Variables ........................................ 5 3 Module pyVerif.Experiment 6 3.1 Class Experiment ........................................... 6 3.1.1 Methods ............................................ 6 4 Module pyVerif.Features 8 4.1 Class Features ............................................ 8 4.1.1 Methods ............................................ 8 4.2 Class FeaturesErrors ......................................... 9 4.2.1 Class Variables ........................................ 9 5 Module pyVerif.Model 11 5.1 Class Model .............................................. 11 5.1.1 Methods ............................................ 11 5.2 Class ModelErrors .......................................... 13 5.2.1 Class Variables ........................................ 14 6 Module pyVerif.Protocol 15 6.1 Class Protocol ............................................ 16 6.1.1 Methods ............................................ 16 6.1.2 Class Variables ........................................ 18 6.2 Class ProtocolErrors ......................................... 18 6.2.1 Class Variables ........................................ 18 1

pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Embed Size (px)

Citation preview

Page 1: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

pyVerif Biometric Verification Toolkit, version 0.1

API Documentation

April 9, 2008

Contents

Contents 1

1 Package pyVerif 3

1.1 Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Module pyVerif.Executor 4

2.1 Class Executor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.1.1 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2.2 Class ExecutorErrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2.1 Class Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

3 Module pyVerif.Experiment 6

3.1 Class Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63.1.1 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

4 Module pyVerif.Features 8

4.1 Class Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84.1.1 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4.2 Class FeaturesErrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94.2.1 Class Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

5 Module pyVerif.Model 11

5.1 Class Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115.1.1 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

5.2 Class ModelErrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135.2.1 Class Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

6 Module pyVerif.Protocol 15

6.1 Class Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166.1.1 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166.1.2 Class Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

6.2 Class ProtocolErrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186.2.1 Class Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

1

Page 2: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

CONTENTS CONTENTS

7 Module pyVerif.Score 20

7.1 Class Score . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207.1.1 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

7.2 Class ScoreErrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217.2.1 Class Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

Index 22

2

Page 3: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Package pyVerif

1 Package pyVerif

This is the pyVerif biometric verification toolkit package.

See http://pyverif.idiap.ch/ for more information.

1.1 Modules

• Executor: Helper to manage how the commands are runned.(Section 2, p. 4)

• Experiment: Perform the verification experiments.(Section 3, p. 6)

• Features: Compute features by go through a directory tree.(Section 4, p. 8)

• Model: Manage a Model object.(Section 5, p. 11)

• Protocol: Manage protocol files.(Section 6, p. 15)

• Score: Manipulation of scores files.(Section 7, p. 20)

3

Page 4: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Executor

2 Module pyVerif.Executor

Helper to manage how the commands are runned.

With the Executor class, you could run a system command, and have some control on it. It is based on therecipe http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52296

2.1 Class Executor

Management of running commands.

If you want to run some system commands, and have control on them, you could use this class. The stdoutcould be outputed to either the screen or a specified file (or both). The stderr is always outputed to thescreen. It could also be outputed to a file.

2.1.1 Methods

init (self )

enable log(self, on screen=True, filename=None)

Enable or disable the logs.

- on screen controls the logging of the messages on the screen. It

controls only the stdout. The stderr is always displayed on the

screen.

- if filename is specified, stdout and stderr are cloned in the given

file. If the given file exists, it is overwritted.

log(self, msg)

Log the given message.The message could be outputed to the screen and/or the output file, depending on what the user haschoose previously with enable log ().

log info(self )

Log info relative to the current computer.

run(self, cmd, args)

Runs the given command, with the given arguments.Raise an exception in case of problem.

4

Page 5: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Executor Class ExecutorErrors

timing(self )

Returns timing information.

Returns a tuple with two values:

- the time since the creation of the current object,

- the time since the begin of the last run.

Both times are in milliseconds.

2.2 Class ExecutorErrors

Execptions raised by the Executor class.

Possible exceptions are:

• ExecutorErrors: the father of all the Exeecutor exceptions.

• InvalidCommand: the given command is not a string.

• InvalidArguments: the given command is not a string.

• InvalidLogValue: incorrect type for the logging.

• InvalidLogFilename: incorrect filename for the logging.

• ELogFileAccess: logfile can’t be writted.

• RunError: runned command as returned a non zero status.

2.2.1 Class Variables

Name Description

5

Page 6: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Experiment

3 Module pyVerif.Experiment

Perform the verification experiments.

Your own experiment classes should derive from Experiment.

3.1 Class Experiment

The base class to derive for constructing new Experiment classes.

3.1.1 Methods

init (self, features dir, bin dir, norm file=None, tmp dir=’tmp’, out dir=’./’, features ext=’.mat’,log on screen=False, log file=None, executor=None)

The Experiment object constructor.Parameters:

• features dir: (string) directory containing the features data

• bin dir: (string) directory containing the Torch executable

• norm file: (string) file containing the world model file list (default None)

• tmp dir: (string) name of the temporary directory (default ”tmp”)

• out dir: (string) output directory to put models, scores, results (default ”./”)

• features ext: (string) features files extension (default ”.mat”)

• log on screen: (boolean) put the log message on stdout/stdin (default False)

• log file: (string) file to put the log messages (default None)

• executor: (pyVerif.Executor) instance: object to run external command (default None)

build clients scores(self, for dev)

Compute the clients scores for all the models.Specify for dev=True if you want to compute for dev set, and for dev=False if you want to compute fortest set.Parameters:

• for dev: (boolean) select if you want to work on the development set or on the test set

load protocols(self, base dir, variant)

Load both dev and test protocols.Load both protocols dev and test from the given directory and the wanted variant.Parameters:

• base dir: (string) directory containing the protocol files

• variant: (string) variant of the protocol, for example, fem, nist, P, ...

6

Page 7: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Experiment Class Experiment

log(self, txt)

Log the given text.

log options(self, options, text=None)

Log the given options.Parameters:

• options: the options to log, of type Values, as returned by OptionParser.parse args()

• text: optional text which will be printed before the options

merge score(self, out file, for dev)

Merge the computed into a result file.Merge the score for either dev or test, putting the result in out file.This method should be overwritted in the new classes, as it does nothing by default.Parameters:

• for dev: (boolean) select if you want to work on the development set or on the test set

set cmds(self, train cmd, train opts, test cmd, test opts)

Set the commands for training and testing the clients models.Parameters:

• train cmd: (string) command for trainning the models

• train opts: (string) command line options for trainning the models

• test cmd: (string) command for computing scores

• test opts: (string) command line options for computing scores

set dirs(self, models dir, scores dir)

Set directories where to put scores and models.

train clients models(self, for dev)

Train all the clients models.This method should be overwritted in the new classes, as it does nothing by default.Parameters:

• for dev: (boolean) select if you want to work on the development set or on the test set

7

Page 8: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Features

4 Module pyVerif.Features

Compute features by go through a directory tree.

4.1 Class Features

Convert data files into feature files.

The convertion is done on all the files with a specific extension found in the in source directory. The outputfils are putted in a directory structure which is the same as the source one.

4.1.1 Methods

init (self, executor=None)

The Features object constructor.Parameters:

• executor: a pyVerif.Executor can be specified. If not specified, a new one will be created.

compute(self, overwrite=False)

Compute the features for all file in the directory tree.Parameters:

• overwrite: set it to True if you want to overwrite existing files

enable log(self, on screen=True, logfile=None)

Enable/disable the logs on the screen and/or on file.

Parameters:

- on screen: enable the log on the screen/xterm

- logfile: put the log on the specified file

log(self, msg)

Log the given message.Parameters:

• msg: msg to log

log info(self )

Log general informations about the current system.

8

Page 9: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Features Class FeaturesErrors

log options(self, options, text=None)

Log the given options.Parameters:

• options: the options to log, of type Values, as returned by OptionParser.parse args()

• text: optional text which will be printed before the options

set cmd(self, cmd, options)

Set the commands and options to use for convert into features.Parameters:

• cmd: the command to run for computing the features

• options: the options passed to the commandIn the options parameter, the folowing replacement will be done:

• %TODIR: the output directory

• %FILES: the temporary input file

set dirs(self, from dir=’sph’, to dir=’torch’, from ext=’sph’, to ext=’mat’, bin dir=’bin’)

Set the used directories.Parameters:

• from dir: where the original files are, default to ’sph’

• to dir: where the resulting features files are stored, default to ’torch’

• from ext: name of the original file extension, default to ’sph’,

• to ext: name of the targeted file extension, default to ’mat’,

• bin dir: where the commands are, default to ’bin’

4.2 Class FeaturesErrors

Execptions raised by the Features class.

Possible exceptions are:

• FeaturesErrors: the father of all the Features exceptions.

• InvalidExecutor: the specified Executor is not valid.

• InvalidFromDir: the specified directory is not a string.

• InvalidToDir: the specified directory is not a string.

• InvalidFromExt: the specified directory is not a string.

• InvalidToExt: the specified directory is not a string.

• InvalidBinDir: the specified directory is not a string.

• InvalidCmd: the specified directory is not a string.

• InvalidOpts: the specified directory is not a string.

4.2.1 Class Variables

9

Page 10: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Features Class FeaturesErrors

Name Description

10

Page 11: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Model

5 Module pyVerif.Model

Manage a Model object.

All the tasks you could do on a model, like:

- train it,

- use it for computing scores,

- identify it.

5.1 Class Model

Management of the model.

5.1.1 Methods

init (self, executor=None)

The Model object constructor.Parameters:

• executor: a pyVerif.Executor can be specified. If not specified, a new one will be created.

del (self )

The Model object destructor.Do some cleanup when the instance object die.

build scores(self, samples, overwrite=False, files must exist=True)

Computes scores for the given samples.

enable log(self, on screen=True, logfile=None)

Enable/disable the logs on the screen and/or on file.

get cmds(self )

Returns the commands and options used for training and building scores.The returned value is a tuple with 4 values:

• train command

• train options

• build scores command

• build scores options

id(self )

Returns the model id.

11

Page 12: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Model Class Model

log(self, msg)

Log the given message.

log info(self )

Log general informations about the current system.

name(self )

Returns the model name.

run(self, cmd, args=’’)

Runs the given command with the given arguments.Returns the status of the execution. Note that the given command must be in the setted binary directory.

set build scores cmd(self, build scores cmd, build scores options)

Set the commands and options to use for building scores.In the options strings, you can place markers which are replaced when the build scores command is built.See set cmds for details on supported markers.

set cmds(self, train cmd, train options, build scores cmd, build scores options)

Set the commands and options to use for training and building scores.In the options strings, you can place markers which are replaced when the train and build scorescommands are be built:

• %FILES: filename of a file containing the input files (train options and build scores options),

• %FILES IMPOSTORS: filename of a file containing the files used as importors for building models(train options only),

• %TARGETS: filename of a file containing the target of each input file (train options only),

• %MODEL: filename of the model to train or build scores with (train options andbuild scores options),

• %SCORES: filename of the computed scores (build scores options only),

• %TMPDIR: replaced by the name of the temporary directory (train options andbuild scores options),

12

Page 13: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Model Class ModelErrors

set dirs(self, models dir=’models’, scores dir=’scores’, data dir=’data’, features ext=’’,bin dir=’bin’, tmp dir=’tmp’, create=False)

Set the used directories.The directories are:

• models dir: where the models are stored or loaded, default to ’models’

• scores dir: where the resulting scores are stored, default to ’scores’

• data dir: where the features files are, default to ’data’,

• features ext: the extension to use for the features files, default to ”,

• bin dir: where the commands are, default to ’bin’

• tmp dir: where we can put temporary files, default to ’tmp’You can ask for creating the necessary directories by specifing create=True.

set identity(self, id, name=None)

Set the identity of the current model.The parameter id identify this model and will be used for creating many filenames (like for example themodel file name). If the name is not specified, it will be equal to the id.The id can be either a string or a number. Any other type will returns an exceptionModelErrors.InvalidModelId.The name can be either a string or a number. Any other type will returns an exceptionModelErrors.InvalidModelId.

set train cmd(self, train cmd, train options)

Set the commands and options to use for training.In the options strings, you can place markers which are replaced when the train command is built. Seeset cmds for details on supported markers.

train(self, samples, impostors samples=None, targets=None, overwrite=False, files must exist=True)

Enroll the model, using the given samples.

5.2 Class ModelErrors

Execptions raised by the Model class.

Possible exceptions are:

• ModelErrors: the father of all the Model exceptions.

• InvalidModelId: model id should be a string, a integer or a float.

• InvalidModelName: model name should be a string, a integer or a float.

• InvalidTrainCmd: train command should be a string.

• InvalidTrainOpts: train options should be a string.

• InvalidBuildScoresCmd: build scores command should be a string.

• InvalidBuildScoresOpts: build scores options should be a string.

13

Page 14: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Model Class ModelErrors

• InvalidDirs: the father of all the dir exceptions in the Feature class.

• InvalidModelsDir: model dir should be a string.

• InvalidScoresDir: score dir should be a string.

• InvalidBinDir: bin dir should be a string.

• InvalidDataDir: data dir should be a string.

• InvalidFeaturesExt: features extension should be a string.

• InvalidTmpDir: temp dir should be a string.

• TrainExistingModel: the model already exists, and no overwrite was specified.

• TrainErrorSamples: the train sample don’t exists, and we don’t have ask for skiping non existing files.

• TrainErrorImpostorSamples: the impostor sample don’t exists, and we don’t have ask for skiping nonexisting files.

• TrainErrorTargets: targets must be a tuple or a list of strings, integers or floats.

• BuildScoresErrorSamples: the sample for building scores don’t exists, and we don’t have ask for skipingnon existing files.

• BuildScoresNoModel: the model to build the score with don’t exists.

• ComputeExistingScore: the sample for computing a score exists, and no overwrite was specified.

• InvalidExecutor: the specified Executor is not valid.

5.2.1 Class Variables

Name Description

14

Page 15: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Protocol

6 Module pyVerif.Protocol

Manage protocol files.

The directory is structured as follow:

<TOP>------+-----files real ids.lst

|+-----norm---+----<for norm 1.lst>

| || +----<for norm 2.lst>

| || +----<for norm X.lst>

|+-----<p1>----+----dev-----+----for models.lst

| | || | +----for models impostors.lst

| | || | +----for scores.lst

| || +----test----+----for models.lst

| || +----for models impostors.lst

| || +----for scores.lst

|+-----<p2>----+----dev-----+----for models.lst

| | || | +----for models impostors.lst

| | || | +----for scores.lst

| || +----test----+----for models.lst

| || +----for models impostors.lst

| || +----for scores.lst

|+-----<pT>----+----dev-----+----for models.lst

| || +----for models impostors.lst

| || +----for scores.lst

|+----test----+----for models.lst

|+----for models impostors.lst

|

15

Page 16: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Protocol Class Protocol

+----for scores.lst

where:

- <...> mean some user-specified name,

- <TOP> is the top of the protocol directory,

- files real ids.lst is the list of real client id associated to

each file,

- *.lst are lists of files/client associations,

- norm is the directory containing lists of files used for

normalization, like for example the world model,

- <p1>, <p2>, <pT> are some variant of the protocol,

(the variant is optional if you only have one variant),

- dev and test are the mode of use of the protocolk

- for models.lst are the lists of files we can use for training

models,

- for models impostors.lst are the lists of files we can use for

training models, but these are samples of impostors, (this file is

optional),

- for scores.lst are the lists of files we can use for computing

scores,

Each line of the files *.lst are like (with ids as key):

<filename1> [<filename2> ...] <id1>

6.1 Class Protocol

Manage the Protocols.

6.1.1 Methods

init (self, mode is dev=True)

Init the protocol.Parameters:

• mode is dev is used to specify if you are in dev or test mode.

check ids(self )

Make sanity checks on the ids.The tests done are:

• every id used for computing scores must be in the ids used for training models,

• every id used for training models must be in the ids used for computing scores,

• every id used for computing normalizations must not be in the real ids used for computingscores. (not the claimed id, but the real id).

16

Page 17: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Protocol Class Protocol

clients(self )

Get the full list of clients.Returns the full list of clients defined in the currently loaded protocol.

id of(self, filename)

Return the real id of the given filename.

impostors list(self, id)

Get the list of impostors files we can use for training the specified client.

load(self, path, variant=None, norm files={})

Load the wanted protocol from the given path.

variant may be used if your protocol directory has variants.

You can specify some normalizations with the dictionary

norm files.

Sample usage:

load (’where/is/the/protocol’, variant=’Mc’,

norm files={’world’: ’world list.lst’,

’t-norm’: ’t-norm list.lst’})

Note: norm files keys may be any kind of type you want. Just

use the same when getting the lists with norm list() method.

norm ids(self, name)

Get the list of ids used for the given normalization.

norm keys(self, name=None)

Get the list of keys for the specified norm.If name is None, return the full list of keys of each norm.

norm list(self, name, id=None)

Get the list of files we can use for the specified normalization and the specified id.name must be one of the key you passed to the norm files of the load() method. If id is None, returns thefull list of files used for the specified normalization.

17

Page 18: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Protocol Class ProtocolErrors

score list(self, id=None)

Get the list of files we can use for computing the scores of the specified client.If id is None, returns the full list of files used for computing scores.

train list(self, id=None)

Get the list of files we can use for training the specified client.If id is None, returns the full list of files used for training.

6.1.2 Class Variables

Name Description

has id of Value: < sre.SRE Pattern object at 0x81a0338>

(type=SRE Pattern)has something Value: < sre.SRE Pattern object at 0xb7dce240>

(type=SRE Pattern)

6.2 Class ProtocolErrors

Execptions raised by the Protocol class.

Possible exceptions are:

• ProtocolErrors: the father of all the Protocol exceptions.

• NoExistingDirectory: the specified directory don’t exists.

• NoExistingVariant: the specified variant don’t exists.

• NoExistingNormFile: the specified norm file don’t exists.

• NoExistingModelsFile: the specified model file don’t exists.

• NoExistingScoresFile: the specified score file don’t exists.

• NoExistingMappingFile: the specified mapping file don’t exists.

• ProtocolNotLoaded: you need to load the protocol before using it.

• InvalidClientId: the wanted client id don’t exists.

• InvalidClientScoreId: the specified client score id is not in the model ids.

• InvalidClientModelId: the specified client model id is not in the score client ids.

• InvalidClientNormAndScoreId: the specified id is used for both normalization and build score.

• InvalidNorm: the specified norm don’t exists.

• InvalidFilename: the specified file is not mapped to a existing id.

• NoImpostorsSamplesForThisId: the specified id has no impostors.

• NoIdOfDef: the given file don’t implement the id of() function.

• BadPythonCode: the given Python code is not correct.

6.2.1 Class Variables

18

Page 19: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Protocol Class ProtocolErrors

Name Description

19

Page 20: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Score

7 Module pyVerif.Score

Manipulation of scores files.

The aim of this module is to merge many scores files all together. The files to be merged must be formattedlike:

<filename1> <score mod X 1> <filename2> <score mod X 2> <filenameM> <score mod X M>

The merged file will be formatted like:

<real id1> <claim id1> <score mod X 1> [<score mod Y 1> ...] <real id2> <claim id1> <score mod X 2>

[<score mod Y 2> ...] <real idN> <claim idN> <score mod X N> [<score mod Y N> ...]

7.1 Class Score

Management of scores.

7.1.1 Methods

init (self, filename to real id)

Init the Score object.

add column(self, operation, columns idx )

Add a computed column to the merged scores.

The resulting column will contain the results of:

operation (column [columns idx [0]],

column [columns idx [1]],

...,

column [columns idx [N]])

Where column [columns idx [X]] are all value taked from the Xth

column of the current merged scores.

columns idx is a sequence of integers who are the columns you

want to use for the operation.

get size(self )

Returns a tuple with the current size of the merged scores.The returned value is a tuple (nb lines, nb scores) representing the size of the merged scores matrix.

load(self, filename)

Load the given filename, and merge it.

20

Page 21: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Module pyVerif.Score Class ScoreErrors

load all(self, path, files)

Load all the given files from the given path, and merge them.

load norm(self, filename)

Load the given filename as a normalization file.This mean every line in the file filename will be used for every entry in the merged result with the samereal id.

load norm all(self, path, files)

Load all the given normalization files from the given path, and merge them.

save(self, filename)

Save the current merged scores to the given filename.

7.2 Class ScoreErrors

Execptions raised by the Score class.

Possible exceptions are:

• ScoreErrors: the father of all the Score exceptions.

• InvalidFile: the specified filename is invalid, or the file don’t exists.

• FileFormatError: the format of the score file is invalid.

• InvalidColumn: the specified column don’t exists.

• IncorrectNbOfColumns: number of columns aren’t consistents

7.2.1 Class Variables

Name Description

21

Page 22: pyVerif Biometric Verification Toolkit, version 0cscp2.sogang.ac.kr/CSE5311/CSE5311/UserData/Pyverif-0.1-api.pdf · Module pyVerif.Executor 2 Module pyVerif.Executor Helper to manage

Index

pyVerif (package), 2pyVerif.Executor (module), 3–4

Executor (class), 3–4init (method), 3

enable log (method), 3log (method), 3log info (method), 3run (method), 3timing (method), 3

ExecutorErrors (class), 4pyVerif.Experiment (module), 5–6

Experiment (class), 5–6init (method), 5

build clients scores (method), 5load protocols (method), 5log (method), 5log options (method), 6merge score (method), 6set cmds (method), 6set dirs (method), 6train clients models (method), 6

pyVerif.Features (module), 7–9Features (class), 7–8

init (method), 7compute (method), 7enable log (method), 7log (method), 7log info (method), 7log options (method), 7set cmd (method), 8set dirs (method), 8

FeaturesErrors (class), 8–9pyVerif.Model (module), 10–13

Model (class), 10–12del (method), 10init (method), 10

build scores (method), 10enable log (method), 10get cmds (method), 10id (method), 10log (method), 10log info (method), 11name (method), 11run (method), 11set build scores cmd (method), 11set cmds (method), 11set dirs (method), 11

set identity (method), 12set train cmd (method), 12train (method), 12

ModelErrors (class), 12–13pyVerif.Protocol (module), 14–18

Protocol (class), 15–17init (method), 15

check ids (method), 15clients (method), 15id of (method), 16impostors list (method), 16load (method), 16norm ids (method), 16norm keys (method), 16norm list (method), 16score list (method), 16train list (method), 17

ProtocolErrors (class), 17–18pyVerif.Score (module), 19–20

Score (class), 19–20init (method), 19

add column (method), 19get size (method), 19load (method), 19load all (method), 19load norm (method), 20load norm all (method), 20save (method), 20

ScoreErrors (class), 20

22