Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.learn.tensorflow
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
bob
bob.learn.tensorflow
Commits
66fb1898
Commit
66fb1898
authored
7 years ago
by
Tiago de Freitas Pereira
Browse files
Options
Downloads
Patches
Plain Diff
Updated triplet
parent
467d4d05
Loading
Loading
1 merge request
!32
Organizing transfer learning
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bob/learn/tensorflow/estimators/Triplet.py
+4
-5
4 additions, 5 deletions
bob/learn/tensorflow/estimators/Triplet.py
with
4 additions
and
5 deletions
bob/learn/tensorflow/estimators/Triplet.py
+
4
−
5
View file @
66fb1898
...
...
@@ -121,13 +121,12 @@ class Triplet(estimator.Estimator):
is_trainable
=
is_trainable_checkpoint
(
self
.
extra_checkpoint
)
# Building one graph
prelogits_anchor
=
self
.
architecture
(
features
[
'
anchor
'
],
is_train
able
=
is_trainabl
e
)[
0
]
prelogits_positive
=
self
.
architecture
(
features
[
'
positive
'
],
reuse
=
True
,
is_train
able
=
is_trainabl
e
)[
0
]
prelogits_negative
=
self
.
architecture
(
features
[
'
negative
'
],
reuse
=
True
,
is_train
able
=
is_trainabl
e
)[
0
]
prelogits_anchor
=
self
.
architecture
(
features
[
'
anchor
'
],
is_train
ing_mode
=
Tru
e
)[
0
]
prelogits_positive
=
self
.
architecture
(
features
[
'
positive
'
],
reuse
=
True
,
is_train
ing_mode
=
Tru
e
)[
0
]
prelogits_negative
=
self
.
architecture
(
features
[
'
negative
'
],
reuse
=
True
,
is_train
ing_mode
=
Tru
e
)[
0
]
if
self
.
extra_checkpoint
is
not
None
:
tf
.
contrib
.
framework
.
init_from_checkpoint
(
self
.
extra_checkpoint
[
"
checkpoint_path
"
],
self
.
extra_checkpoint
[
"
scopes
"
])
# Compute Loss (for both TRAIN and EVAL modes)
self
.
loss
=
self
.
loss_op
(
prelogits_anchor
,
prelogits_positive
,
prelogits_negative
)
...
...
@@ -141,7 +140,7 @@ class Triplet(estimator.Estimator):
data
=
features
[
'
data
'
]
# Compute the embeddings
prelogits
=
self
.
architecture
(
data
)[
0
]
prelogits
=
self
.
architecture
(
data
,
is_training_mode
=
False
)[
0
]
embeddings
=
tf
.
nn
.
l2_normalize
(
prelogits
,
1
)
predictions
=
{
"
embeddings
"
:
embeddings
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment