I am trying to instanciate a model (ResNet50) from the tensorflow model garden, and then load checkpointed weights from the github repo directly.
The load from the checkpoint doesn’t work, with the following error :
AssertionError: Found 269 Python objects that were not bound to checkpointed values, likely due to changes in the Python program.
I have created the ResNet50 model from the model garden directly by creating the backbone, then the ClassificationModel containing the backbone.
resnet = tfm.vision.backbones.ResNet(50, input_specs=keras.layers.InputSpec(shape=[None, 224, 224, 3]))
model = tfm.vision.classification_model.ClassificationModel(backbone=resnet, num_classes=1000, input_specs=keras.layers.InputSpec(shape=[None, 224, 224, 3]))
optim = keras.optimizers.SGD(0.001)
loss = keras.losses.SparseCategoricalCrossentropy()
model.compile(optim, loss, metrics=[tf.metrics.SparseCategoricalAccuracy()])
Then, I load the model checkpoint from https://github.com/tensorflow/models/blob/master/official/vision/MODEL_GARDEN.md, using the following :
status = model.load_weights("/home/tleberre/ssd/models/ckpt-62400")
status.assert_consumed()
This returns the error detailed above, and loads nothing into the model. It seems that the checkpoint weights and the model weights are mismatched. What did I do wrong ?
Lamakaio is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.