"vscode:/vscode.git/clone" did not exist on "f48f9c250fe7f6027c7445f8be04bb4499583f58"
Commit a7b66f03 authored by vfdev's avatar vfdev Committed by Francisco Massa
Browse files

* Replace np.random by random (#354)

parent 3ce7ded3
...@@ -700,22 +700,22 @@ class ColorJitter(object): ...@@ -700,22 +700,22 @@ class ColorJitter(object):
""" """
transforms = [] transforms = []
if brightness > 0: if brightness > 0:
brightness_factor = np.random.uniform(max(0, 1 - brightness), 1 + brightness) brightness_factor = random.uniform(max(0, 1 - brightness), 1 + brightness)
transforms.append(Lambda(lambda img: F.adjust_brightness(img, brightness_factor))) transforms.append(Lambda(lambda img: F.adjust_brightness(img, brightness_factor)))
if contrast > 0: if contrast > 0:
contrast_factor = np.random.uniform(max(0, 1 - contrast), 1 + contrast) contrast_factor = random.uniform(max(0, 1 - contrast), 1 + contrast)
transforms.append(Lambda(lambda img: F.adjust_contrast(img, contrast_factor))) transforms.append(Lambda(lambda img: F.adjust_contrast(img, contrast_factor)))
if saturation > 0: if saturation > 0:
saturation_factor = np.random.uniform(max(0, 1 - saturation), 1 + saturation) saturation_factor = random.uniform(max(0, 1 - saturation), 1 + saturation)
transforms.append(Lambda(lambda img: F.adjust_saturation(img, saturation_factor))) transforms.append(Lambda(lambda img: F.adjust_saturation(img, saturation_factor)))
if hue > 0: if hue > 0:
hue_factor = np.random.uniform(-hue, hue) hue_factor = random.uniform(-hue, hue)
transforms.append(Lambda(lambda img: F.adjust_hue(img, hue_factor))) transforms.append(Lambda(lambda img: F.adjust_hue(img, hue_factor)))
np.random.shuffle(transforms) random.shuffle(transforms)
transform = Compose(transforms) transform = Compose(transforms)
return transform return transform
...@@ -782,7 +782,7 @@ class RandomRotation(object): ...@@ -782,7 +782,7 @@ class RandomRotation(object):
Returns: Returns:
sequence: params to be passed to ``rotate`` for random rotation. sequence: params to be passed to ``rotate`` for random rotation.
""" """
angle = np.random.uniform(degrees[0], degrees[1]) angle = random.uniform(degrees[0], degrees[1])
return angle return angle
......
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