def train_transforms(example_batch): | |
images = [aug_transforms(x.convert("RGB")) for x in example_batch["image"]] | |
labels = [x for x in example_batch["annotation"]] | |
inputs = image_processor(images, labels) | |
return inputs | |
def val_transforms(example_batch): | |
images = [transforms(x.convert("RGB")) for x in example_batch["image"]] | |
labels = [x for x in example_batch["annotation"]] | |
inputs = image_processor(images, labels) | |
return inputs | |
To apply the preprocessing transformations over the entire dataset, use the 🤗 Datasets [~datasets.Dataset.set_transform] function. |