Skip HSV augmentation when hyperparameters are [0, 0, 0] (#3686)
* Create shortcircuit in augment_hsv when hyperparameter are zero * implement faster opt-in Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
1 parent
814806c61d
commit
bf209f6fe9
1 file changed
+1
@@ -632,6 +632,7 @@ def load_image(self, index):
|
|||||||
|
|
||||||
|
|
||||||
def augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5):
|
def augment_hsv(img, hgain=0.5, sgain=0.5, vgain=0.5):
|
||||||
|
if hgain or sgain or vgain:
|
||||||
r = np.random.uniform(-1, 1, 3) * [hgain, sgain, vgain] + 1 # random gains
|
r = np.random.uniform(-1, 1, 3) * [hgain, sgain, vgain] + 1 # random gains
|
||||||
hue, sat, val = cv2.split(cv2.cvtColor(img, cv2.COLOR_BGR2HSV))
|
hue, sat, val = cv2.split(cv2.cvtColor(img, cv2.COLOR_BGR2HSV))
|
||||||
dtype = img.dtype # uint8
|
dtype = img.dtype # uint8
|
||||||
|
|||||||
Reference in new issue
Block a user