diff --git a/utils.py b/utils.py index f9e0d6a..d16fb19 100644 --- a/utils.py +++ b/utils.py @@ -97,8 +97,10 @@ def random_shadow(image): # as x2 == x1 causes zero-division problem, we'll write it in the below form: # (ym-y1)*(x2-x1) - (y2-y1)*(xm-x1) > 0 mask = np.zeros_like(image[:, :, 1]) - mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1 + #mask[(ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0] = 1 + mask[np.where((ym - y1) * (x2 - x1) - (y2 - y1) * (xm - x1) > 0)] = 1 + # choose which side should have shadow and adjust saturation cond = mask == np.random.randint(2) s_ratio = np.random.uniform(low=0.2, high=0.5)