Closed sayakpaul closed 4 years ago
Thanks for bringing this up. In short, please change the dictionary key of input images from "image"
to EXTRACTOR.input_names[0]
or base_adv_model.input_names[0]
. The reason is as follows:
Recently TensorFlow made a change on handling dictionary-format input when a model is called directly (e.g. model(input_dict)
). Before the change, the input_dict
is flattened to a list (ordered by keys) and fed to tensors in model.inputs
. After the change, the input_dict
is looked up based on model.input_names
. For tf.keras.applications.MobileNetV2
, its input_names
is generated automatically and different from our hand-chosen name like "image"
. The mismatch is fine in previous versions of TensorFlow because the names are ignored, but is causing KeyError
as you saw in the latest version of TensorFlow. To overcome this issue, please use the generated input name as the dictionary key.
I see. I will try it out and will get back but that may not be timely, apologies for that.
Hi
I am primarily trying to train an adversarial variant of a custom image classifier. The code works perfectly fine when I am on TensorFlow 2.1.0, 2.2.0-rc2. But the same code breaks on TensorFlow 2.2.0-rc3 producing:
Here's the Colab Gist that produces this issue. Here's the Colab Notebook that shows that the code works for TensorFlow 2.2.0-rc2.