Force features to input dtype
This commit is contained in:
parent
61282fc616
commit
2370a79b21
@ -29,13 +29,17 @@ class LocalFeatures(Filter):
|
|||||||
for function in self.features:
|
for function in self.features:
|
||||||
self.logger.debug('Features function {}'.format(function.__name__))
|
self.logger.debug('Features function {}'.format(function.__name__))
|
||||||
features = function(patches, axis=-1)
|
features = function(patches, axis=-1)
|
||||||
|
features = cast_expand_i(features, patches.dtype)
|
||||||
|
|
||||||
stacker.auto_stack(features, stack,
|
stacker.auto_stack(features, stack,
|
||||||
'Local Features {}'.format(function.__name__),
|
'Local Features {} {}x{}'.format(function.__name__, self.patch_size, self.patch_size),
|
||||||
'f^{{{}}}'.format(function.__name__))
|
'f^{{{}}}_{{{}\\times{}}}'.format(function.__name__, self.patch_size, self.patch_size))
|
||||||
|
|
||||||
return stacker.pack()
|
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):
|
def create_patches(array, patch_size=3):
|
||||||
amp = int((patch_size - 1 ) / 2)
|
amp = int((patch_size - 1 ) / 2)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user