models icon indicating copy to clipboard operation
models copied to clipboard

Save checkpoints .ckpt less frequently Object Detection API

Open AdrianSalvador opened this issue 8 years ago • 9 comments

Hi, I am using the object detection API with my own dataset, I trained succesfully the faster_rcnn_inception_v2, but i want to save the checkponts .ckpt less frequently. Actually the model saves the 5 last, with a frequency of 5 minutes. I want to save checkpoints with a frequency of 1 hour for example.

Thanks for your attention.

AdrianSalvador avatar Jun 26 '18 16:06 AdrianSalvador

Thank you for your post. We noticed you have not filled out the following field in the issue template. Could you update them if they are relevant in your case, or leave them as N/A? Thanks. What is the top-level directory of the model you are using Have I written custom code OS Platform and Distribution TensorFlow installed from TensorFlow version Bazel version CUDA/cuDNN version GPU model and memory Exact command to reproduce

tensorflowbutler avatar Jun 27 '18 01:06 tensorflowbutler

Consider setting the eval_interval_secs field in the eval proto to 3600 for a one hour eval period.

derekjchow avatar Jun 27 '18 18:06 derekjchow

Thanks @derekjchow for the quick reply.

qlzh727 avatar Jun 28 '18 15:06 qlzh727

@derekjchow Thanks for the answer, but I tried and doesn't work. The model always saves the .ckpt files with a frequency of 10 minutes. I saw the train.proto too, and I have not seen nothing related with the .ckpt checkpoint savings during the trainning. I want to save checkpoints with a frequency of 1 hour

AdrianSalvador avatar Jul 19 '18 16:07 AdrianSalvador

@AdrianSalvador Hi, I am having the same problem. Any solutions?

joydeepmedhi avatar Jul 25 '18 12:07 joydeepmedhi

@joydeepmedhi I found the solution! In trainer.py,if you are using the slim based. If you want to change the number of .ckpt model to keep yo must change the line 370 to: saver = tf.train.Saver( keep_checkpoint_every_n_hours=keep_checkpoint_every_n_hours, max_to_keep=10) In this case you will preserve the 10 last .ckpt

If you want to change the frequency of the .ckpt you must add inside of the slim.learning.train (line 397) save_interval_secs=X

where X is the frequency in seconds

AdrianSalvador avatar Jul 25 '18 13:07 AdrianSalvador

hi, I'd like to know if there is any ohter way to save ckpt in a regular time? I also want to know how to save ckpt in a regular step in the api code? Anyone could help?

swg209 avatar Aug 31 '18 09:08 swg209

@derekjchow I think eval_interval_secs does not influence the frequency of SAVING the checkpoints, which, does not answer the issue. Regardless, the model is saved around every 10 minutes. Also, flag keep_checkpoint_every_n_hours DO NOT work. Changing its value does not change the frequency to save the checkpoints.

Any ideas to how to save the checkpoints less frequently? Cause current object detection api has an issue of memory leak, which is possibly caused by saving checkpoints. Please refer to https://github.com/tensorflow/models/issues/5139 for more details about memory leak.

liuchang8am avatar Sep 06 '18 04:09 liuchang8am

I think I've figured out how to adjust the frequency of saving checkpoint and evaluation. explaind here https://github.com/tensorflow/models/issues/5139#issuecomment-418963839

bleqdyce avatar Sep 06 '18 05:09 bleqdyce