

Rescale=1./255, # we scale the colors down to 8 bit per channel In this example we use the Keras efficientNet on imagenet with custom labels. In keras this is achieved by utilizing the ImageDataGenerator class. GPU utilization in nvidia-smi Training with keras’ ImageDataGeneratorįirst let’s take a look at the code, where we use a dataframe to feed the network with data. If you are working on windows, don’t look trust the performance charts in the windows built-in task manager, they are not very accurate.

The GPU utilization translates direct to training time, more GPU utilization means more parallel execution, means more speed. The GPU-utilization shows how much your GPU is used and can be observed by either nvidia-smi in the command line or with GPU-Z. When training a neural net on the GPU the first thing to look at is the GPU Utilization.
Tensorflow custom data generator how to#
Finally, I will show how to build a TFRecord data set and use it in keras to achieve comparable results. I will show that it is not a problem of keras itself, but a problem of how the preprocessing works and a bug in older versions of keras-preprocessing. In this post I will show an example, where tensorflow is 10x times faster than keras. If you ever trained a CNN with keras on your GPU with a lot of images, you might have noticed that the performance is not as good as in tensorflow on comparable tasks.
