question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ckpt file for demo.py after training

See original GitHub issue

After running training, ie python ./faster_rcnn/train_net.py --gpu 0 --weights ./data/pretrain_model/VGG_imagenet.npy --imdb voc_2007_trainval --iters 70000 --cfg ./experiments/cfgs/faster_rcnn_end2end.yml --network VGGnet_train --set EXP_DIR exp_dir The last line in log prints Wrote snapshot to: /xxxx/VGGnet_fast_rcnn_iter_70000.ckpt done solving But I see three files VGGnet_fast_rcnn_iter_70000.ckpt.data-00000-of-00001 VGGnet_fast_rcnn_iter_70000.ckpt.index VGGnet_fast_rcnn_iter_70000.ckpt.meta I then trying to run demo. none of them works with python ./faster_rcnn/demo.py --model model_path how can i get single ckpt file similar to the one that can downloaded (https://github.com/CharlesShang/TFFRCNN#download-list) VGGnet_fast_rcnn_iter_150000.ckpt as per the instructions in readme ?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ChrisDalcommented, Apr 14, 2017

In fact, the files correspond to :

  • VGGnet_fast_rcnn_iter_70000.ckpt.data-00000-of-00001 : data itself (weigths and all)
  • VGGnet_fast_rcnn_iter_70000.ckpt.index : (I actually have no idea haha)
  • VGGnet_fast_rcnn_iter_70000.ckpt.meta : the graph definition and all metadata associated

Tensorflow can restore the model from a trio of model.ckpt.index , model.ckpt.meta, model.ckpt.data with for example here args.model = model.ckpt :

saver = tf.train.Saver() saver.restore(sess, args.model)

But to run the demo from this training, you have to change the condition on the existence of the model which is either on the model.ckpt file (that may not exist), either on the model.ckpt.xxxx file(s) (where you can’t restore the session). Theses lines test if the user gave a model.ckpt.xxxx file and then give to the saver the right model.ckpt.

if not os.path.splitext(args.model)[1] == 'ckpt':
    model_path = args.model
    args.model = os.path.splitext(args.model)[0] 

   
if args.model == ' ' or not os.path.exists(model_path):
    print ('current path is ' + os.path.abspath(__file__))
    raise IOError(('Error: Model not found.\n'))

You can add it/replace in the demo.py , just after the parsing of the args. Then give the path to an existing model file e.g :

python ./faster_rcnn/demo.py --model dir_model_path/model.ckpt.meta

A link to an article which explain how the data that is saved [1] . That’s just a little solution, I am not a python expert neither a tensorflow expert.

0reactions
chrenlilycommented, Apr 26, 2019

@zyclarkcheng Did you solve the problem?could you help me ?I got the same problem

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inference and train with existing models and standard datasets
By inference, we mean using trained models to detect objects on images. ... It is recommended to download the checkpoint file to checkpoints...
Read more >
How to save/restore a model after training? - Stack Overflow
I have got a similar question on how to convert a single .ckpt file to two .index and .data file (say for pre-trained...
Read more >
Understanding Detectron2 demo and examples
Note that in fact we are loading a checkpoint file — in fact neural network training is never “finished” and the model may...
Read more >
Demos-(Optional) Model Size Reduction-Model Preparation-App ...
Demos : Demos Caffe Quant_INT8-8 Quantization in Non-Training Mode … ... Save the model definition file (.py) and model parameter file of the...
Read more >
Use Checkpoints in Amazon SageMaker - AWS Documentation
Browse Checkpoint Files · In the left navigation pane, choose Training jobs. · Choose the link to the training job with checkpointing enabled...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found