Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error loading model using downloaded files #29

Closed
DGM1193 opened this issue Jun 12, 2019 · 4 comments
Closed

Error loading model using downloaded files #29

DGM1193 opened this issue Jun 12, 2019 · 4 comments

Comments

@DGM1193
Copy link

DGM1193 commented Jun 12, 2019

Thanks for sharing your work ! Looks very neat .

I am trying to load the model provided and test it on my images. I get this error when running the eval.py script.
"InvalidArgumentError (see above for traceback): 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:

Cannot assign a device for operation model_0/split: ...."

Could you please let me know what the issue is?

@liuheng92
Copy link
Owner

the graph from the checkpoint is as same as the graph from the code. I am sure about it. Maybe you can check your setting and running environment

@DGM1193
Copy link
Author

DGM1193 commented Jun 13, 2019

Thanks for the quick reply ! I solved the previous error I had, and I get this error now :

line 171, in main
model_path =os.path.join(FLAGS.checkpoint_path,os.path.basename(ckpt_state.model_checkpoint_path))
AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'

@liuheng92
Copy link
Owner

create a checkpoint file yourself

@DGM1193
Copy link
Author

DGM1193 commented Jun 17, 2019

I solved this issue by replacing lines 169 to 173 in eval.py which is :

with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess:
        ckpt_state = tf.train.get_checkpoint_state(FLAGS.checkpoint_path)
        model_path = os.path.join(FLAGS.checkpoint_path,os.path.basename(ckpt_state.model_checkpoint_path))
        logger.info('Restore from {}'.format(model_path))
        saver.restore(sess, model_path)

with the following lines of code:

with tf.Session(config=tf.ConfigProto(allow_soft_placement=True)) as sess:
    saver = tf.train.Saver()
    saver.restore(sess, model_path)    # path to checkpoint file - I gave this as "~/checkpoint/model.ckpt "even though I did not have a checkpoint file. the directory "~/checkpoint/" consists of the 3 files which can be downloaded from this repo, thanks to @liuheng92 .

and using tensorflow version 1.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants