New fastai 1.0.15 update - How to use tfms, imagenet_norm?

Previous versions of fastai would pass “tfms=imagenet_norm” to image_data_from_folder():

data = image_data_from_folder(*other_args, tfms=imagenet_norm)

From what I understand, this normalizes the data based on the Imagenet statistics.

But now in the latest version it appears that the equivalent function ImageDataBunch.from_folder() does not accept any tfms argument even though it is supposed to accept the kwargs from .create() which does in fact include a kwarg called tfms=None.

How is this supposed to be properly done in the latest fastai (1.0.15)? I tried eliminating the tfms kwarg and instead did:

data = ImageDataBunch.from_folder(*other_args)

Is this correct? Or is there something missing?

1 Like

That the new way and it’s correct, yes.

In the latest version you can say:

data = ImageDataBunch.from_folder(*other_args).normalize(imagenet_stats)

(this may require master - can’t remember)