Normalization using keras.layers.experimental.preprocessing - exceptionally slow

Curious to know whether others have same experience as me when using Keras experimental preprocessing layers. I am finding the ‘adapt’ method take an unusually long time to sweep the entire dataset and calculate state information (eg mean and variance).

I create my dataset like so:
ds =
filenames = data_files, …

Then I simply create the preprocessing layer (outside the model)
layer_norm = tensorflow.keras.layers.experimental.preprocessing.Normalization(axis=-1)

The adapt process takes well over a 90 seconds working on a 25 MB file.

Admittedly, my machine isnt high spec, and i and pulling the data files from a remote server. But even still, this feels very slow.

1 Like

Same here. I am using a TFRecordDataset stored remotely, and the processing times are along the lines of what you mention.