# create a summary to monitor cost tensor if write_summary: tf.summary.scalar("loss", loss) # merge all summaries into a single op if write_summary: merged_summary_op = tf.summary.merge_all() time_start = time.time() # op to write logs to Tensorboard if write_summary: summary_writer = tf.summary.FileWriter(params.save_dir, graph=tf.get_default_graph()) if params.shuffle_training: data.load_imgs() # center, curve 50:50% # data.categorize_imgs() for i in xrange(params.training_steps): if params.use_category_normal: txx, tyy = data.load_batch_category_normal('train') else: txx, tyy = data.load_batch('train') # print "txx: ", len(txx), len(txx[0]), len(txx[0][0]), len(txx[0][0][0]) # print "tyy: ", tyy train_step.run(feed_dict={model.x: txx, model.y_: tyy})
if write_summary: tf.summary.scalar("loss", loss) # merge all summaries into a single op if write_summary: merged_summary_op = tf.summary.merge_all() saver = tf.train.Saver() time_start = time.time() # op to write logs to Tensorboard if write_summary: summary_writer = tf.summary.FileWriter(params.save_dir, graph=tf.get_default_graph()) if params.shuffle_training: data.load_imgs() for i in xrange(params.training_steps): txx, tyy = data.load_batch('train') train_step.run(feed_dict={model.x:txx, model.y_:tyy, model.keep_prob: 0.8}) # write logs at every iteration if write_summary: summary = merged_summary_op.eval(feed_dict={model.x: txx, model.y_: tyy, model.keep_prob: 1.0}) #summary_writer.add_summary(summary, i) if (i+1) % 10 == 0: vxx, vyy = data.load_batch('val') t_loss = loss.eval(feed_dict={model.x: txx, model.y_: tyy, model.keep_prob: 1.0}) v_loss = loss.eval(feed_dict={model.x: vxx, model.y_: vyy, model.keep_prob: 1.0})