MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / random_crop

Method random_crop

PATH/core/augmentation.py:475–484  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

473 return img_padded
474
475 def random_crop(self, img):
476 h, w = img.shape[:2]
477 max_x = w - self.width
478 max_y = h - self.height
479
480 x = np.random.randint(0, max_x)
481 y = np.random.randint(0, max_y)
482
483 crop = img[y:y+self.height,x:x+self.width]
484 return crop
485
486 def random_brightness(self, img, binary_mask=None):
487 if np.random.rand() <= 0.5:

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected