(examples)
| 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, |
nothing calls this directly
no outgoing calls
no test coverage detected