| 190 | ds = dataset.BSDS500(name, shuffle=True) |
| 191 | |
| 192 | class CropMultiple16(imgaug.ImageAugmentor): |
| 193 | def get_transform(self, img): |
| 194 | newh = img.shape[0] // 16 * 16 |
| 195 | neww = img.shape[1] // 16 * 16 |
| 196 | assert newh > 0 and neww > 0 |
| 197 | diffh = img.shape[0] - newh |
| 198 | h0 = 0 if diffh == 0 else self.rng.randint(diffh) |
| 199 | diffw = img.shape[1] - neww |
| 200 | w0 = 0 if diffw == 0 else self.rng.randint(diffw) |
| 201 | return imgaug.CropTransform(h0, w0, newh, neww) |
| 202 | |
| 203 | if isTrain: |
| 204 | shape_aug = [ |