MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / list_collate

Function list_collate

yolox/data/dataloading.py:164–178  ·  view source on GitHub ↗

Function that collates lists or tuples together into one list (of lists/tuples). Use this as the collate function in a Dataloader, if you want to have a list of items as an output, as opposed to tensors (eg. Brambox.boxes).

(batch)

Source from the content-addressed store, hash-verified

162
163
164def list_collate(batch):
165 """
166 Function that collates lists or tuples together into one list (of lists/tuples).
167 Use this as the collate function in a Dataloader, if you want to have a list of
168 items as an output, as opposed to tensors (eg. Brambox.boxes).
169 """
170 items = list(zip(*batch))
171
172 for i in range(len(items)):
173 if isinstance(items[i][0], (list, tuple)):
174 items[i] = list(items[i])
175 else:
176 items[i] = default_collate(items[i])
177
178 return items

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected