course-v3 icon indicating copy to clipboard operation
course-v3 copied to clipboard

label_from_folder can't handle different directories

Open TJ-C opened this issue 4 years ago • 0 comments

I was running Lesson 7 in a Kaggle notebook. My Images were in: /kaggle/input/the-oxfordiiit-pet-dataset/images My generated images were in: /kaggle/working/image_gen

When I came to run the following it only shows the images and not the generated images:

print(path)
/kaggle/input/the-oxfordiiit-pet-dataset

def get_crit_data(classes, bs, size):
    src = ImageList.from_folder(path, include=classes).split_by_rand_pct(0.1, seed=42)
    ll = src.label_from_folder(classes=classes)
    data = (ll.transform(get_transforms(max_zoom=2.), size=size)
           .databunch(bs=bs).normalize(imagenet_stats))
    data.c = 3
    return data

data_crit = get_crit_data([name_gen, 'images'], bs=bs, size=size)

So it appears the label function cannot traverse different directories, or is unable to except dir paths in the folder string, e.g. '/kaggle/output/working/image_gen'

TJ-C avatar May 21 '20 15:05 TJ-C