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

Method __init__

project_utils/sampler.py:110–127  ·  view source on GitHub ↗
(self, data_source, num_instances=4)

Source from the content-addressed store, hash-verified

108
109class RandomMultipleGallerySamplerNoCam(Sampler):
110 def __init__(self, data_source, num_instances=4):
111 super().__init__(data_source)
112
113 self.data_source = data_source
114 self.index_pid = defaultdict(int)
115 self.pid_index = defaultdict(list)
116 self.num_instances = num_instances
117
118 for index, _item in enumerate(data_source):
119 pid = _item[1]
120 # (_, pid, cam)
121 if pid < 0:
122 continue
123 self.index_pid[index] = pid
124 self.pid_index[pid].append(index)
125
126 self.pids = list(self.pid_index.keys())
127 self.num_samples = len(self.pids)
128
129 def __len__(self):
130 return self.num_samples * self.num_instances

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected