Skip to content
Snippets Groups Projects
Commit 56bc342f authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Merge branch 'fix-hdf5' into 'master'

Fix: hdf5 v3 not supported

Closes #28

See merge request !27
parents 79c69bb4 cce8ebd4
No related branches found
No related tags found
1 merge request!27Fix: hdf5 v3 not supported
Pipeline #58567 passed
...@@ -305,6 +305,7 @@ class GMM(BioAlgorithm, BaseEstimator): ...@@ -305,6 +305,7 @@ class GMM(BioAlgorithm, BaseEstimator):
max_iter=self.kmeans_training_iterations, max_iter=self.kmeans_training_iterations,
init_method="k-means||", init_method="k-means||",
init_max_iter=5, init_max_iter=5,
random_state=self.init_seed,
), ),
) )
......
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -28,8 +28,8 @@ import bob.bio.gmm ...@@ -28,8 +28,8 @@ import bob.bio.gmm
from bob.bio.base.test import utils from bob.bio.base.test import utils
from bob.bio.gmm.algorithm import GMM from bob.bio.gmm.algorithm import GMM
from bob.learn.em.mixture import GMMMachine from bob.learn.em.mixture.gmm import GMMMachine
from bob.learn.em.mixture import GMMStats from bob.learn.em.mixture.gmm import GMMStats
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -57,8 +57,8 @@ def test_training(): ...@@ -57,8 +57,8 @@ def test_training():
# Set a small training iteration count # Set a small training iteration count
gmm1 = GMM( gmm1 = GMM(
number_of_gaussians=2, number_of_gaussians=2,
kmeans_training_iterations=1, kmeans_training_iterations=5,
ubm_training_iterations=1, ubm_training_iterations=5,
init_seed=seed_value, init_seed=seed_value,
) )
train_data = utils.random_training_set( train_data = utils.random_training_set(
...@@ -95,7 +95,7 @@ def test_projector(): ...@@ -95,7 +95,7 @@ def test_projector():
) )
# Generate and project random feature # Generate and project random feature
feature = utils.random_array((20, 45), -5.0, 5.0, seed=84) feature = utils.random_array((20, 45), -5.0, 5.0, seed=seed_value)
projected = gmm1.project(feature) projected = gmm1.project(feature)
assert isinstance(projected, bob.learn.em.mixture.GMMStats) assert isinstance(projected, bob.learn.em.mixture.GMMStats)
...@@ -120,7 +120,7 @@ def test_enroll(): ...@@ -120,7 +120,7 @@ def test_enroll():
) )
gmm1.ubm = ubm gmm1.ubm = ubm
# Enroll the biometric reference from random features # Enroll the biometric reference from random features
enroll = utils.random_training_set((20, 45), 5, -5.0, 5.0, seed=21) enroll = utils.random_training_set((20, 45), 5, -5.0, 5.0, seed=seed_value)
biometric_reference = gmm1.enroll(enroll) biometric_reference = gmm1.enroll(enroll)
assert not biometric_reference.is_similar_to(biometric_reference.ubm) assert not biometric_reference.is_similar_to(biometric_reference.ubm)
assert isinstance(biometric_reference, GMMMachine) assert isinstance(biometric_reference, GMMMachine)
...@@ -153,9 +153,9 @@ def test_score(): ...@@ -153,9 +153,9 @@ def test_score():
probe = GMMStats.from_hdf5( probe = GMMStats.from_hdf5(
pkg_resources.resource_filename("bob.bio.gmm.test", "data/gmm_projected.hdf5") pkg_resources.resource_filename("bob.bio.gmm.test", "data/gmm_projected.hdf5")
) )
probe_data = utils.random_array((20, 45), -5.0, 5.0, seed=84) probe_data = utils.random_array((20, 45), -5.0, 5.0, seed=seed_value)
reference_score = -0.098980 reference_score = 0.601025
numpy.testing.assert_almost_equal( numpy.testing.assert_almost_equal(
gmm1.score(biometric_reference, probe), reference_score, decimal=5 gmm1.score(biometric_reference, probe), reference_score, decimal=5
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment