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
7cf745d4
Commit
7cf745d4
authored
Nov 11, 2020
by
Tiago de Freitas Pereira
Browse files
[nose] Decorated some tests
parent
da387a3c
Pipeline
#45382
failed with stage
in 8 minutes and 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/bio/face/test/test_baselines.py
View file @
7cf745d4
...
...
@@ -12,8 +12,8 @@ import os
import
bob.io.base
import
functools
import
copy
import
tensorflow
as
tf
from
bob.bio.base.test.utils
import
mxnet_available
,
tensorflow_available
images
=
dict
()
images
[
"bioref"
]
=
(
...
...
@@ -54,7 +54,8 @@ def get_fake_samples_for_training():
annotations
=
{
"reye"
:
(
131
,
176
),
"leye"
:
(
222
,
170
)}
return
[
Sample
(
x
,
key
=
str
(
i
),
subject
=
str
(
i
),
annotations
=
annotations
)
for
i
,
x
in
enumerate
(
data
)
Sample
(
x
,
key
=
str
(
i
),
subject
=
str
(
i
),
annotations
=
annotations
)
for
i
,
x
in
enumerate
(
data
)
]
...
...
@@ -72,9 +73,7 @@ def run_baseline(baseline, samples_for_training=[]):
with
tempfile
.
TemporaryDirectory
()
as
d
:
cpy
=
copy
.
deepcopy
(
pipeline
)
checkpoint_pipeline
=
checkpoint_vanilla_biometrics
(
cpy
,
base_dir
=
d
)
checkpoint_pipeline
=
checkpoint_vanilla_biometrics
(
cpy
,
base_dir
=
d
)
checkpoint_scores
=
checkpoint_pipeline
([],
biometric_references
,
probes
)
assert
len
(
checkpoint_scores
)
==
1
...
...
@@ -106,31 +105,40 @@ def run_baseline(baseline, samples_for_training=[]):
assert
"samplewrapper-2"
in
dirs
assert
"scores"
in
dirs
@
tensorflow_available
def
test_facenet_baseline
():
run_baseline
(
"facenet-sanderberg"
)
@
tensorflow_available
def
test_inception_resnetv2_msceleb
():
run_baseline
(
"inception-resnetv2-msceleb"
)
@
tensorflow_available
def
test_inception_resnetv2_casiawebface
():
run_baseline
(
"inception-resnetv2-casiawebface"
)
@
tensorflow_available
def
test_inception_resnetv1_msceleb
():
run_baseline
(
"inception-resnetv1-msceleb"
)
@
tensorflow_available
def
test_inception_resnetv1_casiawebface
():
run_baseline
(
"inception-resnetv1-casiawebface"
)
@
mxnet_available
def
test_arcface_insightface
():
run_baseline
(
"arcface-insightface"
)
def
test_gabor_graph
():
run_baseline
(
"gabor_graph"
)
#def test_lda():
#
def test_lda():
# run_baseline("lda", get_fake_samples_for_training())
bob/bio/face/test/test_embeddings.py
View file @
7cf745d4
...
...
@@ -3,8 +3,10 @@ import bob.io.base
import
numpy
as
np
from
bob.pipelines
import
Sample
,
wrap
import
pkg_resources
from
bob.bio.base.test.utils
import
mxnet_available
,
tensorflow_available
@
tensorflow_available
def
test_idiap_inceptionv2_msceleb
():
from
bob.bio.face.embeddings
import
InceptionResnetv2_MsCeleb_CenterLoss_2018
...
...
@@ -28,6 +30,7 @@ def test_idiap_inceptionv2_msceleb():
assert
output
.
size
==
128
,
output
.
shape
@
tensorflow_available
def
test_idiap_inceptionv2_casia
():
from
bob.bio.face.embeddings
import
InceptionResnetv2_Casia_CenterLoss_2018
...
...
@@ -45,6 +48,7 @@ def test_idiap_inceptionv2_casia():
assert
output
.
size
==
128
,
output
.
shape
@
tensorflow_available
def
test_idiap_inceptionv1_msceleb
():
from
bob.bio.face.embeddings
import
InceptionResnetv1_MsCeleb_CenterLoss_2018
...
...
@@ -62,6 +66,7 @@ def test_idiap_inceptionv1_msceleb():
assert
output
.
size
==
128
,
output
.
shape
@
tensorflow_available
def
test_idiap_inceptionv1_casia
():
from
bob.bio.face.embeddings
import
InceptionResnetv1_Casia_CenterLoss_2018
...
...
@@ -78,6 +83,8 @@ def test_idiap_inceptionv1_casia():
assert
output
.
size
==
128
,
output
.
shape
@
tensorflow_available
def
test_facenet_sanderberg
():
from
bob.bio.face.embeddings
import
FaceNetSanderberg_20170512_110547
...
...
@@ -94,39 +101,18 @@ def test_facenet_sanderberg():
assert
output
.
size
==
128
,
output
.
shape
@
mxnet_available
def
test_arcface_insight_face
():
from
bob.bio.face.embeddings
import
ArcFaceInsightFace
transformer
=
ArcFaceInsightFace
()
data
=
np
.
random
.
rand
(
3
,
112
,
112
)
*
255
data
=
np
.
random
.
rand
(
3
,
112
,
112
)
*
255
data
=
data
.
astype
(
"uint8"
)
output
=
transformer
.
transform
([
data
])
assert
output
.
size
==
512
,
output
.
shape
# Sample Batch
sample
=
Sample
(
data
)
transformer_sample
=
wrap
([
"sample"
],
transformer
)
output
=
[
s
.
data
for
s
in
transformer_sample
.
transform
([
sample
])][
0
]
assert
output
.
size
==
512
,
output
.
shape
"""
def test_arface_insight_tf():
import tensorflow as tf
tf.compat.v1.reset_default_graph()
from bob.bio.face.embeddings import ArcFace_InsightFaceTF
np.random.seed(10)
transformer = ArcFace_InsightFaceTF()
data = np.random.rand(3, 112, 112).astype("uint8")
output = transformer.transform([data])[0]
assert output.size == 512, output.shape
# Sample Batch
sample
=
Sample
(
data
)
transformer_sample
=
wrap
([
"sample"
],
transformer
)
output
=
[
s
.
data
for
s
in
transformer_sample
.
transform
([
sample
])][
0
]
assert
output
.
size
==
512
,
output
.
shape
"""
\ No newline at end of file
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