Open DavidHidde opened 1 month ago
Updated my online dataset generator to use keras.Sequential data augmentation instead of the removed ImageDataGenerator.
Are you using tf.data
? That's what you want to use to see good performance with TF.
You also want to make sure that you're using the GPU on your machine.
Hi,
Currently the code uses custom generators, but when I rewrite it to use tf.data.Dataset
the performance stays the same. In terms of CPU/GPU usage, my system does not show any major differences:
Keras 3 legacy mode:
Keras 3:
Any updates on this?
I've been working on upgrading my Keras 2 code to just work with Keras 3 without going fully back-end agnostic. However, while everything works fine after resolving compatibility, my training speed has severely degraded by maybe even a factor 10. I've changed the following to get Keras 3 working:
tensorflow.keras
tokeras
calls.export
function andweights.h5
format.keras.Callback
instead of the oldBaseLogger
.@keras.saving.register_keras_serializable()
to custom metric and loss functions.keras.Sequential
data augmentation instead of the removedImageDataGenerator
.max_queue_size
kwarg from themodel.fit
andmodel.predict
calls since it has been removed.In terms of hardware/packages, I'm using Python 3.11.10, keras 3.5.0 and Tensorflow 2.16.2 on a Macbook Pro M2. I've also noticed that my GPU and CPU usage is much higher while running the newer version. I've confirmed using
git stash
that specifically the changes mentioned above are causing the performance degradation. My suspicion is that the Apple hardware is somehow resulting in worse performance, but I've yet to confirm it using a regular x86 machine.