MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / StaticRandomCrop

Class StaticRandomCrop

CV/PWCNet/data/datasets.py:31–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class StaticRandomCrop(object):
32 def __init__(self, image_size, crop_size):
33 self.th, self.tw = crop_size
34 h, w = image_size
35 self.h1 = random.randint(0, h - self.th)
36 self.w1 = random.randint(0, w - self.tw)
37
38 def __call__(self, img):
39 return img[self.h1:(self.h1 + self.th), self.w1:(self.w1 + self.tw), :]
40
41
42class StaticCenterCrop(object):

Callers 5

__getitem__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected