reid-strong-baseline
reid-strong-baseline copied to clipboard
more conciser sampler
https://github.com/michuanhaohao/reid-strong-baseline/blob/master/data/samplers/triplet_sampler.py
batch_idxs = []
for idx in idxs:
batch_idxs.append(idx)
if len(batch_idxs) == self.num_instances:
batch_idxs_dict[pid].append(batch_idxs)
batch_idxs = []
can be replaced with
batch_idxs_dict[label] = [idxs[i*self.num_instances : (i+1)*self.num_instances] for i in range(len(idxs)//self.num_instances)]
which is more concise and easier to understand!
Thank you very much. If you have check the code, you can commit a PR and become a contributor for this project.
batch_idxs = batch_idxs_dict[pid].pop(0)
IndexError: pop from empty list