Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.face
Commits
0267811f
Commit
0267811f
authored
Dec 03, 2020
by
Laurent COLBOIS
Browse files
Added comparison test between TF1 and TF2 for FaceNet embeddings
parent
d4fbeef1
Pipeline
#46290
passed with stage
in 7 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/test/data/facenet_sandberg_20170512-110547.hdf5
0 → 100644
View file @
0267811f
File added
bob/bio/face/test/test_embeddings.py
View file @
0267811f
...
...
@@ -93,19 +93,26 @@ def test_idiap_inceptionv1_casia():
@
is_library_available
(
"tensorflow"
)
def
test_facenet_sanderberg
():
from
bob.bio.face.embeddings.tf2_inception_resnet
import
(
FaceNetSanderberg_20170512_110547
,
FaceNetSanderberg_20170512_110547
)
reference
=
bob
.
io
.
base
.
load
(
pkg_resources
.
resource_filename
(
"bob.bio.face.test"
,
"data/facenet_sandberg_20170512-110547.hdf5"
)
)
np
.
random
.
seed
(
10
)
transformer
=
FaceNetSanderberg_20170512_110547
()
data
=
np
.
random
.
rand
(
3
,
160
,
160
).
astype
(
"uint8"
)
data
=
(
np
.
random
.
rand
(
3
,
160
,
160
)
*
255
)
.
astype
(
"uint8"
)
output
=
transformer
.
transform
([
data
])[
0
]
assert
output
.
size
==
128
,
output
.
shape
# Sample Batch
sample
=
Sample
(
data
)
transformer_sample
=
wrap
([
"sample"
],
transformer
)
output
=
[
s
.
data
for
s
in
transformer_sample
.
transform
([
sample
])][
0
]
np
.
testing
.
assert_allclose
(
output
,
reference
.
flatten
(),
rtol
=
1e-5
,
atol
=
1e-4
)
assert
output
.
size
==
128
,
output
.
shape
...
...
Write
Preview
Markdown
is supported
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