Commit 12ad27fe authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Implemented test case for InceptionResnetV2

parent e827156f
Pipeline #42633 failed with stage
in 5 minutes and 14 seconds
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment