Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.bio.face
Commits
12ad27fe
Commit
12ad27fe
authored
Sep 10, 2020
by
Tiago de Freitas Pereira
Browse files
Implemented test case for InceptionResnetV2
parent
e827156f
Pipeline
#42633
failed with stage
in 5 minutes and 14 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/test/data/inception_resnet_v2_rgb.hdf5
0 → 100644
View file @
12ad27fe
File added
bob/bio/face/test/test_embeddings.py
View file @
12ad27fe
import
bob.bio.face
import
bob.io.base
import
numpy
as
np
from
bob.pipelines
import
Sample
,
wrap
import
pkg_resources
def
test_facenet
():
from
bob.bio.face.embeddings
import
FaceNetSanderberg
np
.
random
.
seed
(
10
)
transformer
=
FaceNetSanderberg
()
transformer
=
FaceNetSanderberg
()
# Raw data
data
=
np
.
random
.
rand
(
3
,
160
,
160
).
astype
(
"uint8"
)
output
=
transformer
.
transform
(
data
)
assert
output
.
size
==
128
,
output
.
shape
# Sample Batch
sample
=
Sample
(
data
)
...
...
@@ -25,9 +27,15 @@ def test_facenet():
def
test_idiap_inceptionv2_msceleb
():
from
bob.bio.face.embeddings
import
InceptionResnetv2_MsCeleb
reference
=
bob
.
io
.
base
.
load
(
pkg_resources
.
resource_filename
(
"bob.bio.face.test"
,
"data/inception_resnet_v2_rgb.hdf5"
)
)
np
.
random
.
seed
(
10
)
transformer
=
InceptionResnetv2_MsCeleb
()
data
=
np
.
random
.
rand
(
3
,
160
,
160
).
astype
(
"uint8"
)
data
=
(
np
.
random
.
rand
(
3
,
160
,
160
)
*
255
)
.
astype
(
"uint8"
)
output
=
transformer
.
transform
(
data
)
assert
output
.
size
==
128
,
output
.
shape
...
...
@@ -36,6 +44,7 @@ def test_idiap_inceptionv2_msceleb():
transformer_sample
=
wrap
([
"sample"
],
transformer
)
output
=
[
s
.
data
for
s
in
transformer_sample
.
transform
([
sample
])][
0
]
assert
np
.
allclose
(
output
,
reference
)
assert
output
.
size
==
128
,
output
.
shape
...
...
@@ -48,7 +57,6 @@ def test_idiap_inceptionv2_casia():
output
=
transformer
.
transform
(
data
)
assert
output
.
size
==
128
,
output
.
shape
# Sample Batch
sample
=
Sample
(
data
)
transformer_sample
=
wrap
([
"sample"
],
transformer
)
...
...
@@ -93,6 +101,7 @@ def test_idiap_inceptionv1_casia():
def
test_arface_insight_tf
():
import
tensorflow
as
tf
tf
.
compat
.
v1
.
reset_default_graph
()
from
bob.bio.face.embeddings
import
ArcFace_InsightFaceTF
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment