Giter Site home page Giter Site logo

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

Stargazers

Vladislav Sorokin avatar JINGJUN TAO avatar  avatar Andy (Yoon Yong) Shin avatar  avatar  avatar João Victor avatar  avatar  avatar 안성현 avatar SEUNG BIN avatar dongpil seo avatar Sangpil Kim avatar Dong-Won Shin avatar Angel Ortega (he/they) avatar Byungkyu (Jay) Kang avatar Junbum Cha avatar Ghiwook Nam avatar babooppa6 avatar Junyoung Jang avatar Byeongsoo Kim avatar Cliff W. Lee avatar SJ Lee avatar doooothat avatar  avatar  avatar Jaehong Park avatar

Watchers

James Cloos avatar  avatar  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.