Coder Social home page Coder Social logo

Comments (5)

ChrisDal avatar ChrisDal commented on May 23, 2024 1

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.

from tffrcnn.

rgsachin avatar rgsachin commented on May 23, 2024

Thanks @ChrisDal , I believe the trio files format introduced as part of the new saver of Tensorflow - tf.train.SaverDef.V2 which is defaulted now.
Ideal below is recommended way to read the new saver files, below code in demo.py should fix, but
saver = tf.train.import_meta_graph(args.model+'.meta') saver.restore(sess, args.model)
But I ran into some other issues. what seem to solve it forcing the saver to V1 format in train.py
self.saver = tf.train.Saver(max_to_keep=100,write_version=tf.train.SaverDef.V1)

from tffrcnn.

zyclarkcheng avatar zyclarkcheng commented on May 23, 2024

thanks @rgsachin.
hello, did you mean modify self.saver = tf.train.Saver(max_to_keep=100) in train.py to self.saver = tf.train.Saver(max_to_keep=100,write_version=tf.train.SaverDef.V1) ?
In this way how should I restore the result file?(I am now training the kitti and waiting for the result file )

from tffrcnn.

zyclarkcheng avatar zyclarkcheng commented on May 23, 2024

Thanks for @CharlesShang your work.
I have trained KITTI dataset and get ckpt.meta, ckpt.index files, and I switch to CLASSES = ('background','person','bike','motorbike','car','bus') in demo.py, and import the meta graph
saver = tf.train.import_meta_graph(model) .
BUT I still can not test demo images, so I change self.saver = tf.train.Saver(max_to_keep=100) in train.py to self.saver = tf.train.Saver(max_to_keep=100,write_version=tf.train.SaverDef.V1) based on @rgsachin , after training again yielding real ckpt file, I fail to run demo again...
Could you give me some suggestions ? thanks

from tffrcnn.

chrenlily avatar chrenlily commented on May 23, 2024

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

from tffrcnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.