9aa1aa24c0eaafb95f3a0a580de9df38e803e039,torchreid/samplers.py,RandomIdentitySampler,__iter__,#RandomIdentitySampler#,40
Before Change
self.length += num - num % self.num_instances
def __iter__(self):
list_container = []
for pid in self.pids:
idxs = copy.deepcopy(self.index_dic[pid])
if len(idxs) < self.num_instances:
idxs = np.random.choice(idxs, size=self.num_instances, replace=True)
random.shuffle(idxs)
batch_idxs = []
for idx in idxs:
batch_idxs.append(idx)
if len(batch_idxs) == self.num_instances:
list_container.append(batch_idxs)
batch_idxs = []
random.shuffle(list_container)
ret = []
for batch_idxs in list_container:
ret.extend(batch_idxs)
return iter(ret)
def __len__(self):
return self.length
After Change
final_idxs = []
while len(avai_pids) >= self.num_pids_per_batch:
selected_pids = random.sample(avai_pids, self.num_pids_per_batch)
for pid in selected_pids:
batch_idxs = batch_idxs_dict[pid].pop(0)
final_idxs.extend(batch_idxs)
if len(batch_idxs_dict[pid]) == 0:
avai_pids.remove(pid)
return iter(final_idxs)
def __len__(self):
return self.length
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 6
Instances
Project Name: KaiyangZhou/deep-person-reid
Commit Name: 9aa1aa24c0eaafb95f3a0a580de9df38e803e039
Time: 2018-08-16
Author: k.zhou@qmul.ac.uk
File Name: torchreid/samplers.py
Class Name: RandomIdentitySampler
Method Name: __iter__
Project Name: CyberReboot/poseidon
Commit Name: 540ebb0f62c459e8c3a525ef6e2c81a52250f164
Time: 2019-09-04
Author: clewis@iqt.org
File Name: poseidon/controllers/faucet/parser.py
Class Name: Parser
Method Name: config
Project Name: KaiyangZhou/deep-person-reid
Commit Name: 9aa1aa24c0eaafb95f3a0a580de9df38e803e039
Time: 2018-08-16
Author: k.zhou@qmul.ac.uk
File Name: torchreid/samplers.py
Class Name: RandomIdentitySampler
Method Name: __iter__
Project Name: SpiNNakerManchester/sPyNNaker
Commit Name: 73162ce7ca689cd10f67b823f54d3fbf81e8ee91
Time: 2021-02-25
Author: donal.k.fellows@manchester.ac.uk
File Name: doc/source/conf.py
Class Name:
Method Name: