Commit 2b13b46b authored by Manuel Günther's avatar Manuel Günther
Browse files

replaced len(shape) with ndim

parent 336cbe02
......@@ -87,7 +87,7 @@ class GMM (Algorithm):
def _check_feature(self, feature):
"""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")
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]))
......
......@@ -186,7 +186,7 @@ class ISV (GMM):
assert isinstance(probe, (tuple, list))
assert len(probe) == 2
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):
......
......@@ -57,7 +57,7 @@ class IVector (GMM):
def _check_projected(self, feature):
"""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")
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]))
......
......@@ -104,7 +104,7 @@ setup(
'console_scripts' : [
'verify_gmm.py = bob.bio.gmm.script.verify_gmm: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': [
......
Supports Markdown
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