| 207 | return self.coco.loadAnns(ann_ids) |
| 208 | |
| 209 | def __repr__(self): |
| 210 | fmt_str = 'Dataset ' + self.__class__.__name__ + '\n' |
| 211 | fmt_str += ' Number of datapoints: {}\n'.format(self.__len__()) |
| 212 | fmt_str += ' Root Location: {}\n'.format(self.root) |
| 213 | tmp = ' Transforms (if any): ' |
| 214 | fmt_str += '{0}{1}\n'.format(tmp, self.transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) |
| 215 | tmp = ' Target Transforms (if any): ' |
| 216 | fmt_str += '{0}{1}'.format(tmp, self.target_transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) |
| 217 | return fmt_str |
| 218 | |
| 219 | def enforce_size(img, targets, masks, num_crowds, new_w, new_h): |
| 220 | """ Ensures that the image is the given size without distorting aspect ratio. """ |