Force features to input dtype

This commit is contained in:
Florent Guiotte 2018-08-28 15:48:05 +02:00
parent 61282fc616
commit 2370a79b21

View File

@ -29,13 +29,17 @@ class LocalFeatures(Filter):
for function in self.features:
self.logger.debug('Features function {}'.format(function.__name__))
features = function(patches, axis=-1)
features = cast_expand_i(features, patches.dtype)
stacker.auto_stack(features, stack,
'Local Features {}'.format(function.__name__),
'f^{{{}}}'.format(function.__name__))
'Local Features {} {}x{}'.format(function.__name__, self.patch_size, self.patch_size),
'f^{{{}}}_{{{}\\times{}}}'.format(function.__name__, self.patch_size, self.patch_size))
return stacker.pack()
def cast_expand_i(X, dtype):
return ((X - X.min()) / (X.max() - X.min()) * np.iinfo(dtype).max).astype(dtype)
def create_patches(array, patch_size=3):
amp = int((patch_size - 1 ) / 2)