Lightning-Universe / lightning-flash

Your PyTorch AI Factory - Flash enables you to easily configure and run complex AI recipes for over 15 tasks across 7 data domains
https://lightning-flash.readthedocs.io
Apache License 2.0
1.74k stars 212 forks source link

Error in train_folder from ImageClassificationData.from_folders #182

Closed edgarriba closed 3 years ago

edgarriba commented 3 years ago

🐛 Bug

I'm using the branch datapipeline_poc_1 with the following snippet to load a dataset and I got an error related to how the paths are specified.

    data = ImageClassificationData.from_folders(
        #train_folder=os.path.join(root, 'train'),  # CRASHES in the assert below
        train_folder=os.path.join(root),
        train_transform = train_transform,
    )
    assert data._train_dataloader() is not None

The error is the following: ValueError: num_samples should be a positive integer value, but got num_samples=0


My data tree in root is the following: image

The loader is only able to fetch the data when the path passed to train_folder points to root instead of train.

In my opinion there's should be a mechanism that checks on a well formed or expected data tree.

edgarriba commented 3 years ago

linked to https://github.com/PyTorchLightning/lightning-flash/pull/205