All Projects → cheind → tf-matplotlib

cheind / tf-matplotlib

Licence: MIT license
Seamlessly integrate matplotlib figures as tensorflow summaries.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to tf-matplotlib

Tensorflow Plot
📈 TensorFlow + Matplotlib as TF ops
Stars: ✭ 285 (+139.5%)
Mutual labels:  tensorboard, matplotlib
data-viz-utils
Functions for easily making publication-quality figures with matplotlib.
Stars: ✭ 16 (-86.55%)
Mutual labels:  matplotlib
geospatial-storytelling
Visualization of gps tracking data
Stars: ✭ 20 (-83.19%)
Mutual labels:  matplotlib
PyCoolPlot
A cool plotting module on Python
Stars: ✭ 30 (-74.79%)
Mutual labels:  matplotlib
Google Colab tutorial
Google Colab tutorial with simple network training and Tensorboard.
Stars: ✭ 14 (-88.24%)
Mutual labels:  tensorboard
skymapper
Mapping astronomical survey data on the sky, handsomely
Stars: ✭ 35 (-70.59%)
Mutual labels:  matplotlib
Fast-AgingGAN
A deep learning model to age faces in the wild, currently runs at 60+ fps on GPUs
Stars: ✭ 133 (+11.76%)
Mutual labels:  tensorboard
deepvac
PyTorch Project Specification.
Stars: ✭ 507 (+326.05%)
Mutual labels:  tensorboard
topic modelling financial news
Topic modelling on financial news with Natural Language Processing
Stars: ✭ 51 (-57.14%)
Mutual labels:  matplotlib
alphaGAN
A PyTorch implementation of alpha-GAN
Stars: ✭ 15 (-87.39%)
Mutual labels:  tensorboard
chronist
Long-term analysis of emotion, age, and sentiment using Lifeslice and text records.
Stars: ✭ 23 (-80.67%)
Mutual labels:  matplotlib
shikshak
Academics made Affordable.
Stars: ✭ 16 (-86.55%)
Mutual labels:  matplotlib
plot-likert
Python library to visualize results from Likert scale survey questions
Stars: ✭ 54 (-54.62%)
Mutual labels:  matplotlib
pymae
Materials for the book "Python for Mechanical and Aerospace Engineering"
Stars: ✭ 56 (-52.94%)
Mutual labels:  matplotlib
progressive-growing-of-gans.pytorch
Unofficial PyTorch implementation of "Progressive Growing of GANs for Improved Quality, Stability, and Variation".
Stars: ✭ 51 (-57.14%)
Mutual labels:  tensorboard
TensorFlow
Swift high-level API for TensorFlow.
Stars: ✭ 49 (-58.82%)
Mutual labels:  tensorboard
gopem
GUI for OPEM library
Stars: ✭ 20 (-83.19%)
Mutual labels:  matplotlib
11 Python Matplotlib Module
Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced by John Hunter in the year 2002. One of the greatest benefits of visualization is that it allows us visual access to …
Stars: ✭ 206 (+73.11%)
Mutual labels:  matplotlib
mplcairo
A (new) cairo backend for Matplotlib.
Stars: ✭ 87 (-26.89%)
Mutual labels:  matplotlib
QM-Simulator-1D
Interactive simulation of a quantum particle in 1D.
Stars: ✭ 69 (-42.02%)
Mutual labels:  matplotlib

tf-matplotlib - seamless integration of matplotlib figures into TensorFlow summaries

tf-matplotlib renders your everyday matplotlib figures tinside TensorFlow's Tensorboard visualization interface. The library

  • takes care of evaluating input tensors prior to plotting,
  • avoids matplotlib threading issues,
  • support multiple figures and,
  • provides blitting for runtime critical plotting.

The following TensorFlow summary is generated by sgd.py. It plots the progress of gradient descent optimizers on a test surface. To avoid redrawing the test surface, it makes use of blitting. See usage below for a more introductory example.

Installation

pip install tfmpl

Requirements

  • Python 3.5/3.6
  • TensorFlow 1.x
  • matplotlib 2.2.0

Build status

Branch Linux Windows
master
develop

Usage

Below are the relevant snippets to render a simple scatter plot. See scatter.py for the complete self-contained example.

import tensorflow as tf
import numpy as np

import tfmpl

@tfmpl.figure_tensor
def draw_scatter(scaled, colors): 
    '''Draw scatter plots. One for each color.'''  
    figs = tfmpl.create_figures(len(colors), figsize=(4,4))
    for idx, f in enumerate(figs):
        ax = f.add_subplot(111)
        ax.axis('off')
        ax.scatter(scaled[:, 0], scaled[:, 1], c=colors[idx])
        f.tight_layout()

    return figs

with tf.Session(graph=tf.Graph()) as sess:

    # A point cloud that can be scaled by the user
    points = tf.constant(
        np.random.normal(loc=0.0, scale=1.0, size=(100, 2)).astype(np.float32)
    )
    scale = tf.placeholder(tf.float32)        
    scaled = points*scale

    # Note, `scaled` above is a tensor. Its being passed `draw_scatter` below. 
    # However, when `draw_scatter` is invoked, the tensor will be evaluated and a
    # numpy array representing its content is provided.   
    image_tensor = draw_scatter(scaled, ['r', 'g'])
    image_summary = tf.summary.image('scatter', image_tensor)      
    all_summaries = tf.summary.merge_all() 
    
    writer = tf.summary.FileWriter('log', sess.graph)
    summary = sess.run(all_summaries, feed_dict={scale: 2.})
    writer.add_summary(summary, global_step=0)

Draw utilities

When doing classification, a common task is to generate a confusion matrix. tf-matplotlib provides tfmpl.draw.confusion_matrix to quickly generate such a plot from labels and predictions. The following plot shows classification training progress on the MNIST classification task. Full sample code is provided in mnist.py.

License

MIT License

Copyright (c) 2018 Christoph Heindl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].