From 90ca844a9f4cf38a1dd353e65279436d24d8632e Mon Sep 17 00:00:00 2001 From: KaiyangZhou Date: Wed, 25 Jul 2018 22:53:50 +0100 Subject: [PATCH] rm deprecated code --- samplers.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/samplers.py b/samplers.py index 591fd4b..8740622 100644 --- a/samplers.py +++ b/samplers.py @@ -10,33 +10,6 @@ import torch from torch.utils.data.sampler import Sampler -""" Deprecated -class RandomIdentitySampler(Sampler): - def __init__(self, data_source, num_instances=4): - self.data_source = data_source - self.num_instances = num_instances - self.index_dic = defaultdict(list) - for index, (_, pid, _) in enumerate(data_source): - self.index_dic[pid].append(index) - self.pids = list(self.index_dic.keys()) - self.num_identities = len(self.pids) - - def __iter__(self): - indices = torch.randperm(self.num_identities) - ret = [] - for i in indices: - pid = self.pids[i] - t = self.index_dic[pid] - replace = False if len(t) >= self.num_instances else True - t = np.random.choice(t, size=self.num_instances, replace=replace) - ret.extend(t) - return iter(ret) - - def __len__(self): - return self.num_identities * self.num_instances -""" - - class RandomIdentitySampler(Sampler): """ Randomly sample N identities, then for each identity,