(image, label, edge)
| 31 | return img, label |
| 32 | |
| 33 | def randomCrop(image, label, edge): |
| 34 | border = 30 |
| 35 | image_width = image.size[0] |
| 36 | image_height = image.size[1] |
| 37 | crop_win_width = np.random.randint(image_width - border, image_width) |
| 38 | crop_win_height = np.random.randint(image_height - border, image_height) |
| 39 | random_region = ( |
| 40 | (image_width - crop_win_width) >> 1, (image_height - crop_win_height) >> 1, (image_width + crop_win_width) >> 1, |
| 41 | (image_height + crop_win_height) >> 1) |
| 42 | return image.crop(random_region), label.crop(random_region), edge.crop(random_region) |
| 43 | |
| 44 | def randomCrop_noEdge(image, label): |
| 45 | border = 30 |
no outgoing calls
no test coverage detected