(image_shape, patch_size=TRAIN_SIZE, min_overlap=20)
| 55 | return x[..., c[0]:c[1], c[2]:c[3]] |
| 56 | |
| 57 | def compute_grid_indices(image_shape, patch_size=TRAIN_SIZE, min_overlap=20): |
| 58 | if min_overlap >= patch_size[0] or min_overlap >= patch_size[1]: |
| 59 | raise ValueError("!!") |
| 60 | hs = list(range(0, image_shape[0], patch_size[0] - min_overlap)) |
| 61 | ws = list(range(0, image_shape[1], patch_size[1] - min_overlap)) |
| 62 | # Make sure the final patch is flush with the image boundary |
| 63 | hs[-1] = image_shape[0] - patch_size[0] |
| 64 | ws[-1] = image_shape[1] - patch_size[1] |
| 65 | return [(h, w) for h in hs for w in ws] |
| 66 | |
| 67 | import math |
| 68 | def compute_weight(hws, image_shape, patch_size=TRAIN_SIZE, sigma=1.0, wtype='gaussian'): |
no outgoing calls
no test coverage detected