CustomMaskWarning when using Keras OxfordPets code

Viewed 5580

I'm on a project that is taking the Oxford Pets code https://keras.io/examples/vision/oxford_pets_image_segmentation/ and modifying it various ways. We're getting the following warning (when running on Google Colab), and it turns out that the original Oxford Pets code gets that too (also on Google Colab). Is there a way to change the code to not cause the warning?

Here is the warning we get when saving and training the model:

/usr/local/lib/python3.7/dist-packages/tensorflow/python/keras/utils/generic_utils.py:497: CustomMaskWarning: Custom mask layers require a config and must override get_config. When loading, the custom mask layer must be passed to the custom_objects argument. category=CustomMaskWarning)

1 Answers

As mentioned by @Henrique Mendonça, This warning appears when we use Resnet model on Tfv2.5.

These warnings will not hamper your code execution, still you can suppress these warnings using following code

import logging, os
logging.disable(logging.WARNING)
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
Related