tensorflow / tensorflow/tensorboard
"Couldn't match files for checkpoint" when trying to visualize embedding
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 1
Description
Hi,
I am trying to visualize an embedding with the tensorboard projector. I save the checkpoint files like instructed in the tensorflow tutorial and they are located in the projectfolder/logs/checkpointFFNtest.ckpt
When running Tensorboard it gives me this error: Couldn't match files for checkpoint .//dropOutFFNTest.ckpt
The checkpoint file is definitely present and can also be read into tensorflow with
saver.restore(sess, "C:/MyFiles/Uni/Tensorflow/project1/log/dropOutFFN.ckpt")
Tensorboard also finds the scalars which are saved in C:/MyFiles/Uni/Tensorflow/project1/summaries/train(or /val) and visualizes them correctly.
I've tried to show embeddings with the projector by starting tensorboard in the overall project directory as well as directly in the "logs" directory. Do you know what the problem might be?
Here a condensed code snipped:
from tensorflow.contrib.tensorboard.plugins import projector
tf.reset_default_graph()
%matplotlib notebook
X = tf.placeholder("float", [None,n_input])
Y = tf.placeholder("float",[None,n_classes])
keep_probability = tf.placeholder("float")
weights = {
'h1': tf.Variable(tf.random_normal([n_input, n_hidden_1])),
'h2': tf.Variable(tf.random_normal([n_hidden_1, n_hidden_2])),
'out': tf.Variable(tf.random_normal([n_hidden_2, n_classes]))
}
biases = {
'b1': tf.Variable(tf.random_normal([n_hidden_1])),
'b2': tf.Variable(tf.random_normal([n_hidden_2])),
'out': tf.Variable(tf.random_normal([n_classes]))
}
def multilayer_perceptron(x):
# Hidden fully connected layer with 256 neurons
layer_1 = tf.nn.dropout(tf.nn.tanh(tf.add(tf.matmul(x, weights['h1']), biases['b1'])),keep_probability)
# Hidden fully connected layer with 256 neurons
layer_2 = tf.nn.dropout(tf.nn.tanh(tf.add(tf.matmul(layer_1, weights['h2']), biases['b2'])),keep_probability)
# Output fully connected layer with a neuron for each class
out_layer = tf.matmul(layer_2, weights['out']) + biases['out']
return out_layer
out = multilayer_perceptron(X)
predicted=tf.sigmoid(out)
[...]
loss_op = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(
logits=out, labels=Y))#sigmoid because classes are not mutially exclusive
optimizer = tf.train.AdamOptimizer(learning_rate=learning_rate)
train_op = optimizer.minimize(loss_op)
tf.summary.scalar("cross_entropy", loss_op)
tf.summary.scalar("accuracy",accuracy)
tf.summary.scalar("NumRight",tf.reduce_mean(NumRightPred))
tf.summary.scalar("NumWrong",tf.reduce_mean(NumFalsePred))
tf.summary.scalar("absDiff",tf.reduce_mean(diff))
merged_summaries = tf.summary.merge_all()
init = tf.global_variables_initializer()
"""summary_writer = tf.summary.FileWriter("./summaries/new")
config = projector.ProjectorConfig()
embedding = config.embeddings.add()
embedding.tensor_name = weights['h1'].name
projector.visualize_embeddings(summary_writer, config)"""#tried this but it didn't work
train_writer = tf.summary.FileWriter("./summaries/train", tf.get_default_graph())
validation_writer = tf.summary.FileWriter("./summaries/validation")
with tf.Session() as sess:
#sess.run(tf.global_variables_initializer())
sess.run(init)
saver = tf.train.Saver()
saver.restore(sess, "C:/MyFiles/Uni/Tensorflow/project1/log/dropOutFFN.ckpt")
print("model loaded")
for n in range(training_epochs):
_,loss,predTreat,_summaries,acc,absdiff = sess.run([...], feed_dict={...})
train_writer.add_summary(_summaries, step)
if (step % 50 == 0):
kp=1.0
icd, treatment = getBatch(batch_size,"val")
_,loss_val,predTreat,_summaries,acc,absdiff = sess.run([...], feed_dict={...})
print("Accuracy: ",acc)
print("Cross Entropy: ",loss_val)
print("Diff: ",absdiff)
validation_writer.add_summary(_summaries, step)
if (step%1000==0):
saver.save(sess,"./log/dropOutFFNTest.ckpt")
step = step + 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.