[sphinx] Fixing WArnings

parent 16c9feff
...@@ -2,6 +2,20 @@ ...@@ -2,6 +2,20 @@
.. Tiago de Freitas Pereira <tiago.pereira@idiap.ch> .. Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
.. Thu 30 Jan 08:46:53 2014 CET .. Thu 30 Jan 08:46:53 2014 CET
.. image:: http://img.shields.io/badge/docs-stable-yellow.png
:target: http://pythonhosted.org/bob.learn.tensorflow/index.html
.. image:: http://img.shields.io/badge/docs-latest-orange.png
:target: https://www.idiap.ch/software/bob/docs/latest/bob/bob.learn.tensorflow/master/index.html
.. image:: https://gitlab.idiap.ch/bob/bob.learn.tensorflow/badges/master/build.svg
:target: https://gitlab.idiap.ch/bob/bob.learn.tensorflow/commits/master
.. image:: https://img.shields.io/badge/gitlab-project-0000c0.svg
:target: https://gitlab.idiap.ch/bob/bob.learn.tensorflow
.. image:: http://img.shields.io/pypi/v/bob.learn.tensorflow.png
:target: https://pypi.python.org/pypi/bob.learn.tensorflow
.. image:: http://img.shields.io/pypi/dm/bob.learn.tensorflow.png
:target: https://pypi.python.org/pypi/bob.learn.tensorflow
=========================== ===========================
Bob support for tensorflow Bob support for tensorflow
=========================== ===========================
......
# see https://docs.python.org/3/library/pkgutil.html
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# gets sphinx autodoc done right - don't remove it # gets sphinx autodoc done right - don't remove it
__all__ = [_ for _ in dir() if not _.startswith('_')] __all__ = [_ for _ in dir() if not _.startswith('_')]
from .ExperimentAnalizer import ExperimentAnalizer from .ExperimentAnalizer import ExperimentAnalizer
from .SoftmaxAnalizer import SoftmaxAnalizer from .SoftmaxAnalizer import SoftmaxAnalizer
......
...@@ -15,6 +15,7 @@ class Base(object): ...@@ -15,6 +15,7 @@ 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: data:
Input data to be trainer Input data to be trainer
......
...@@ -21,6 +21,7 @@ class Disk(Base): ...@@ -21,6 +21,7 @@ class Disk(Base):
The data is loaded on the fly,. The data is loaded on the fly,.
**Parameters** **Parameters**
data: data:
Input data to be trainer Input data to be trainer
......
...@@ -15,6 +15,7 @@ class Memory(Base): ...@@ -15,6 +15,7 @@ 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: data:
Input data to be trainer Input data to be trainer
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
# @author: Tiago de Freitas Pereira <tiago.pereira@idiap.ch> # @author: Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
# @date: Wed 11 May 2016 09:39:36 CEST # @date: Wed 11 May 2016 09:39:36 CEST
import numpy
import tensorflow as tf import tensorflow as tf
from .Base import Base
from bob.learn.tensorflow.network import SequenceNetwork from bob.learn.tensorflow.network import SequenceNetwork
class OnLineSampling(object): class OnlineSampling(Base):
""" """
This data shuffler uses the current state of the network to select the samples. This data shuffler uses the current state of the network to select the samples.
This class is not meant to be used, but extended. This class is not meant to be used, but extended.
......
...@@ -7,7 +7,7 @@ import numpy ...@@ -7,7 +7,7 @@ import numpy
import tensorflow as tf import tensorflow as tf
from .Memory import Memory from .Memory import Memory
from Triplet import Triplet from .Triplet import Triplet
from bob.learn.tensorflow.datashuffler.Normalizer import Linear from bob.learn.tensorflow.datashuffler.Normalizer import Linear
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
import numpy import numpy
import tensorflow as tf import tensorflow as tf
from Disk import Disk from .Disk import Disk
from Triplet import Triplet from .Triplet import Triplet
from OnlineSampling import OnLineSampling from .OnlineSampling import OnlineSampling
from scipy.spatial.distance import euclidean, cdist from scipy.spatial.distance import euclidean, cdist
import logging import logging
...@@ -16,7 +16,7 @@ logger = logging.getLogger("bob.learn.tensorflow") ...@@ -16,7 +16,7 @@ logger = logging.getLogger("bob.learn.tensorflow")
from bob.learn.tensorflow.datashuffler.Normalizer import Linear from bob.learn.tensorflow.datashuffler.Normalizer import Linear
class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling): class TripletWithFastSelectionDisk(Triplet, Disk, OnlineSampling):
""" """
This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` and This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` and
:py:class:`bob.learn.tensorflow.datashuffler.Disk` shufflers. :py:class:`bob.learn.tensorflow.datashuffler.Disk` shufflers.
...@@ -27,12 +27,11 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling): ...@@ -27,12 +27,11 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling):
"Facenet: A unified embedding for face recognition and clustering." Proceedings of the IEEE Conference on "Facenet: A unified embedding for face recognition and clustering." Proceedings of the IEEE Conference on
Computer Vision and Pattern Recognition. 2015. Computer Vision and Pattern Recognition. 2015.
In this shuffler, the triplets are selected as the following: In this shuffler, the triplets are selected as the following:
1. Select M identities
2. Get N pairs anchor-positive (for each M identities) such that the argmax(anchor, positive) 1. Select M identities.
3. For each pair anchor-positive, find the "semi-hard" negative samples such that 2. Get N pairs anchor-positive (for each M identities) such that the argmax(anchor, positive).
argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2 3. For each pair anchor-positive, find the "semi-hard" negative samples such that :math:`argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2`.
**Parameters** **Parameters**
...@@ -142,8 +141,6 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling): ...@@ -142,8 +141,6 @@ class TripletWithFastSelectionDisk(Triplet, Disk, OnLineSampling):
samples_a[i, ...] = self.get_anchor(anchor_labels[i]) samples_a[i, ...] = self.get_anchor(anchor_labels[i])
embedding_a = self.project(samples_a) embedding_a = self.project(samples_a)
print "EMBEDDING {0} ".format(embedding_a[:, 0])
# Getting the positives # Getting the positives
samples_p, embedding_p, d_anchor_positive = self.get_positives(anchor_labels, embedding_a) samples_p, embedding_p, d_anchor_positive = self.get_positives(anchor_labels, embedding_a)
samples_n = self.get_negative(anchor_labels, embedding_a, d_anchor_positive) samples_n = self.get_negative(anchor_labels, embedding_a, d_anchor_positive)
......
...@@ -8,7 +8,7 @@ import tensorflow as tf ...@@ -8,7 +8,7 @@ import tensorflow as tf
from .Disk import Disk from .Disk import Disk
from .Triplet import Triplet from .Triplet import Triplet
from .OnlineSampling import OnLineSampling from .OnlineSampling import OnlineSampling
from scipy.spatial.distance import euclidean from scipy.spatial.distance import euclidean
from bob.learn.tensorflow.datashuffler.Normalizer import Linear from bob.learn.tensorflow.datashuffler.Normalizer import Linear
...@@ -17,12 +17,13 @@ logger = logging.getLogger("bob.learn.tensorflow") ...@@ -17,12 +17,13 @@ logger = logging.getLogger("bob.learn.tensorflow")
from bob.learn.tensorflow.datashuffler.Normalizer import Linear from bob.learn.tensorflow.datashuffler.Normalizer import Linear
class TripletWithSelectionDisk(Triplet, Disk, OnLineSampling): class TripletWithSelectionDisk(Triplet, Disk, OnlineSampling):
""" """
This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` shufflers. This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` shufflers.
The selection of the triplets are random. The selection of the triplets are random.
**Parameters** **Parameters**
data: data:
Input data to be trainer Input data to be trainer
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
import numpy import numpy
import tensorflow as tf import tensorflow as tf
from OnlineSampling import OnLineSampling from .OnlineSampling import OnlineSampling
from Memory import Memory from .Memory import Memory
from Triplet import Triplet from .Triplet import Triplet
from scipy.spatial.distance import euclidean from scipy.spatial.distance import euclidean
from bob.learn.tensorflow.datashuffler.Normalizer import Linear from bob.learn.tensorflow.datashuffler.Normalizer import Linear
class TripletWithSelectionMemory(Triplet, Memory, OnLineSampling): class TripletWithSelectionMemory(Triplet, Memory, OnlineSampling):
""" """
This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` and This data shuffler generates triplets from :py:class:`bob.learn.tensorflow.datashuffler.Triplet` and
:py:class:`bob.learn.tensorflow.datashuffler.Memory` shufflers. :py:class:`bob.learn.tensorflow.datashuffler.Memory` shufflers.
...@@ -24,12 +24,11 @@ class TripletWithSelectionMemory(Triplet, Memory, OnLineSampling): ...@@ -24,12 +24,11 @@ class TripletWithSelectionMemory(Triplet, Memory, OnLineSampling):
"Facenet: A unified embedding for face recognition and clustering." Proceedings of the IEEE Conference on "Facenet: A unified embedding for face recognition and clustering." Proceedings of the IEEE Conference on
Computer Vision and Pattern Recognition. 2015. Computer Vision and Pattern Recognition. 2015.
In this shuffler, the triplets are selected as the following: In this shuffler, the triplets are selected as the following:
1. Select M identities
2. Get N pairs anchor-positive (for each M identities) such that the argmax(anchor, positive) 1. Select M identities.
3. For each pair anchor-positive, find the "semi-hard" negative samples such that 2. Get N pairs anchor-positive (for each M identities) such that the argmax(anchor, positive).
argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2 3. For each pair anchor-positive, find the "semi-hard" negative samples such that :math:`argmin(||f(x_a) - f(x_p)||^2 < ||f(x_a) - f(x_n)||^2`
**Parameters** **Parameters**
......
# see https://docs.python.org/3/library/pkgutil.html # see https://docs.python.org/3/library/pkgutil.html
from .Base import Base from .Base import Base
from .OnlineSampling import OnlineSampling
from .Siamese import Siamese from .Siamese import Siamese
from .Triplet import Triplet from .Triplet import Triplet
from .Memory import Memory from .Memory import Memory
from .Disk import Disk from .Disk import Disk
from .OnlineSampling import OnLineSampling
from .SiameseMemory import SiameseMemory from .SiameseMemory import SiameseMemory
from .TripletMemory import TripletMemory from .TripletMemory import TripletMemory
......
...@@ -14,6 +14,7 @@ class Layer(object): ...@@ -14,6 +14,7 @@ class Layer(object):
Layer base class Layer base class
**Parameters** **Parameters**
name: str name: str
The name of the layer The name of the layer
......
...@@ -13,7 +13,7 @@ from .InputLayer import InputLayer ...@@ -13,7 +13,7 @@ from .InputLayer import InputLayer
def __appropriate__(*args): def __appropriate__(*args):
"""Says object was actually declared here, an not on the import module. """Says object was actually declared here, an not on the import module.
Parameters: **Parameters**
*args: An iterable of objects to modify *args: An iterable of objects to modify
......
...@@ -17,9 +17,10 @@ class ContrastiveLoss(BaseLoss): ...@@ -17,9 +17,10 @@ class ContrastiveLoss(BaseLoss):
http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
L = 0.5 * (Y) * D^2 + 0.5 * (1-Y) * {max(0, margin - D)}^2 :math:`L = 0.5 * (Y) * D^2 + 0.5 * (1-Y) * {max(0, margin - D)}^2`
**Parameters** **Parameters**
left_feature: left_feature:
First element of the pair First element of the pair
......
...@@ -19,9 +19,10 @@ class TripletLoss(BaseLoss): ...@@ -19,9 +19,10 @@ class TripletLoss(BaseLoss):
"Facenet: A unified embedding for face recognition and clustering." "Facenet: A unified embedding for face recognition and clustering."
Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2015. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2015.
L = sum( |f_a - f_p|^2 - |f_a - f_n|^2 + \lambda) :math:`L = sum( |f_a - f_p|^2 - |f_a - f_n|^2 + \lambda)`
**Parameters** **Parameters**
left_feature: left_feature:
First element of the pair First element of the pair
......
...@@ -317,9 +317,9 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)): ...@@ -317,9 +317,9 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)):
open(path+"_sequence_net.pickle", 'w').write(self.pickle_architecture) open(path+"_sequence_net.pickle", 'w').write(self.pickle_architecture)
return saver.save(session, path) return saver.save(session, path)
def load(self, path, clear_devices=False): def load(self, path, clear_devices=False, session_from_scratch=False):
session = Session.instance().session session = Session.instance(new=session_from_scratch).session
self.sequence_net = pickle.loads(open(path+"_sequence_net.pickle").read()) self.sequence_net = pickle.loads(open(path+"_sequence_net.pickle").read())
if clear_devices: if clear_devices:
......
...@@ -224,10 +224,10 @@ class VGG16_mod(SequenceNetwork): ...@@ -224,10 +224,10 @@ class VGG16_mod(SequenceNetwork):
weights_initialization=Xavier(seed=seed, use_gpu=self.use_gpu), weights_initialization=Xavier(seed=seed, use_gpu=self.use_gpu),
bias_initialization=Constant(use_gpu=self.use_gpu) bias_initialization=Constant(use_gpu=self.use_gpu)
)) ))
self.add(AveragePooling(name="pooling5", strides=[1, 2, 2, 1])) self.add(AveragePooling(name="pooling5", shape=[1, 7, 7, 1], strides=[1, 7, 7, 1]))
if do_dropout: if do_dropout:
self.add(Dropout(name="dropout", keep_prob=0.4)) self.add(Dropout(name="dropout", keep_prob=0.5))
self.add(FullyConnected(name="fc8", output_dim=n_classes, self.add(FullyConnected(name="fc8", output_dim=n_classes,
activation=None, activation=None,
......
...@@ -4,11 +4,12 @@ ...@@ -4,11 +4,12 @@
# @date: Thu 13 Oct 2016 13:35 CEST # @date: Thu 13 Oct 2016 13:35 CEST
import numpy import numpy
from bob.learn.tensorflow.datashuffler import Memory, SiameseMemory, TripletMemory, Disk, SiameseDisk, TripletDisk, ImageAugmentation from bob.learn.tensorflow.datashuffler import Memory, SiameseMemory, TripletMemory, ImageAugmentation
from bob.learn.tensorflow.network import Chopra from bob.learn.tensorflow.network import Chopra, SequenceNetwork
from bob.learn.tensorflow.loss import BaseLoss, ContrastiveLoss, TripletLoss from bob.learn.tensorflow.loss import BaseLoss, ContrastiveLoss, TripletLoss
from bob.learn.tensorflow.trainers import Trainer, SiameseTrainer, TripletTrainer, constant from bob.learn.tensorflow.trainers import Trainer, SiameseTrainer, TripletTrainer, constant
from .test_cnn_scratch import validate_network from .test_cnn_scratch import validate_network
import pkg_resources
from bob.learn.tensorflow.utils import load_mnist from bob.learn.tensorflow.utils import load_mnist
import tensorflow as tf import tensorflow as tf
...@@ -99,7 +100,10 @@ def test_cnn_trainer(): ...@@ -99,7 +100,10 @@ def test_cnn_trainer():
iterations=iterations, iterations=iterations,
analizer=None, analizer=None,
prefetch=False, prefetch=False,
learning_rate=constant(0.05, name="regular_lr"),
optimizer=tf.train.AdamOptimizer(name="adam_softmax"),
temp_dir=directory) temp_dir=directory)
trainer.train(train_data_shuffler) trainer.train(train_data_shuffler)
accuracy = validate_network(validation_data, validation_labels, architecture) accuracy = validate_network(validation_data, validation_labels, architecture)
...@@ -139,6 +143,7 @@ def test_siamesecnn_trainer(): ...@@ -139,6 +143,7 @@ def test_siamesecnn_trainer():
prefetch=False, prefetch=False,
analizer=None, analizer=None,
learning_rate=constant(0.05, name="siamese_lr"), learning_rate=constant(0.05, name="siamese_lr"),
optimizer=tf.train.AdamOptimizer(name="adam_siamese"),
temp_dir=directory) temp_dir=directory)
trainer.train(train_data_shuffler) trainer.train(train_data_shuffler)
...@@ -181,6 +186,7 @@ def test_tripletcnn_trainer(): ...@@ -181,6 +186,7 @@ def test_tripletcnn_trainer():
prefetch=False, prefetch=False,
analizer=None, analizer=None,
learning_rate=constant(0.05, name="triplet_lr"), learning_rate=constant(0.05, name="triplet_lr"),
optimizer=tf.train.AdamOptimizer(name="adam_triplet"),
temp_dir=directory) temp_dir=directory)
trainer.train(train_data_shuffler) trainer.train(train_data_shuffler)
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
Some unit tests that create networks on the fly Some unit tests that create networks on the fly
""" """
import numpy import numpy
import pkg_resources import pkg_resources
from bob.learn.tensorflow.utils import load_mnist from bob.learn.tensorflow.utils import load_mnist
...@@ -38,9 +37,8 @@ def test_load_test_cnn(): ...@@ -38,9 +37,8 @@ def test_load_test_cnn():
# Creating datashufflers # Creating datashufflers
validation_data = numpy.reshape(validation_data, (validation_data.shape[0], 28, 28, 1)) validation_data = numpy.reshape(validation_data, (validation_data.shape[0], 28, 28, 1))
network = SequenceNetwork() network = SequenceNetwork()
network.load(pkg_resources.resource_filename(__name__, 'data/cnn_mnist/model.ckp')) network.load(pkg_resources.resource_filename(__name__, 'data/cnn_mnist/model.ckp'), session_from_scratch=True)
accuracy = validate_network(validation_data, validation_labels, network) accuracy = validate_network(validation_data, validation_labels, network)
assert accuracy > 80 assert accuracy > 80
del network del network
...@@ -81,8 +81,10 @@ def test_cnn_pretrained(): ...@@ -81,8 +81,10 @@ def test_cnn_pretrained():
iterations=iterations, iterations=iterations,
analizer=None, analizer=None,
prefetch=False, prefetch=False,
learning_rate=constant(0.05, name="lr"), learning_rate=constant(0.05, name="regular_lr"),
optimizer=tf.train.AdamOptimizer(name="adam_pretrained_model"),
temp_dir=directory) temp_dir=directory)
import ipdb; ipdb.set_trace();
trainer.train(train_data_shuffler) trainer.train(train_data_shuffler)
accuracy = validate_network(validation_data, validation_labels, scratch) accuracy = validate_network(validation_data, validation_labels, scratch)
assert accuracy > 85 assert accuracy > 85
...@@ -99,9 +101,10 @@ def test_cnn_pretrained(): ...@@ -99,9 +101,10 @@ def test_cnn_pretrained():
iterations=iterations+200, iterations=iterations+200,
analizer=None, analizer=None,
prefetch=False, prefetch=False,
learning_rate=constant(0.05, name="lr2"), learning_rate=None,
temp_dir=directory2, temp_dir=directory2,
model_from_file=os.path.join(directory, "model.ckp")) model_from_file=os.path.join(directory, "model.ckp"))
trainer.train(train_data_shuffler) trainer.train(train_data_shuffler)
accuracy = validate_network(validation_data, validation_labels, scratch) accuracy = validate_network(validation_data, validation_labels, scratch)
......
...@@ -234,3 +234,44 @@ def test_diskaudio_shuffler(): ...@@ -234,3 +234,44 @@ def test_diskaudio_shuffler():
placeholders = data_shuffler.get_placeholders(name="train") placeholders = data_shuffler.get_placeholders(name="train")
assert placeholders[0].get_shape().as_list() == batch_shape assert placeholders[0].get_shape().as_list() == batch_shape
assert placeholders[1].get_shape().as_list()[0] == batch_shape[0] assert placeholders[1].get_shape().as_list()[0] == batch_shape[0]
"""
Some unit tests that create networks on the fly
"""
batch_size = 16
validation_batch_size = 400
iterations = 50
seed = 10
directory = "./temp/cnn_scratch"
def scratch_network():
# Creating a random network
scratch = SequenceNetwork(default_feature_layer="fc1")
scratch.add(Conv2D(name="conv1", kernel_size=3,
filters=10,
activation=tf.nn.tanh,
batch_norm=False))
scratch.add(FullyConnected(name="fc1", output_dim=10,
activation=None,
batch_norm=False
))
return scratch
def validate_network(validation_data, validation_labels, network):
# Testing
validation_data_shuffler = Memory(validation_data, validation_labels,
input_shape=[28, 28, 1],
batch_size=validation_batch_size)
[data, labels] = validation_data_shuffler.get_batch()
predictions = network.predict(data)
accuracy = 100. * numpy.sum(predictions == labels) / predictions.shape[0]
return accuracy
...@@ -58,6 +58,7 @@ def test_dnn_trainer(): ...@@ -58,6 +58,7 @@ def test_dnn_trainer():
analizer=None, analizer=None,
prefetch=False, prefetch=False,
learning_rate=constant(0.05, name="dnn_lr"), learning_rate=constant(0.05, name="dnn_lr"),
optimizer=tf.train.AdamOptimizer(name="adam_dnn"),
temp_dir=directory) temp_dir=directory)
trainer.train(train_data_shuffler) trainer.train(train_data_shuffler)
......
...@@ -7,22 +7,18 @@ import logging ...@@ -7,22 +7,18 @@ import logging
logger = logging.getLogger("bob.learn.tensorflow") logger = logging.getLogger("bob.learn.tensorflow")
import tensorflow as tf import tensorflow as tf
from tensorflow.core.framework import summary_pb2 from tensorflow.core.framework import summary_pb2
import threading
from ..analyzers import ExperimentAnalizer, SoftmaxAnalizer from ..analyzers import ExperimentAnalizer, SoftmaxAnalizer
from ..network import SequenceNetwork from ..network import SequenceNetwork
import bob.io.base
from .Trainer import Trainer from .Trainer import Trainer
import os import os
import sys
from .learning_rate import constant
class SiameseTrainer(Trainer): class SiameseTrainer(Trainer):
""" """
Trainer for siamese networks. Trainer for siamese networks.
**Parameters** **Parameters**
architecture: architecture:
The architecture that you want to run. Should be a :py:class`bob.learn.tensorflow.network.SequenceNetwork` The architecture that you want to run. Should be a :py:class`bob.learn.tensorflow.network.SequenceNetwork`
...@@ -38,7 +34,7 @@ class SiameseTrainer(Trainer): ...@@ -38,7 +34,7 @@ class SiameseTrainer(Trainer):
temp_dir: str temp_dir: str
The output directory The output directory
learning_rate: :py:class:`bob.learn.tensorflow.trainers.learningrate` learning_rate: `bob.learn.tensorflow.trainers.learning_rate`
Initial learning rate Initial learning rate
convergence_threshold: convergence_threshold:
...@@ -70,7 +66,7 @@ class SiameseTrainer(Trainer): ...@@ -70,7 +66,7 @@ class SiameseTrainer(Trainer):
temp_dir="cnn", temp_dir="cnn",
# Learning rate # Learning rate
learning_rate=constant(), learning_rate=None,
###### training options ########## ###### training options ##########
convergence_threshold=0.01, convergence_threshold=0.01,
......
...@@ -12,7 +12,7 @@ import bob.core ...@@ -12,7 +12,7 @@ import bob.core
from ..analyzers import SoftmaxAnalizer from ..analyzers import SoftmaxAnalizer
from tensorflow.core.framework import summary_pb2 from tensorflow.core.framework import summary_pb2
import time import time
from bob.learn.tensorflow.datashuffler.OnlineSampling import OnLineSampling from bob.learn.tensorflow.datashuffler import OnlineSampling
from bob.learn.tensorflow.utils.session import Session from bob.learn.tensorflow.utils.session import Session
from .learning_rate import constant from .learning_rate import constant
...@@ -25,6 +25,7 @@ class Trainer(object): ...@@ -25,6 +25,7 @@ class Trainer(object):
Use this trainer when your CNN is composed by one graph Use this trainer when your CNN is composed by one graph
**Parameters** **Parameters**
architecture: architecture:
The architecture that you want to run. Should be a :py:class`bob.learn.tensorflow.network.SequenceNetwork` The architecture that you want to run. Should be a :py:class`bob.learn.tensorflow.network.SequenceNetwork`
...@@ -40,7 +41,7 @@ class Trainer(object): ...@@ -40,7 +41,7 @@ class Trainer(object):
temp_dir: str temp_dir: str
The output directory The output directory
learning_rate: :py:class:`bob.learn.tensorflow.trainers.learningrate` learning_rate: `bob.learn.tensorflow.trainers.learning_rate`
Initial learning rate Initial learning rate
convergence_threshold: convergence_threshold:
...@@ -72,7 +73,7 @@ class Trainer(object): ...@@ -72,7 +73,7 @@ class Trainer(object):
temp_dir="cnn", temp_dir="cnn",
# Learning rate # Learning rate