Minor multiplatform issue in Lesson1

Since I am running the course notebooks from Windows I have noticed a minor bug in the data loading examples at the end of lesson 1 (and hence in the docs): when defining the label function in ImageDataBunch.from_name_func, you are using the path separator for Linux systems (’/’), but in order to be more generic you should use the os.path.sep character. So I modified the sample like this:

data = ImageDataBunch.from_name_func(path, fn_paths, ds_tfms=tfms, size=24,
label_func = lambda x: ‘3’ if ‘{sep}3{sep}’.format(sep=os.path.sep) in str(x) else ‘7’)

and it is now working pretty well (returning both ‘3’ and ‘7’ classes, while the original version was returning only ‘7’).

The same of course goes for the ImageDataBunch.from_lists sample below. When defining the labels, I fixed it like this:

labels = [(‘3’ if ‘{sep}3{sep}’.format(sep=os.path.sep) in str(x) else ‘7’) for x in fn_paths]

Since there are a few others taking the course from Windows, I thought I’d share this little finding.