From 9bc3a551d97aaf93d9b36f4b539653a6ed7df80a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 10 Apr 2020 17:24:49 -0700 Subject: [PATCH] histogram equalization added to augmentation --- utils/datasets.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/datasets.py b/utils/datasets.py index 8f1341e3..efd21f02 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -520,6 +520,11 @@ def augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5): np.clip(img_hsv[:, :, 0], None, 179, out=img_hsv[:, :, 0]) # inplace hue clip (0 - 179 deg) cv2.cvtColor(img_hsv, cv2.COLOR_HSV2BGR, dst=img) # no return needed + # Histogram equalization + if random.random() < 0.2: + for i in range(3): + img[:, :, i] = cv2.equalizeHist(img[:, :, i]) + def load_mosaic(self, index): # loads images in a mosaic