Python API for bob.ip.tensorflow_extractor

Classes

bob.ip.tensorflow_extractor.Extractor(...[, ...]) Feature extractor using tensorflow
bob.ip.tensorflow_extractor.FaceNet([...]) Wrapper for the free FaceNet variant:

Detailed API

bob.ip.tensorflow_extractor.scratch_network(inputs, end_point='fc1', reuse=False)[source]
bob.ip.tensorflow_extractor.download_file(url, out_file)[source]

Downloads a file from a given url

Parameters:
  • url (str) – The url to download form.
  • out_file (str) – Where to save the file.
bob.ip.tensorflow_extractor.get_config()[source]

Returns a string containing the configuration information.

class bob.ip.tensorflow_extractor.Extractor(checkpoint_filename, input_tensor, graph, debug=False)

Bases: object

Feature extractor using tensorflow

__call__(data)[source]

Forward the data with the loaded neural network

Parameters:image (numpy.array) – Input Data
Returns:The features.
Return type:numpy.array
__init__(checkpoint_filename, input_tensor, graph, debug=False)[source]

Loads the tensorflow model

Parameters:
  • checkpoint_filename (str) – Path of your checkpoint. If the .meta file is providede the last checkpoint will be loaded.
  • model – input_tensor: tf.Tensor used as a data entrypoint. It can be a tf.placeholder, the result of tf.train.string_input_producer, etc
  • graph – A tf.Tensor containing the operations to be executed
class bob.ip.tensorflow_extractor.FaceNet(model_path=None, image_size=160, **kwargs)

Bases: object

Wrapper for the free FaceNet variant: https://github.com/davidsandberg/facenet

To use this class as a bob.bio.base extractor:

from bob.bio.base.extractor import Extractor
class FaceNetExtractor(FaceNet, Extractor):
    pass
extractor = FaceNetExtractor()
static download_model()[source]

Download and extract the FaceNet files in bob/ip/tensorflow_extractor

static get_modelpath()[source]
load_model()[source]