MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / random_contrast

Method random_contrast

PATH/core/augmentation.py:496–504  ·  view source on GitHub ↗
(self, img, binary_mask=None)

Source from the content-addressed store, hash-verified

494 return img
495
496 def random_contrast(self, img, binary_mask=None):
497 if np.random.rand() <= 0.5:
498 img=img.astype(np.float32)
499 alpha = random.uniform(self.contrast_lower,
500 self.contrast_upper)
501 if binary_mask is not None:
502 alpha = alpha * binary_mask
503 img *= alpha
504 return img
505
506 def random_eraser(self, img, sl=0.02, sh=0.2, asratio=0.3, p=0.8, binary_mask=None):
507 p1 = random.uniform(-1, 1.0)

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected