Package pyVerif :: Module Model :: Class Model
[show private | hide private]
[frames | no frames]

Class Model


Management of the model.
Method Summary
  __init__(self, executor)
The Model object constructor.
  __del__(self)
The Model object destructor.
  build_scores(self, samples, overwrite, files_must_exist)
Computes scores for the given samples.
  enable_log(self, on_screen, logfile)
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.
  id(self)
Returns the model id.
  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.
  set_build_scores_cmd(self, build_scores_cmd, build_scores_options)
Set the commands and options to use for building scores.
  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.
  set_dirs(self, models_dir, scores_dir, data_dir, features_ext, bin_dir, tmp_dir, create)
Set the used directories.
  set_identity(self, id, name)
Set the identity of the current model.
  set_train_cmd(self, train_cmd, train_options)
Set the commands and options to use for training.
  train(self, samples, impostors_samples, targets, overwrite, files_must_exist)
Enroll the model, using the given samples.

Method Details

__init__(self, executor=None)
(Constructor)

The Model object constructor.

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

__del__(self)
(Destructor)

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.

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 scores commands 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 and build_scores_options),
  • %SCORES: filename of the computed scores (build_scores_options only),
  • %TMPDIR: replaced by the name of the temporary directory (train_options and build_scores_options),

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 the model 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 exception ModelErrors.InvalidModelId.

The name can be either a string or a number. Any other type will returns an exception ModelErrors.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. See set_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.

Generated by Epydoc 2.1 on Fri Oct 6 12:25:10 2006 http://epydoc.sf.net