A collection of some code I find useful

fp = Path("./Data")

failed = verify_images(get_image_files(fp))
failed.map(fp.unlink)

dblock = DataBlock(
    blocks=(ImageBlock, CategoryBlock), 
    get_items=get_image_files, 
    get_y=parent_label,
    splitter=RandomSplitter(valid_pct=0.25),
    item_tfms=[Resize(192, method="squish")]
).dataloaders(fp)

After processing a set of unsorted images with this ipynb. This block of code will load the output into a datablock in fastai, handling train/valid split and formatting the images with item_tfms.