| 412 | |
| 413 | |
| 414 | class 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 | |
| 430 | class TupleCompose(object): |
no outgoing calls
no test coverage detected