forked from mindspore-Ecosystem/mindspore
bugfix
This commit is contained in:
parent
901124c9bd
commit
a8caebd7ec
|
@ -50,7 +50,7 @@ class PhotoMetricDistortion:
|
||||||
self.contrast_upper)
|
self.contrast_upper)
|
||||||
img *= alpha
|
img *= alpha
|
||||||
# convert color from BGR to HSV
|
# convert color from BGR to HSV
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
|
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
|
||||||
# random saturation
|
# random saturation
|
||||||
if random.randint(2):
|
if random.randint(2):
|
||||||
img[..., 1] *= random.uniform(self.saturation_lower,
|
img[..., 1] *= random.uniform(self.saturation_lower,
|
||||||
|
@ -61,7 +61,7 @@ class PhotoMetricDistortion:
|
||||||
img[..., 0][img[..., 0] > 360] -= 360
|
img[..., 0][img[..., 0] > 360] -= 360
|
||||||
img[..., 0][img[..., 0] < 0] += 360
|
img[..., 0][img[..., 0] < 0] += 360
|
||||||
# convert color from HSV to BGR
|
# convert color from HSV to BGR
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
|
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
|
||||||
# random contrast
|
# random contrast
|
||||||
if mode == 0:
|
if mode == 0:
|
||||||
if random.randint(2):
|
if random.randint(2):
|
||||||
|
|
|
@ -107,7 +107,7 @@ class PhotoMetricDistortion:
|
||||||
img *= alpha
|
img *= alpha
|
||||||
|
|
||||||
# convert color from BGR to HSV
|
# convert color from BGR to HSV
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
|
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
|
||||||
|
|
||||||
# random saturation
|
# random saturation
|
||||||
if random.randint(2):
|
if random.randint(2):
|
||||||
|
@ -121,7 +121,7 @@ class PhotoMetricDistortion:
|
||||||
img[..., 0][img[..., 0] < 0] += 360
|
img[..., 0][img[..., 0] < 0] += 360
|
||||||
|
|
||||||
# convert color from HSV to BGR
|
# convert color from HSV to BGR
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
|
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
|
||||||
|
|
||||||
# random contrast
|
# random contrast
|
||||||
if mode == 0:
|
if mode == 0:
|
||||||
|
|
|
@ -102,7 +102,7 @@ class PhotoMetricDistortion:
|
||||||
img *= alpha
|
img *= alpha
|
||||||
|
|
||||||
# convert color from BGR to HSV
|
# convert color from BGR to HSV
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
|
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
|
||||||
|
|
||||||
# random saturation
|
# random saturation
|
||||||
if random.randint(2):
|
if random.randint(2):
|
||||||
|
@ -116,7 +116,7 @@ class PhotoMetricDistortion:
|
||||||
img[..., 0][img[..., 0] < 0] += 360
|
img[..., 0][img[..., 0] < 0] += 360
|
||||||
|
|
||||||
# convert color from HSV to BGR
|
# convert color from HSV to BGR
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
|
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
|
||||||
|
|
||||||
# random contrast
|
# random contrast
|
||||||
if mode == 0:
|
if mode == 0:
|
||||||
|
|
|
@ -103,7 +103,7 @@ class PhotoMetricDistortion:
|
||||||
img *= alpha
|
img *= alpha
|
||||||
|
|
||||||
# convert color from BGR to HSV
|
# convert color from BGR to HSV
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
|
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
|
||||||
|
|
||||||
# random saturation
|
# random saturation
|
||||||
if random.randint(2):
|
if random.randint(2):
|
||||||
|
@ -117,7 +117,7 @@ class PhotoMetricDistortion:
|
||||||
img[..., 0][img[..., 0] < 0] += 360
|
img[..., 0][img[..., 0] < 0] += 360
|
||||||
|
|
||||||
# convert color from HSV to BGR
|
# convert color from HSV to BGR
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
|
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
|
||||||
|
|
||||||
# random contrast
|
# random contrast
|
||||||
if mode == 0:
|
if mode == 0:
|
||||||
|
|
|
@ -116,7 +116,7 @@ class PhotoMetricDistortion:
|
||||||
img *= alpha
|
img *= alpha
|
||||||
|
|
||||||
# convert color from BGR to HSV
|
# convert color from BGR to HSV
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_BGR2HSV')))
|
img = cv2.cvtColor((img, cv2.COLOR_BGR2HSV))
|
||||||
|
|
||||||
# random saturation
|
# random saturation
|
||||||
if random.randint(2):
|
if random.randint(2):
|
||||||
|
@ -130,7 +130,7 @@ class PhotoMetricDistortion:
|
||||||
img[..., 0][img[..., 0] < 0] += 360
|
img[..., 0][img[..., 0] < 0] += 360
|
||||||
|
|
||||||
# convert color from HSV to BGR
|
# convert color from HSV to BGR
|
||||||
img = cv2.cvtColor((img, getattr(cv2, f'COLOR_HSV2BGR')))
|
img = cv2.cvtColor((img, cv2.COLOR_HSV2BGR))
|
||||||
|
|
||||||
# random contrast
|
# random contrast
|
||||||
if mode == 0:
|
if mode == 0:
|
||||||
|
|
Loading…
Reference in New Issue