jiangsutx / SRN-Deblur

Repository for Scale-recurrent Network for Deep Image Deblurring
http://www.xtao.website/projects/srndeblur/srndeblur_cvpr18.pdf
MIT License
710 stars 184 forks source link

Can I use the previous checkpoint to train the modified model ? #28

Open YukoOhyo opened 5 years ago

YukoOhyo commented 5 years ago

I saw your paper on CVPR ~ the results are really good !! Thanks for sharing your model :)

I wanna modify somewhere in your model, can I use the previous checkpoint to retrain it ?

will it gets something wrong or somewhere I need to notice ~ Cause I read this issue re train using previous checkpoint I got the "KeyError: "The name 'input/decode_image/cond_jpeg/is_png' refers to an Operation not in the graph.", but I don't know why :(

jiangsutx commented 5 years ago

Yes. You can re-train use the checkpoints. You need to follow TensorFlow workflow, define new graph and initialize all variables.

Then you can load our checkpoints. The variables in the new graph with same name as in checkpoints, will use the same weights.

YukoOhyo commented 5 years ago

Thanks :) I will try ~

deepikakanade commented 5 years ago

@YukoOhyo Even I am getting the same error: KeyError: "The name 'input/decode_image/cond_jpeg/is_png' refers to an Operation not in the graph."

Did you solve this error? Even I am trying to load the pretrained checkpoint to train using a different data.

jiangsutx commented 5 years ago

That error means you new graph does not contain some operations which are in the checkpoint file. Maybe you can only load those required weights. I think there may be solutions in TensorFlow docs.

pygabc1 commented 4 years ago

In order to re-train using previous checkpoint, I try to change the following code in "model.py": `self.saver = tf.train.Saver(max_to_keep=50, keep_checkpoint_every_n_hours=1) coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(sess=sess, coord=coord)

summary_op = tf.summary.merge_all() summary_writer = tf.summary.FileWriter(self.train_dir, sess.graph, flush_secs=30)`

to: `# training summary summary_op = tf.summary.merge_all() summary_writer = tf.summary.FileWriter(self.train_dir, sess.graph, flush_secs=30)

saver = tf.train.import_meta_graph(r'./checkpoints/color/deblur.model-523000.meta') saver.restore(sess, tf.train.latest_checkpoint(r'./checkpoints/color/')) self.saver = saver

coord = tf.train.Coordinator() threads = tf.train.start_queue_runners(sess=sess, coord=coord)`

However, I have an error of ValueError: Can't load save_path when it is None in the line of saver.restore(sess, [tf.train.latest_checkpoint(r'./checkpoints/color/'))]