models icon indicating copy to clipboard operation
models copied to clipboard

cannot rerun training locally

Open Insertfunnylogin opened this issue 8 years ago • 8 comments

  • What is the top-level directory of the model you are using: /tensorflow/models/research
  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow):no, I'm using scripts from models/research/object_detection
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
  • TensorFlow installed from (source or binary): binary, by pip
  • TensorFlow version (use command below): 1.7
  • Bazel version (if compiling from source): n/a
  • CUDA/cuDNN version: 9.0/ 7.0
  • GPU model and memory: quadro m4000 8 gb
  • Exact command to reproduce:
python3 ./train.py         
--logtostderr         
--train_dir=/home/ik/models/research/raccoon_dataset-master/training/output_inference_graph.pb        
--pipeline_config_path=/home/ik/models/research/raccoon_dataset-master/training/ssd_mobilenet_v1_pets.config

Describe the problem

I ran the train script successfully once, then exported the model, then recalled that I missed evaluation, tried to run the eval script, and after that I was never able to run the training ever again Every time I'm trying I get the "no variables to save" error

Source code / logs

WARNING:tensorflow:From /home/ik/.local/lib/python3.5/site-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
WARNING:root:Variable [FeatureExtractor/MobilenetV1/Conv2d_0/BatchNorm/beta] is available in checkpoint, but has an incompatible shape with model variable.
WARNING:root:Variable [FeatureExtractor/MobilenetV1/Conv2d_0/BatchNorm/beta/ExponentialMovingAverage] is not available in checkpoint
WARNING:root:Variable [FeatureExtractor/MobilenetV1/Conv2d_0/BatchNorm/beta/RMSProp] is not available in checkpoint

##here's the long list of variables that also is not available in checkpoint or has incompatible shape, probably every single variable in the model

Traceback (most recent call last):
  File "./train.py", line 167, in <module>
    tf.app.run()
  File "/home/ik/.local/lib/python3.5/site-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "./train.py", line 163, in main
    worker_job_name, is_chief, FLAGS.train_dir)
  File "/home/ik/models/research/object_detection/trainer.py", line 352, in train
    init_saver = tf.train.Saver(available_var_map)
  File "/home/ik/.local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1311, in __init__
    self.build()
  File "/home/ik/.local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1320, in build
    self._build(self._filename, build_save=True, build_restore=True)
  File "/home/ik/.local/lib/python3.5/site-packages/tensorflow/python/training/saver.py", line 1345, in _build
    raise ValueError("No variables to save")
ValueError: No variables to save

PS I've seen the related topic on the stackoverflow, but it's about a custom code. I didn't write anything custom, so it was, most probably, my mistake. But I failed so far to figure out what went wrong and, most important, how to bring it back. Switching models has no effect (it may be important that the variable warnings always mention MobilenetV1 model regardless the actual model I'm trying to train)

Insertfunnylogin avatar Apr 23 '18 10:04 Insertfunnylogin

It is entirely possible that running eval overrode the training checkpoint; note that eval.py accepts different flags for the train dir and the eval dir. I'm afraid your best bet is probably to simply rerun your training.

robieta avatar Apr 23 '18 20:04 robieta

Hi Robieta

Yes, this is I thought that running eval.py overrode my checkpoint. However, rerunning fails every time I try, even after I deleted the whole folder and started from scratch with another model, so it looks like it doesn't depend on model or dataset/directories and to rerun doesn't help.

Here and here it said that the root cause may be that tf.graf was created not in the session and the fix is to put them in the same code block.

But I wrote no custom code, what I'm to do?

Insertfunnylogin avatar Apr 24 '18 04:04 Insertfunnylogin

That's... curious. Are you sure you're working from a completely clean set of folders? And this is the same training command that you successfully ran before?

robieta avatar Apr 24 '18 16:04 robieta

Curious indeed. Yes, I only kept the tfrecords, and tried to train mobilenetV1, V2, and inception models, changing configs respectively. Using the same command as per example in the script. All the same.

Today I tried also to run evaluation once again, to ensure that I got it done. Tomorrow morning I will add logs from the running, right now I only can say that it was not completely successful and didn't affect the basic problem.

Insertfunnylogin avatar Apr 24 '18 17:04 Insertfunnylogin

here's my evaluation command

python3 ./eval.py     
--logtostderr     
--pipeline_config_path=/home/ik/models/research/raccoon_dataset-master/training/ssd_mobilenet_v1_pets.config     
--checkpoint_dir=/home/ik/models/research/raccoon_dataset-master/training     
--eval_dir=/home/ik/models/research/raccoon_dataset-master/data

and logs eval logs.txt

Insertfunnylogin avatar Apr 25 '18 13:04 Insertfunnylogin

This seems like a config debugging issue rather than a bug in the repo code, so I'm going to redirect you to the TensorFlow Stack Overflow. Best of luck.

robieta avatar Apr 30 '18 17:04 robieta

@Insertfunnylogin Hey, i have the same issue. Did you fix it?

ss481 avatar Jul 25 '18 19:07 ss481

Hello. Yes, I think my mistake was that I didn't export the model under my installed version of Tensorflow. It says there, all the models in the zoo was saved under 1.5 and my current is 1.8 so no wonder it didn't work. If you're getting the same error, you should try to export your chosen model by running the respective script.

The next error (warning) is that it doesn't find some variables in the checkpoint, but it doesn't seem to stop the whole thing from working. Inb4 "from checkpoint = false" doesn't work for me.

25 июл. 2018 г. 22:52 пользователь "stefanstojanoski" < [email protected]> написал:

@Insertfunnylogin https://github.com/Insertfunnylogin Hey, i have the same issue. Did you fix it?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/tensorflow/models/issues/4057#issuecomment-407874240, or mute the thread https://github.com/notifications/unsubscribe-auth/Aj4MfPYhprtQoBoJSgw1iVHedudXITa8ks5uKMx1gaJpZM4Tfn0- .

Insertfunnylogin avatar Jul 25 '18 20:07 Insertfunnylogin