MCPcopy Create free account
hub / github.com/Parskatt/DeDoDe / TupleNormalize

Class TupleNormalize

DeDoDe/utils.py:414–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

412
413
414class TupleNormalize(object):
415 def __init__(self, mean, std):
416 self.mean = mean
417 self.std = std
418 self.normalize = transforms.Normalize(mean=mean, std=std)
419
420 def __call__(self, im_tuple):
421 c,h,w = im_tuple[0].shape
422 if c > 3:
423 warnings.warn(f"Number of channels {c=} > 3, assuming first 3 are rgb")
424 return [self.normalize(im[:3]) for im in im_tuple]
425
426 def __repr__(self):
427 return "TupleNormalize(mean={}, std={})".format(self.mean, self.std)
428
429
430class TupleCompose(object):

Callers 1

get_tuple_transform_opsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected