MCPcopy Create free account
hub / github.com/amdegroot/ssd.pytorch / RandomContrast

Class RandomContrast

utils/augmentations.py:170–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

168
169
170class RandomContrast(object):
171 def __init__(self, lower=0.5, upper=1.5):
172 self.lower = lower
173 self.upper = upper
174 assert self.upper >= self.lower, "contrast upper must be >= lower."
175 assert self.lower >= 0, "contrast lower must be non-negative."
176
177 # expects float image
178 def __call__(self, image, boxes=None, labels=None):
179 if random.randint(2):
180 alpha = random.uniform(self.lower, self.upper)
181 image *= alpha
182 return image, boxes, labels
183
184
185class RandomBrightness(object):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected