MCPcopy Create free account
hub / github.com/MaureenZOU/TSAM / GroupScale

Class GroupScale

src/data_loader/transform.py:82–95  ·  view source on GitHub ↗

Rescales the input PIL.Image to the given 'size'. 'size' will be the size of the smaller edge. For example, if height > width, then image will be rescaled to (size * height / width, size) size: size of the smaller edge interpolation: Default: PIL.Image.BILINEAR

Source from the content-addressed store, hash-verified

80
81
82class GroupScale(object):
83 """ Rescales the input PIL.Image to the given 'size'.
84 'size' will be the size of the smaller edge.
85 For example, if height > width, then image will be
86 rescaled to (size * height / width, size)
87 size: size of the smaller edge
88 interpolation: Default: PIL.Image.BILINEAR
89 """
90
91 def __init__(self, size, interpolation=Image.BILINEAR):
92 self.worker = torchvision.transforms.Resize(size, interpolation)
93
94 def __call__(self, img_group):
95 return [self.worker(img) for img in img_group]
96
97
98class GroupOverSample(object):

Callers 3

__init__Method · 0.70
__call__Method · 0.70
transform.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected