Giter Site home page Giter Site logo

sorokinvld / tensorboard-embedding-visualization Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jireh-father/tensorboard-embedding-visualization

0.0 1.0 0.0 17.87 MB

Easily visualize embedding on tensorboard with thumbnail images and labels.

Python 100.00%

tensorboard-embedding-visualization's Introduction

tensorboard-embedding-visualization

Easily visualize embedding on tensorboard with thumbnail images and labels.

Currently this repo is compatible with Tensorflow r1.0.1

alt text

Getting Started

import embedder

# create the model graph and get the last layer's output.
logits = model()

# init session and restore pre-trained model file
sess = tf.Session()
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, os.path.join(test_path, 'model.ckpt'))

# read your dataset and labels
data_sets, labels = read_data_sets()

# run your model
feed_dict = {input_placeholder: dataset, label_placeholder: labels}
activations = sess.run(logits, feed_dict)

embedder.summary_embedding(sess=sess, dataset=data_sets, embedding_list=[activations],
                                       embedding_path="your embedding path", image_size=your_image_size, channel=3,
                                       labels=labels)

If you want to use large data.

import embedder

# create the model graph
logits = model()

# init session and restore pre-trained model file
sess = tf.Session()
sess.run(tf.global_variables_initializer())
saver = tf.train.Saver()
saver.restore(sess, os.path.join(test_path, 'model.ckpt'))

total_dataset = None
total_labels = None
total_activations = None
for i in range(10)
    data_sets, labels = get_batch(i)
    feed_dict = {input_placeholder: dataset, label_placeholder: labels}
    activations = sess.run(logits, feed_dict)
    if total_dataset is None:
      total_dataset = data_sets
      total_labels = labels
      total_activations = activations
    else:
      total_dataset = np.append(data_sets, total_dataset, axis=0)
      total_labels = np.append(labels, total_labels, axis=0)
      total_activations = np.append(activations, total_activations, axis=0)

embedder.summary_embedding(sess=sess, dataset=total_dataset, embedding_list=[total_activations],
                                       embedding_path="your embedding path", image_size=your_image_size, channel=3,
                                       labels=total_labels)

Running mnist test

python test_mnist.py
(python test_mnist_large_data.py)
tensorboard --log_dir=./

This should print that TensorBoard has started. Next, connect http://localhost:6006 and click the EMBEDDINGS menu.


API Reference

def summary_embedding(sess, dataset, embedding_list, embedding_path, image_size, channel=3, labels=None):
    pass

Acknowledgments

http://www.pinchofintelligence.com/simple-introduction-to-tensorboard-embedding-visualisation/ tensorflow/tensorflow#6322

tensorboard-embedding-visualization's People

Contributors

jireh-father avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.