MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / collate_fn_train

Function collate_fn_train

train_diff.py:248–263  ·  view source on GitHub ↗
(examples)

Source from the content-addressed store, hash-verified

246 )
247
248 def collate_fn_train(examples):
249 pixel_values = torch.stack([example["image"] for example in examples]).float()
250 masks = torch.stack([example["mask"] for example in examples]).float()
251 masked_images = torch.stack([example["masked_image"] for example in examples]).float()
252 ttf_imgs = torch.stack([example["ttf_img"] for example in examples]).float()
253 glyphs = torch.stack([example["glyph"] for example in examples]).float()
254
255 batch = {
256 "pixel_values": pixel_values,
257 "masks": masks,
258 "masked_images": masked_images,
259 "ttf_images": ttf_imgs,
260 "glyphs": glyphs
261 }
262
263 return batch
264
265 datasets_st = AnyWordLmdbDataset(
266 lmdb_path=cfgs.lmdb_path,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected