Commit 8a4d259d authored by haamoon's avatar haamoon Committed by Yuxin Wu

add identity coordinate mapping to ToUint8 and ToFloat32 augmentors (#339)

* add identity coordinate mapping to ToUint8 and ToFloat32 augmentors
parent 8d557de8
...@@ -45,10 +45,10 @@ class Grayscale(ColorSpace): ...@@ -45,10 +45,10 @@ class Grayscale(ColorSpace):
class ToUint8(MapImage): class ToUint8(MapImage):
""" Convert image to uint8. Useful to reduce communication overhead. """ """ Convert image to uint8. Useful to reduce communication overhead. """
def __init__(self): def __init__(self):
super(ToUint8, self).__init__(lambda x: np.clip(x, 0, 255).astype(np.uint8)) super(ToUint8, self).__init__(lambda x: np.clip(x, 0, 255).astype(np.uint8), lambda x: x)
class ToFloat32(MapImage): class ToFloat32(MapImage):
""" Convert image to float32, may increase quality of the augmentor. """ """ Convert image to float32, may increase quality of the augmentor. """
def __init__(self): def __init__(self):
super(ToFloat32, self).__init__(lambda x: x.astype(np.float32)) super(ToFloat32, self).__init__(lambda x: x.astype(np.float32), lambda x: x)
Markdown is supported
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