Using a custom test dataset on ImageDataBunch.from_name_re

Hi.

I want to use the following piece of code:

data = ImageDataBunch.from_name_re(image_path, food_names, file_parse, ds_tfms=get_transforms(), size=224)

However, I have a custom dataset that I’d like to use. This code creates a validation set from the training set but I don’t know how to incorporate my dataset as well. This is the full code. It is the same from the lecture videos.

train_image_path = Path('Food-101/images')
test_image_path = Path('Food-101/test')
food_names = get_image_files(image_path)
file_parse = r'/([^/]+)_\d+\.(png|jpg|jpeg)$'

data = ImageDataBunch.from_name_re(image_path, food_names, file_parse, ds_tfms=get_transforms(), size=224)
data.normalize(imagenet_stats)

learn = cnn_learner(data, models.resnet34, metrics=error_rate)
learn.fit_one_cycle(10)