| 9 | |
| 10 | |
| 11 | class ImageNetBase(torchvision.datasets.ImageFolder): |
| 12 | |
| 13 | def __init__(self, root, transform): |
| 14 | |
| 15 | super(ImageNetBase, self).__init__(root, transform) |
| 16 | |
| 17 | self.uq_idxs = np.array(range(len(self))) |
| 18 | |
| 19 | def __getitem__(self, item): |
| 20 | |
| 21 | img, label = super().__getitem__(item) |
| 22 | uq_idx = self.uq_idxs[item] |
| 23 | |
| 24 | return img, label, uq_idx |
| 25 | |
| 26 | |
| 27 | def subsample_dataset(dataset, idxs): |
no outgoing calls
no test coverage detected