I recently upgraded my Colab instance to TensorFlow 2.0 and have attempted to train a Sequential Classification model on a batch of PNG images. I have used the !tf_upgrade_v2
command listed on tensorflow.org to upgrade the script from TensorFlow 1.14 to 2.0 format.
When I attempt to train the model using model.fit_generator
code below I get a re-occurring non-fatal UserWarning line after line as the model runs through each epoch.
# Train the model
history = model.fit_generator(
train_generator,
steps_per_epoch=nb_train_samples // batch_size,
epochs=epochs,
validation_data=validation_generator,
validation_steps=nb_validation_samples // batch_size)
An example of the warning is:
1/449 [..............................] - ETA: 12:04 - loss: 3.0403 - accuracy: 0.1250
/usr/local/lib/python3.6/dist-packages/PIL/Image.py:914: UserWarning: Palette images
with Transparency expressed in bytes should be converted to RGBA images to RGBA
images')
This warning did not appear when using TensorFlow 1.14 when trained on the same batch of PNG images. The TF2.0 model does continue to train, however it is slowing the training process significantly as it keeps printing to the warning.
I have gone back to the dataset and tried converting the PNGs ensuring that they are in RGB format not RGBA using the example listed here however this has failed to resolve the problem.