Skip to content
Snippets Groups Projects
Commit 2b13b46b authored by Manuel Günther's avatar Manuel Günther
Browse files

replaced len(shape) with ndim

parent 336cbe02
No related branches found
No related tags found
No related merge requests found
...@@ -87,7 +87,7 @@ class GMM (Algorithm): ...@@ -87,7 +87,7 @@ class GMM (Algorithm):
def _check_feature(self, feature): def _check_feature(self, feature):
"""Checks that the features are appropriate""" """Checks that the features are appropriate"""
if not isinstance(feature, numpy.ndarray) or len(feature.shape) != 2 or feature.dtype != numpy.float64: if not isinstance(feature, numpy.ndarray) or feature.ndim != 2 or feature.dtype != numpy.float64:
raise ValueError("The given feature is not appropriate") raise ValueError("The given feature is not appropriate")
if self.ubm is not None and feature.shape[1] != self.ubm.shape[1]: if self.ubm is not None and feature.shape[1] != self.ubm.shape[1]:
raise ValueError("The given feature is expected to have %d elements, but it has %d" % (self.ubm.shape[1], feature.shape[1])) raise ValueError("The given feature is expected to have %d elements, but it has %d" % (self.ubm.shape[1], feature.shape[1]))
......
...@@ -186,7 +186,7 @@ class ISV (GMM): ...@@ -186,7 +186,7 @@ class ISV (GMM):
assert isinstance(probe, (tuple, list)) assert isinstance(probe, (tuple, list))
assert len(probe) == 2 assert len(probe) == 2
assert isinstance(probe[0], bob.learn.em.GMMStats) assert isinstance(probe[0], bob.learn.em.GMMStats)
assert isinstance(probe[1], numpy.ndarray) and len(probe[1].shape) == 1 and probe[1].dtype == numpy.float64 assert isinstance(probe[1], numpy.ndarray) and probe[1].ndim == 1 and probe[1].dtype == numpy.float64
def score(self, model, probe): def score(self, model, probe):
......
...@@ -57,7 +57,7 @@ class IVector (GMM): ...@@ -57,7 +57,7 @@ class IVector (GMM):
def _check_projected(self, feature): def _check_projected(self, feature):
"""Checks that the features are appropriate""" """Checks that the features are appropriate"""
if not isinstance(feature, numpy.ndarray) or len(feature.shape) != 1 or feature.dtype != numpy.float64: if not isinstance(feature, numpy.ndarray) or feature.ndim != 1 or feature.dtype != numpy.float64:
raise ValueError("The given feature is not appropriate") raise ValueError("The given feature is not appropriate")
if self.whitener is not None and feature.shape[0] != self.whitener.shape[1]: if self.whitener is not None and feature.shape[0] != self.whitener.shape[1]:
raise ValueError("The given feature is expected to have %d elements, but it has %d" % (self.whitener.shape[1], feature.shape[0])) raise ValueError("The given feature is expected to have %d elements, but it has %d" % (self.whitener.shape[1], feature.shape[0]))
......
...@@ -104,7 +104,7 @@ setup( ...@@ -104,7 +104,7 @@ setup(
'console_scripts' : [ 'console_scripts' : [
'verify_gmm.py = bob.bio.gmm.script.verify_gmm:main', 'verify_gmm.py = bob.bio.gmm.script.verify_gmm:main',
'verify_isv.py = bob.bio.gmm.script.verify_isv:main', 'verify_isv.py = bob.bio.gmm.script.verify_isv:main',
'verify_ivector.py = bob.bio.gmm.script.verify_ivector:main', 'verify_ivector.py = bob.bio.gmm.script.verify_ivector:main',
], ],
'bob.bio.database': [ 'bob.bio.database': [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment