Feature Extractors

Features for face recognition

class facereclib.features.DCTBlocks(block_size=12, block_overlap=11, number_of_dct_coefficients=45, normalize_blocks=True, normalize_dcts=True, auto_reduce_coefficients=False)[source]

Bases: facereclib.features.Extractor.Extractor

Extracts DCT blocks

load(extractor_file)

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read_feature(feature_file)

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(data_list, extractor_file)

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).
class facereclib.features.Eigenface(subspace_dimension)[source]

Bases: facereclib.features.Extractor.Extractor

Extracts grid graphs from the images

load(extractor_file)[source]
read_feature(feature_file)

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(image_list, extractor_file)[source]

Trains the eigenface extractor using the given list of training images

class facereclib.features.Extractor(requires_training=False, split_training_data_by_client=False, **kwargs)[source]

This is the base class for all feature extractors. It defines the minimum requirements that a derived feature extractor class need to implement.

load(extractor_file)[source]

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read_feature(feature_file)[source]

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)[source]

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(data_list, extractor_file)[source]

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).
class facereclib.features.GridGraph(gabor_directions=8, gabor_scales=5, gabor_sigma=6.283185307179586, gabor_maximum_frequency=1.5707963267948966, gabor_frequency_step=0.7071067811865476, gabor_power_of_k=0, gabor_dc_free=True, normalize_gabor_jets=True, eyes=None, nodes_between_eyes=4, nodes_along_eyes=2, nodes_above_eyes=3, nodes_below_eyes=7, node_distance=None, image_resolution=None, first_node=None)[source]

Bases: facereclib.features.Extractor.Extractor

Extracts grid graphs from the images

load(extractor_file)

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read_feature(feature_file)[source]
save_feature(feature, feature_file)[source]
train(data_list, extractor_file)

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).
class facereclib.features.LGBPHS(block_size, block_overlap=0, gabor_directions=8, gabor_scales=5, gabor_sigma=6.283185307179586, gabor_maximum_frequency=1.5707963267948966, gabor_frequency_step=0.7071067811865476, gabor_power_of_k=0, gabor_dc_free=True, use_gabor_phases=False, lbp_radius=2, lbp_neighbor_count=8, lbp_uniform=True, lbp_circular=True, lbp_rotation_invariant=False, lbp_compare_to_average=False, lbp_add_average=False, sparse_histogram=False, split_histogram=None)[source]

Bases: facereclib.features.Extractor.Extractor

Extractor for local Gabor binary pattern histogram sequences

Initializes the local Gabor binary pattern histogram sequence tool chain with the given file selector object

load(extractor_file)

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read_feature(feature_file)

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(data_list, extractor_file)

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).
class facereclib.features.Linearize[source]

Bases: facereclib.features.Extractor.Extractor

Extracts pixel-based features by simply concatenating all pixels of the image into one long vector

Nothing to be done here.

load(extractor_file)

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read_feature(feature_file)

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(data_list, extractor_file)

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).
class facereclib.features.SIFTBobKeypoints(sigmas, height, width, n_octaves, n_scales, octave_min, sigma_n, sigma0, contrast_thres, edge_thres, norm_thres, kernel_radius_factor, set_sigma0_no_init_smoothing)[source]

Bases: facereclib.features.Extractor.Extractor

Extracts Sift descriptors according to the given keypoints

load(extractor_file)

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read(filename)[source]

Read image and annotations stored in an HDF5 file

read_feature(feature_file)

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(data_list, extractor_file)

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).
class facereclib.features.SIFTKeypoints(sigmas, height, width, n_intervals, n_octaves, octave_min, edge_thres, peak_thres, magnif, estimate_orientation=False)[source]

Bases: facereclib.features.Extractor.Extractor

Extracts Sift descriptors according to the given keypoints

load(extractor_file)

Loads the parameters required for feature extraction from the extractor file. This function usually is only useful in combination with the ‘train’ function (see below). In this base class implementation, it does nothing.

read_feature(feature_file)

Reads the extracted feature from file. In this base class implementation, it uses bob.io.base.load to do that. If you have different format, please overwrite this function.

save_feature(feature, feature_file)

Saves the given extracted feature to a file with the given name. In this base class implementation:

  • If the given feature has a ‘save’ attribute, it calls feature.save(bob.io.base.HDF5File(feature_file), ‘w’). In this case, the given feature_file might be either a file name or a bob.io.base.HDF5File.
  • Otherwise, it uses bob.io.base.save to do that.

If you have a different format, please overwrite this function.

train(data_list, extractor_file)

This function can be overwritten to train the feature extractor. If you do this, please also register the function by calling this base class constructor and enabling the training by ‘requires_training = True’.

The training function gets two parameters:

  • data_list: A list of data that can be used for training the extractor.
  • extractor_file: The file to write. This file should be readable with the ‘load’ function (see above).