MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / __init__

Method __init__

diffsynth/data/simple_text_image.py:9–23  ·  view source on GitHub ↗
(self, dataset_path, steps_per_epoch=10000, height=1024, width=1024, center_crop=True, random_flip=False)

Source from the content-addressed store, hash-verified

7
8class TextImageDataset(torch.utils.data.Dataset):
9 def __init__(self, dataset_path, steps_per_epoch=10000, height=1024, width=1024, center_crop=True, random_flip=False):
10 self.steps_per_epoch = steps_per_epoch
11 metadata = pd.read_csv(os.path.join(dataset_path, "train/metadata.csv"))
12 self.path = [os.path.join(dataset_path, "train", file_name) for file_name in metadata["file_name"]]
13 self.text = metadata["text"].to_list()
14 self.height = height
15 self.width = width
16 self.image_processor = transforms.Compose(
17 [
18 transforms.CenterCrop((height, width)) if center_crop else transforms.RandomCrop((height, width)),
19 transforms.RandomHorizontalFlip() if random_flip else transforms.Lambda(lambda x: x),
20 transforms.ToTensor(),
21 transforms.Normalize([0.5], [0.5]),
22 ]
23 )
24
25
26 def __getitem__(self, index):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected