(self, sample)
| 258 | self.output_size = output_size |
| 259 | |
| 260 | def __call__(self, sample): |
| 261 | image, landmarks = sample['image'], sample['landmarks'] |
| 262 | |
| 263 | h, w = image.shape[:2] |
| 264 | new_h, new_w = self.output_size |
| 265 | |
| 266 | top = np.random.randint(0, h - new_h + 1) |
| 267 | left = np.random.randint(0, w - new_w + 1) |
| 268 | |
| 269 | image = image[top: top + new_h, |
| 270 | left: left + new_w] |
| 271 | |
| 272 | landmarks = landmarks - [left, top] |
| 273 | |
| 274 | return {'image': image, 'landmarks': landmarks} |
| 275 | |
| 276 | |
| 277 | class ToTensor(object): |
nothing calls this directly
no outgoing calls
no test coverage detected