Add divide 255 pre processor test
@@ -18,6 +18,7 @@ import pytest
from blueoil.pre_processor import (
Resize,
+ DivideBy255,
ResizeWithJoints,
JointsToGaussianHeatmap
)
@@ -45,6 +46,19 @@ def test_resize():
assert resized_mask.shape[2] == 3
+def test_divide_255():
+ orig_image = np.ones((1, 1, 3))
+ expect = np.array([[[0.00392157, 0.00392157, 0.00392157]]])
+
+ pre_processor = DivideBy255()
+ processed = pre_processor(image=orig_image)
+ processed_imaged = processed["image"]
+
+ assert isinstance(processed_imaged, np.ndarray)
+ assert processed_imaged.shape[:2] == orig_image.shape[:2]
+ assert np.allclose(expect, processed_imaged)
+
+
def test_resize_with_joints():
image = np.zeros(shape=(5, 5, 3), dtype=np.uint8)
