tensorflow / tensorflow/models

research/slim: mismatch of classes of VGG models and checkpoints

Open
#7,151 2 comments 0 reactions 2 assignees View on GitHub

@marksandler2 is already working on this.

Since Jun 19, 2020.

models:research
Dominant language
Python
Stars
77.7k
Forks
44.8k
PR merge metrics
No merged PRs in 30d

Description

It seems that there is a mismatch of the number of classes between the VGG models and the corresponding savepoints.

When trying to restore the savepoint using tf.train.Saver I get the following error:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:

Assign requires shapes of both tensors to match. lhs shape= [1001] rhs shape= [1000]
         [[node save/Assign_36 (defined at export_inference_graph.py:161) ]]

Errors may have originated from an input operation.
Input Source operations connected to node save/Assign_36:
 vgg_19/fc8/biases

It seems that this problem also exists with VGG16: https://stackoverflow.com/questions/40350539/tfslim-problems-loading-saved-checkpoint-for-vgg16

I downloaded the checkpoint from the pre-trained models given at tensorflow/models/research/slim and the model is loaded the same way as export_inference_graph.py does it.

Expected behaviour would be that I can just load the checkpoint for the model and that the number of classes match.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.