MCPcopy Create free account
hub / github.com/ChunmingHe/WS-SAM / randomCrop_noEdge

Function randomCrop_noEdge

utils/data_val.py:44–53  ·  view source on GitHub ↗
(image, label)

Source from the content-addressed store, hash-verified

42 return image.crop(random_region), label.crop(random_region), edge.crop(random_region)
43
44def randomCrop_noEdge(image, label):
45 border = 30
46 image_width = image.size[0]
47 image_height = image.size[1]
48 crop_win_width = np.random.randint(image_width - border, image_width)
49 crop_win_height = np.random.randint(image_height - border, image_height)
50 random_region = (
51 (image_width - crop_win_width) >> 1, (image_height - crop_win_height) >> 1, (image_width + crop_win_width) >> 1,
52 (image_height + crop_win_height) >> 1)
53 return image.crop(random_region), label.crop(random_region)
54
55def randomRotation(image, label, edge):
56 mode = Image.BICUBIC

Callers 3

__getitem__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected