@@ -11,30 +11,30 @@ from bob.learn.tensorflow.datashuffler.Normalizer import Linear
classBase(object):
"""
The class provide base functionalities to shuffle the data to train a neural network
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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,
input_shape,
input_dtype="float64",
scale=True,
batch_size=1,
seed=10,
data_augmentation=None,
normalizer=Linear()):
"""
The class provide base functionalities to shuffle the data before to train a neural network
**Parameters**
data:
labels:
perc_train:
scale:
train_batch_size:
validation_batch_size:
seed: Seed for the random number generator
"""
self.seed=seed
numpy.random.seed(seed)
self.scale=scale
self.normalizer=normalizer
self.input_dtype=input_dtype
...
...
@@ -65,6 +65,12 @@ class Base(object):
self.data_placeholder=data
self.label_placeholder=label
defget_batch(self):
"""
Shuffle dataset and get a random batch.
"""
raiseNotImplementedError("Method not implemented in this level. You should use one of the derived classes.")
defget_placeholders(self,name=""):
"""
Returns a place holder with the size of your batch
@@ -15,26 +15,29 @@ from bob.learn.tensorflow.datashuffler.Normalizer import Linear
classDisk(Base):
"""
This datashuffler deal with databases that are stored in the disk.
The data is loaded on the fly,.
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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,
input_shape,
input_dtype="float64",
scale=True,
batch_size=1,
seed=10,
data_augmentation=None,
normalizer=Linear()):
"""
This datashuffler deal with databases that are stored in the disk.
The data is loaded on the fly,.
**Parameters**
data:
labels:
input_shape: Shape of the input. `input_shape != data.shape`, the data will be reshaped
input_dtype="float64":
scale=True:
batch_size=1:
"""
ifisinstance(data,list):
data=numpy.array(data)
...
...
@@ -47,7 +50,6 @@ class Disk(Base):
labels=labels,
input_shape=input_shape,
input_dtype=input_dtype,
scale=scale,
batch_size=batch_size,
seed=seed,
data_augmentation=data_augmentation,
...
...
@@ -80,7 +82,15 @@ class Disk(Base):
returndata
defget_batch(self,noise=False):
defget_batch(self):
"""
Shuffle the Disk dataset, get a random batch and load it on the fly.
This datashuffler deal with memory databases that are stored in a :py:class`numpy.array`
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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,
input_shape,
input_dtype="float64",
scale=True,
batch_size=1,
seed=10,
data_augmentation=None,
normalizer=Linear()):
"""
This datashuffler deal with databases that are stored in a :py:class`numpy.array`
**Parameters**
data:
labels:
perc_train:
scale:
train_batch_size:
validation_batch_size:
"""
super(Memory,self).__init__(
data=data,
labels=labels,
input_shape=input_shape,
input_dtype=input_dtype,
scale=scale,
batch_size=batch_size,
seed=seed,
data_augmentation=data_augmentation,
...
...
@@ -47,7 +48,14 @@ class Memory(Base):
self.data=self.data.astype(input_dtype)
defget_batch(self):
"""
Shuffle the Memory dataset and get a random batch.
@@ -14,25 +14,27 @@ from bob.learn.tensorflow.datashuffler.Normalizer import Linear
classSiameseDisk(Siamese,Disk):
"""
This :py:class:`bob.learn.tensorflow.datashuffler.Siamese` datashuffler deal with databases that are stored in the disk.
The data is loaded on the fly,.
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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,
input_shape,
input_dtype="float64",
scale=True,
batch_size=1,
seed=10,
data_augmentation=None,
normalizer=Linear()):
"""
Shuffler that deal with file list
**Parameters**
data:
labels:
input_shape: Shape of the input. `input_shape != data.shape`, the data will be reshaped
input_dtype="float64":
scale=True:
batch_size=1:
"""
ifisinstance(data,list):
data=numpy.array(data)
...
...
@@ -45,7 +47,6 @@ class SiameseDisk(Siamese, Disk):
This :py:class:`bob.learn.tensorflow.datashuffler.Siamese` datashuffler deal with databases that are in Memory
The data is loaded on the fly.
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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`
This :py:class:`bob.learn.tensorflow.datashuffler.Triplet` datashuffler deal with databases that are stored in the disk.
The data is loaded on the fly.
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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,
input_shape,
input_dtype="float64",
scale=True,
batch_size=1,
seed=10,
data_augmentation=None,
normalizer=Linear()):
"""
Shuffler that deal with file list
**Parameters**
data:
labels:
input_shape: Shape of the input. `input_shape != data.shape`, the data will be reshaped
input_dtype="float64":
scale=True:
batch_size=1:
"""
ifisinstance(data,list):
data=numpy.array(data)
...
...
@@ -48,7 +52,6 @@ class TripletDisk(Triplet, Disk):
This :py:class:`bob.learn.tensorflow.datashuffler.Triplet` datashuffler deal with databases that are stored in memory
The data is loaded on the fly.
**Parameters**
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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`
total_identities: Number of identities inside of the batch
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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,
input_shape,
input_dtype="float64",
scale=True,
batch_size=1,
seed=10,
data_augmentation=None,
...
...
@@ -58,7 +59,6 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling):
This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` shufflers.
The selection of the triplets are random.
**Parameters**
data:
labels:
perc_train:
scale:
train_batch_size:
validation_batch_size:
data_augmentation:
total_identities: Number of identities inside of the batch
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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`
total_identities: Number of identities inside of the batch
data: Input data to be trainer
labels: Labels. These labels should be set from 0..1
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`