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
GitLab 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
Merge requests
!15
Updates
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Updates
updates
into
master
Overview
0
Commits
7
Pipelines
1
Changes
1
Merged
Tiago de Freitas Pereira
requested to merge
updates
into
master
7 years ago
Overview
0
Commits
7
Pipelines
1
Changes
1
Patched the train.py script to accept tensors as input
Crafted a script that generates LFW pairs for validation
Implemented a validation mechanism using embeddings
0
0
Merge request reports
Viewing commit
cc944be5
Prev
Next
Show latest version
1 file
+
36
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
cc944be5
Implemented embedding validation
· cc944be5
Tiago de Freitas Pereira
authored
7 years ago
bob/learn/tensorflow/test/test_utils.py
0 → 100644
+
36
−
0
View file @ cc944be5
Edit in single-file editor
Open in Web IDE
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
# @author: Tiago de Freitas Pereira <tiago.pereira@idiap.ch>
import
numpy
from
bob.learn.tensorflow.utils
import
compute_embedding_accuracy
"""
Some unit tests for the datashuffler
"""
def
test_embedding_accuracy
():
numpy
.
random
.
seed
(
10
)
samples_per_class
=
5
class_a
=
numpy
.
random
.
normal
(
loc
=
0
,
scale
=
0.1
,
size
=
(
samples_per_class
,
2
))
labels_a
=
numpy
.
zeros
(
samples_per_class
)
class_b
=
numpy
.
random
.
normal
(
loc
=
10
,
scale
=
0.1
,
size
=
(
samples_per_class
,
2
))
labels_b
=
numpy
.
ones
(
samples_per_class
)
data
=
numpy
.
vstack
((
class_a
,
class_b
))
labels
=
numpy
.
concatenate
((
labels_a
,
labels_b
))
assert
compute_embedding_accuracy
(
data
,
labels
)
==
1.
# Adding noise
noise
=
numpy
.
random
.
normal
(
loc
=
0
,
scale
=
0.1
,
size
=
(
samples_per_class
,
2
))
noise_labels
=
numpy
.
ones
(
samples_per_class
)
data
=
numpy
.
vstack
((
data
,
noise
))
labels
=
numpy
.
concatenate
((
labels
,
noise_labels
))
assert
compute_embedding_accuracy
(
data
,
labels
)
==
10
/
15.
Loading