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

Class PhotometricDistort

utils/augmentations.py:376–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374
375
376class PhotometricDistort(object):
377 def __init__(self):
378 self.pd = [
379 RandomContrast(),
380 ConvertColor(transform='HSV'),
381 RandomSaturation(),
382 RandomHue(),
383 ConvertColor(current='HSV', transform='BGR'),
384 RandomContrast()
385 ]
386 self.rand_brightness = RandomBrightness()
387 self.rand_light_noise = RandomLightingNoise()
388
389 def __call__(self, image, boxes, labels):
390 im = image.copy()
391 im, boxes, labels = self.rand_brightness(im, boxes, labels)
392 if random.randint(2):
393 distort = Compose(self.pd[:-1])
394 else:
395 distort = Compose(self.pd[1:])
396 im, boxes, labels = distort(im, boxes, labels)
397 return self.rand_light_noise(im, boxes, labels)
398
399
400class SSDAugmentation(object):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected