Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.tensorflow
Commits
5819415f
Commit
5819415f
authored
Nov 30, 2016
by
Tiago de Freitas Pereira
Browse files
Fixed test units
parent
ccc7f48a
Changes
9
Hide whitespace changes
Inline
Side-by-side
bob/learn/tensorflow/datashuffler/OnlineSampling.py
View file @
5819415f
...
...
@@ -8,7 +8,7 @@ from .Base import Base
from
bob.learn.tensorflow.network
import
SequenceNetwork
class
OnlineSampling
(
Base
):
class
OnlineSampling
(
object
):
"""
This data shuffler uses the current state of the network to select the samples.
This class is not meant to be used, but extended.
...
...
bob/learn/tensorflow/network/SequenceNetwork.py
View file @
5819415f
...
...
@@ -43,6 +43,9 @@ class SequenceNetwork(six.with_metaclass(abc.ABCMeta, object)):
self
.
inference_graph
=
None
self
.
inference_placeholder
=
None
def
__del__
(
self
):
tf
.
reset_default_graph
()
def
add
(
self
,
layer
):
"""
Add a :py:class:`bob.learn.tensorflow.layers.Layer` in the sequence network
...
...
bob/learn/tensorflow/test/test_cnn.py
View file @
5819415f
...
...
@@ -102,7 +102,8 @@ def test_cnn_trainer():
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
)
...
...
@@ -144,7 +145,8 @@ def test_siamesecnn_trainer():
analizer
=
None
,
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
)
...
...
@@ -187,7 +189,8 @@ def test_tripletcnn_trainer():
analizer
=
None
,
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
)
...
...
bob/learn/tensorflow/test/test_cnn_pretrained_model.py
View file @
5819415f
...
...
@@ -83,8 +83,9 @@ def test_cnn_pretrained():
prefetch
=
False
,
learning_rate
=
constant
(
0.05
,
name
=
"regular_lr"
),
optimizer
=
tf
.
train
.
AdamOptimizer
(
name
=
"adam_pretrained_model"
),
temp_dir
=
directory
)
import
ipdb
;
ipdb
.
set_trace
();
temp_dir
=
directory
)
trainer
.
train
(
train_data_shuffler
)
accuracy
=
validate_network
(
validation_data
,
validation_labels
,
scratch
)
assert
accuracy
>
85
...
...
@@ -103,7 +104,8 @@ def test_cnn_pretrained():
prefetch
=
False
,
learning_rate
=
None
,
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
)
...
...
bob/learn/tensorflow/test/test_cnn_scratch.py
View file @
5819415f
...
...
@@ -79,7 +79,8 @@ def test_cnn_trainer_scratch():
iterations
=
iterations
,
analizer
=
None
,
prefetch
=
False
,
temp_dir
=
directory
)
temp_dir
=
directory
)
trainer
.
train
(
train_data_shuffler
)
...
...
bob/learn/tensorflow/test/test_dnn.py
View file @
5819415f
...
...
@@ -59,7 +59,8 @@ def test_dnn_trainer():
prefetch
=
False
,
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
)
accuracy
=
validate_network
(
validation_data
,
validation_labels
,
architecture
)
...
...
bob/learn/tensorflow/trainers/SiameseTrainer.py
View file @
5819415f
...
...
@@ -56,6 +56,7 @@ class SiameseTrainer(Trainer):
verbosity_level:
"""
def
__init__
(
self
,
...
...
@@ -80,7 +81,8 @@ class SiameseTrainer(Trainer):
model_from_file
=
""
,
verbosity_level
=
2
):
verbosity_level
=
2
):
super
(
SiameseTrainer
,
self
).
__init__
(
architecture
=
architecture
,
...
...
bob/learn/tensorflow/trainers/Trainer.py
View file @
5819415f
...
...
@@ -202,7 +202,7 @@ class Trainer(object):
if
self
.
prefetch
:
_
,
l
,
lr
,
summary
=
self
.
session
.
run
([
self
.
optimizer
,
self
.
training_graph
,
self
.
learning_rate
,
self
.
summaries_train
])
self
.
learning_rate
,
self
.
summaries_train
])
else
:
feed_dict
=
self
.
get_feed_dict
(
self
.
train_data_shuffler
)
_
,
l
,
lr
,
summary
=
self
.
session
.
run
([
self
.
optimizer
,
self
.
training_graph
,
...
...
bob/learn/tensorflow/trainers/TripletTrainer.py
View file @
5819415f
...
...
@@ -85,7 +85,8 @@ class TripletTrainer(Trainer):
model_from_file
=
""
,
verbosity_level
=
2
):
verbosity_level
=
2
):
super
(
TripletTrainer
,
self
).
__init__
(
architecture
=
architecture
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment