我想知道如何可视化来自Tensorboard中预加载网络的嵌入 . 我正在使用FaceNet为面创建嵌入,我已经创建了 sprite.pnglabels.tsv 文件 . 至于加载网络和设置Tensorboard,这是我到目前为止所做的:

1. Load the embedding layer

meta_file, ckpt_file = facenet.get_model_filenames(MODEL_DIR)
with tf.Graph().as_default():
    with tf.Session().as_default() as sess:
        # load the network 
        model_dir_exp = os.path.expanduser(MODEL_DIR)
        saver = tf.train.import_meta_graph(os.path.join(model_dir_exp, meta_file))
        saver.restore(tf.get_default_session(), os.path.join(model_dir_exp, ckpt_file))

        # setup the lambda function needed to get the embeddings
        images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0")
        embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0")
        phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0")
        find_embeddings = lambda img : sess.run(embeddings, feed_dict = {images_placeholder : img, phase_train_placeholder : False})

2. Find the embeddings

face_embeddings = np.zeros((n_images,128))
face_embeddings = []
for i in range(n_batches):
    start = i * batch_size
    end = min((i + 1) * batch_size, n_images)

    # Get the embeddings
    face_embeddings[start:end, :] = find_embeddings(face_images[start:end])

3. Setup Tensorboard

from tensorflow.contrib.tensorboard.plugins import projector

embedding = tf.Variable(tf.zeros([33, 128]), name = "embedding")
config = projector.ProjectorConfig()
embedding_config = config.embeddings.add()
embedding_config.tensor_name = embedding.name
embedding_config.metadata_path = os.path.join(MODEL_DIR, 'labels.tsv')
embedding_config.sprite.image_path = os.path.join(MODEL_DIR,'sprite.png')
embedding_config.sprite.single_image_dim.extend([160, 160])

writer = tf.summary.FileWriter(MODEL_DIR)
projector.visualize_embeddings(writer, config)

虽然当我打开这Tensorboard它说,它可以't find the data. I' VE看了FAQ,当我运行 find MODEL_DIR | grep tfevents 没有任何显示,所以我'm guessing that this is the problem. I'已经看了MNIST Tutorial,似乎他们有检查点在训练步骤虽然我不't have it as I'米使用预先训练的模型 . 在这种情况下,我将如何制作Tensorboard显示嵌入的任何想法?