[D] Keras vs tensorflow: Performance, GPU utilization and data pipeline
I was recently dealing with some performance issues related to the keras image preprocessing. After several experiments, I thought it would might be helpful to share my insights. There are several possible fixes:
- update all packages, especially keras-preprocessing.
- Deactivate your virus scanner (whitelist your data folder) and check if you have an internal SSD.
- Try to tweak the configuration on fit_generator (workers and queue_size). If you are using linux try out multiprocessing and a thread-safe generator.
- Convert your dataset to TFrecords and use it with keras or directly move to tensorflow. If you already using tensorflow 2.0, you can directly fit keras models on TFRecord datasets.
Furthermore the tensorflow implementaion was always (slightly) faster.