I am using object detection in tensorflow api. In my previous work I used to check the current step and save my model every n steps, something like the approach mentioned here.
In this case though the authors use TensorFlow-Slim to perform the training. So, they use a tf.train.Saver
which is passed to the actual function which performs the training: slim.learning.train()
. While this function has some parameters regarding the interval for writing down the training model using the parameter save_interval_secs
it is time dependent and not step dependent.
So, since tf.train.Saver
is a "passive" utility as mentioned here and just saves a model with the provided parameters, meaning is ignorant of any time or step notions, and also in object detection code the control is passed in TensorFlow-Slim, by passing the saver as a parameter, in this case how can I achieve to save my model step-ward (every n steps instead of every x seconds)?
The only solution is to dig into slim code and edit it (with all risks coming from this)? Or is there another option I am not familiar with?
P.S.1
I found out there is a astonishingly similar question about this option here but unfortunately it did not have any answers. So, since my problem persists I will leave this question intact to raise some interest in the issue.
P.S.2
Looking into slim.learning
code I found out that in train()
after passing the parameters it just passes the control over to supervisor.Supervisor
which refers to tf.train.Supervisor
which is a bit odd since this class is considered deprecated. The use of supervisor
is also mentioned in the docstrings of slim.learning
.