naturomics / CapsNet-Tensorflow

A Tensorflow implementation of CapsNet(Capsules Net) in paper Dynamic Routing Between Capsules

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot evaluate the model when using python main --is_training=False

kumarlamichhane opened this issue · comments

commented

Evaluating/Testing the trained model using python main.py --is_training=False gives the following error
ValueError: Can't load save_path when it is None.

Can you describe it in more detail? I don't use any variable save_path in my code. Did you modify something else? Evaluation/Testing function is OK in my computer.

commented

Have you already run training on the MNIST dataset or downloaded a pre-trained model?

If you run python main.py, it will begin training and save a model every cfg.save_freq epochs (by default 3 as per config.py) and save it into cfg.logdir

A complete logdir folder should contain a file named checkpoint and multiple model_epoch_###_step_## files such as those found in naturomics' Baidu folder ( for which the password can be found on the front github README page, just below the results)

If those files are not in there, you would get an error similar to the one you described.

commented

I trained my model and it returned me all the losses, val_acc, train_acc..
but then when i run the test by using python main.py --is_training=False or change the is_training to false in config file.... i will get an error

File "main.py", line 137, in <module> tf.app.run() File "/home/xplorer/anaconda3/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 132, in main evaluation(model, sv, num_label) File "main.py", line 97, in evaluation supervisor.saver.restore(sess, tf.train.latest_checkpoint(cfg.logdir)) File "/home/xplorer/anaconda3/lib/python3.6/site-packages/tensorflow/python/training/saver.py", line 1557, in restore raise ValueError("Can't load save_path when it is None.") ValueError: Can't load save_path when it is None.
however i have events.out.tfevents.1515508371.machinename files and a graph.pbtxt in cfg.logdir.
Any help would be appreciated.
thank you in advance

commented

Apologies.. for disturbing u good people..
The error was due to not saving the models when required.
the error was due to running the training for 1 epoch and saving the models after 3 epochs.

cfg.save_freq=3 and
cfg.epoch=1 gave me the error

doing

cfg.save_freq=3 and
cfg.epoch=1

solved the problem

I really appreciate your help.