MCPcopy Create free account
hub / github.com/TPCD/DCCL / ImageNetBase

Class ImageNetBase

data/imagenet.py:11–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10
11class 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
27def subsample_dataset(dataset, idxs):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected