Skip to content

Instantly share code, notes, and snippets.

@paularamo
Last active May 12, 2023 17:49
Show Gist options
  • Save paularamo/46fdfe6bcfa27e5e027a7f4c3a0dc5bd to your computer and use it in GitHub Desktop.
Save paularamo/46fdfe6bcfa27e5e027a7f4c3a0dc5bd to your computer and use it in GitHub Desktop.
from anomalib.data.folder import Folder
from anomalib.data.task_type import TaskType
datamodule = Folder(
root=Path.cwd() / "cubes",
normal_dir="normal",
abnormal_dir="abnormal",
normal_split_ratio=0.2,
image_size=(256, 256),
train_batch_size=32,
eval_batch_size=32,
task=TaskType.CLASSIFICATION,
)
datamodule.setup() # Split the data to train/val/test/prediction sets.
datamodule.prepare_data() # Create train/val/test/predic dataloaders
i, data = next(enumerate(datamodule.val_dataloader()))
print(data.keys())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment