Documenting

parent 66a416bf
...@@ -31,12 +31,9 @@ class ExperimentAnalizer: ...@@ -31,12 +31,9 @@ class ExperimentAnalizer:
** Parameters ** ** Parameters **
data_shuffler: convergence_threshold:
graph:
session:
convergence_threshold:
convergence_reference: References to analize the convergence. Possible values are `eer`, `far10`, `far10`
convergence_reference:
""" """
...@@ -112,8 +109,10 @@ class ExperimentAnalizer: ...@@ -112,8 +109,10 @@ class ExperimentAnalizer:
- RANK 10 - RANK 10
**Parameters** **Parameters**
negative_scores:
positive_scores: negative_scores:
positive_scores:
""" """
summaries = [] summaries = []
......
...@@ -15,14 +15,30 @@ class Base(object): ...@@ -15,14 +15,30 @@ class Base(object):
The class provide base functionalities to shuffle the data to train a neural network The class provide base functionalities to shuffle the data to train a neural network
**Parameters** **Parameters**
data: Input data to be trainer data:
labels: Labels. These labels should be set from 0..1 Input data to be trainer
input_shape: The shape of the inputs
input_dtype: The type of the data, labels:
batch_size: Batch size Labels. These labels should be set from 0..1
seed: The seed of the random number generator
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation` input_shape:
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -21,14 +21,29 @@ class Disk(Base): ...@@ -21,14 +21,29 @@ class Disk(Base):
The data is loaded on the fly,. The data is loaded on the fly,.
**Parameters** **Parameters**
data: Input data to be trainer data:
labels: Labels. These labels should be set from 0..1 Input data to be trainer
input_shape: The shape of the inputs
input_dtype: The type of the data, labels:
batch_size: Batch size Labels. These labels should be set from 0..1
seed: The seed of the random number generator
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation` input_shape:
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
...@@ -88,8 +103,11 @@ class Disk(Base): ...@@ -88,8 +103,11 @@ class Disk(Base):
** Returns ** ** Returns **
data: Selected samples data:
labels: Correspondent labels Selected samples
labels:
Correspondent labels
""" """
# Shuffling samples # Shuffling samples
......
...@@ -15,14 +15,29 @@ class Memory(Base): ...@@ -15,14 +15,29 @@ class Memory(Base):
This datashuffler deal with memory databases that are stored in a :py:class`numpy.array` This datashuffler deal with memory databases that are stored in a :py:class`numpy.array`
**Parameters** **Parameters**
data: Input data to be trainer data:
labels: Labels. These labels should be set from 0..1 Input data to be trainer
input_shape: The shape of the inputs
input_dtype: The type of the data, labels:
batch_size: Batch size Labels. These labels should be set from 0..1
seed: The seed of the random number generator
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation` input_shape:
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
...@@ -53,8 +68,11 @@ class Memory(Base): ...@@ -53,8 +68,11 @@ class Memory(Base):
** Returns ** ** Returns **
data: Selected samples data:
labels: Correspondent labels Selected samples
labels:
Correspondent labels
""" """
# Shuffling samples # Shuffling samples
indexes = numpy.array(range(self.data.shape[0])) indexes = numpy.array(range(self.data.shape[0]))
......
...@@ -19,14 +19,31 @@ class SiameseDisk(Siamese, Disk): ...@@ -19,14 +19,31 @@ class SiameseDisk(Siamese, Disk):
The data is loaded on the fly,. The data is loaded on the fly,.
**Parameters** **Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1 data:
input_shape: The shape of the inputs Input data to be trainer
input_dtype: The type of the data,
batch_size: Batch size labels:
seed: The seed of the random number generator Labels. These labels should be set from 0..1
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` input_shape:
The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
input_shape, input_shape,
......
...@@ -17,14 +17,31 @@ class SiameseMemory(Siamese, Memory): ...@@ -17,14 +17,31 @@ class SiameseMemory(Siamese, Memory):
The data is loaded on the fly. The data is loaded on the fly.
**Parameters** **Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1 data:
input_shape: The shape of the inputs Input data to be trainer
input_dtype: The type of the data,
batch_size: Batch size labels:
seed: The seed of the random number generator Labels. These labels should be set from 0..1
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` input_shape:
The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -23,14 +23,31 @@ class TripletDisk(Triplet, Disk): ...@@ -23,14 +23,31 @@ class TripletDisk(Triplet, Disk):
The data is loaded on the fly. The data is loaded on the fly.
**Parameters** **Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1 data:
input_shape: The shape of the inputs Input data to be trainer
input_dtype: The type of the data,
batch_size: Batch size labels:
seed: The seed of the random number generator Labels. These labels should be set from 0..1
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` input_shape:
The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -17,14 +17,31 @@ class TripletMemory(Triplet, Memory): ...@@ -17,14 +17,31 @@ class TripletMemory(Triplet, Memory):
The data is loaded on the fly. The data is loaded on the fly.
**Parameters** **Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1 data:
input_shape: The shape of the inputs Input data to be trainer
input_dtype: The type of the data,
batch_size: Batch size labels:
seed: The seed of the random number generator Labels. These labels should be set from 0..1
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` input_shape:
The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -35,14 +35,30 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling): ...@@ -35,14 +35,30 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling):
argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2 argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2
**Parameters** **Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1 data:
input_shape: The shape of the inputs Input data to be trainer
input_dtype: The type of the data,
batch_size: Batch size labels:
seed: The seed of the random number generator Labels. These labels should be set from 0..1
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` input_shape:
The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -23,14 +23,30 @@ class TripletWithSelectionDisk(Triplet, Disk, OnLineSampling): ...@@ -23,14 +23,30 @@ class TripletWithSelectionDisk(Triplet, Disk, OnLineSampling):
The selection of the triplets are random. The selection of the triplets are random.
**Parameters** **Parameters**
data: Input data to be trainer data:
labels: Labels. These labels should be set from 0..1 Input data to be trainer
input_shape: The shape of the inputs
input_dtype: The type of the data, labels:
batch_size: Batch size Labels. These labels should be set from 0..1
seed: The seed of the random number generator
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation` input_shape:
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -32,14 +32,31 @@ class TripletWithSelectionMemory(Triplet, Memory, OnLineSampling): ...@@ -32,14 +32,31 @@ class TripletWithSelectionMemory(Triplet, Memory, OnLineSampling):
argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2 argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2
**Parameters** **Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1 data:
input_shape: The shape of the inputs Input data to be trainer
input_dtype: The type of the data,
batch_size: Batch size labels:
seed: The seed of the random number generator Labels. These labels should be set from 0..1
data_augmentation: The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer: The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset` input_shape:
The shape of the inputs
input_dtype:
The type of the data,
batch_size:
Batch size
seed:
The seed of the random number generator
data_augmentation:
The algorithm used for data augmentation. Look :py:class:`bob.learn.tensorflow.datashuffler.DataAugmentation`
normalizer:
The algorithm used for feature scaling. Look :py:class:`bob.learn.tensorflow.datashuffler.ScaleFactor`, :py:class:`bob.learn.tensorflow.datashuffler.Linear` and :py:class:`bob.learn.tensorflow.datashuffler.MeanOffset`
""" """
def __init__(self, data, labels, def __init__(self, data, labels,
......
...@@ -13,11 +13,22 @@ class AveragePooling(MaxPooling): ...@@ -13,11 +13,22 @@ class AveragePooling(MaxPooling):
Wraps the tensorflow average pooling Wraps the tensorflow average pooling
**Parameters** **Parameters**
name: The name of the layer
shape: Shape of the pooling kernel name: str
stride: Shape of the stride The name of the layer
batch_norm: Do batch norm?
activation: Tensor Flow activation shape:
Shape of the pooling kernel
stride:
Shape of the stride
batch_norm: bool
Do batch norm?
activation: bool
Tensor Flow activation
""" """
def __init__(self, name, shape=[1, 2, 2, 1], def __init__(self, name, shape=[1, 2, 2, 1],
......
...@@ -15,15 +15,34 @@ class Conv2D(Layer): ...@@ -15,15 +15,34 @@ class Conv2D(Layer):
2D Convolution 2D Convolution
**Parameters** **Parameters**
name: The name of the layer
activation: Tensor Flow activation name: str
kernel_size: Size of the convolutional kernel The name of the layer
filters: Number of filters
stride: Shape of the stride activation:
weights_initialization: Initialization type for the weights Tensor Flow activation
bias_initialization: Initialization type for the weights
batch_norm: Do batch norm? kernel_size: int
use_gpu: Store data in the GPU Size of the convolutional kernel
filters: int
Number of filters
stride:
Shape of the stride
weights_initialization: py:class:`bob.learn.tensorflow.initialization.Initialization`
Initialization type for the weights
bias_initialization: py:class:`bob.learn.tensorflow.initialization.Initialization`
Initialization type for the weights
batch_norm: bool
Do batch norm?
use_gpu: bool
Store data in the GPU
""" """
def __init__(self, name, activation=None, def __init__(self, name, activation=None,
......
...@@ -14,8 +14,12 @@ class Dropout(Layer): ...@@ -14,8 +14,12 @@ class Dropout(Layer):
Dropout Dropout
**Parameters** **Parameters**
name: The name of the layer name: str
keep_prob: With probability keep_prob, outputs the input element scaled up by 1 / keep_prob, otherwise outputs 0. The name of the layer
keep_prob: float
With probability keep_prob, outputs the input element scaled up by 1 / keep_prob, otherwise outputs 0.
""" """
def __init__(self, name, def __init__(self, name,
......
...@@ -16,14 +16,29 @@ class FullyConnected(Layer): ...@@ -16,14 +16,29 @@ class FullyConnected(Layer):
Fully Connected layer Fully Connected layer
**Parameters** **Parameters**
name: The name of the layer
output_dim: Size of the output name: str
activation: Tensor Flow activation The name of the layer
weights_initialization: Initialization type for the weights
bias_initialization: Initialization type for the weights output_dim: int
batch_norm: Do batch norm? Size of the output
use_gpu: Store data in the GPU
""" activation:
Tensor Flow activation
weights_initialization: py:class:`bob.learn.tensorflow.initialization.Initialization`
Initialization type for the weights
bias_initialization: py:class:`bob.learn.tensorflow.initialization.Initialization`
Initialization type for the weights
batch_norm: bool
Do batch norm?
use_gpu: bool
Store data in the GPU
"""
def __init__(self, name, def __init__(self, name,
output_dim, output_dim,
......
...@@ -14,12 +14,23 @@ class Layer(object): ...@@ -14,12 +14,23 @@ class Layer(object):
Layer base class Layer base class
**Parameters** **Parameters**
name: The name of the layer name: str
activation: Tensor Flow activation The name of the layer
weights_initialization: Initialization type for the weights
bias_initialization: Initialization type for the weights activation:
batch_norm: Do batch norm? Tensor Flow activation
use_gpu: Store data in the GPU
weights_initialization: py:class:`bob.learn.tensorflow.initialization.Initialization`
Initialization type for the weights
bias_initialization: py:class:`bob.learn.tensorflow.initialization.Initialization`
Initialization type for the biases
batch_norm: bool
Do batch norm?
use_gpu: bool
Store data in the GPU
""" """
......
...@@ -12,11 +12,22 @@ class MaxPooling(Layer): ...@@ -12,11 +12,22 @@ class MaxPooling(Layer):
Wraps the tensorflow max pooling Wraps the tensorflow max pooling
**Parameters** **Parameters**
name: The name of the layer
shape: Shape of the pooling kernel name: str
stride: Shape of the stride The name of the layer
batch_norm: Do batch norm?
activation: Tensor Flow activation shape:
Shape of the pooling kernel
stride:
Shape of the stride
batch_norm: bool
Do batch norm?
activation: bool
Tensor Flow activation
""" """
def __init__(self, name, shape=[1, 2, 2, 1], def __init__(self, name, shape=[1, 2, 2, 1],
......
...@@ -20,10 +20,17 @@ class ContrastiveLoss(BaseLoss): ...@@ -20,10 +20,17 @@ class ContrastiveLoss(BaseLoss):
L = 0.5 * (Y) * D^2 + 0.5 * (1-Y) * {max(0, margin - D)}^2 L = 0.5 * (Y) * D^2 + 0.5 * (1-Y) * {max(0, margin - D)}^2
**Parameters** **Parameters**
left_feature: First element of the pair left_feature: