hyperdash-sdk-py icon indicating copy to clipboard operation
hyperdash-sdk-py copied to clipboard

Is it possible to send picture as log?

Open Earthson opened this issue 7 years ago • 3 comments

It would be grate to send binary or base64 encoded image through hyperdash, we could generate these image using matplotlib

Earthson avatar Aug 15 '17 03:08 Earthson

Hey @Earthson,

This is definitely a feature we're interested in building, although we're probably going to build first-class support for tracking hyperparameters and epoch-level metrics (like loss/accuracy, etc etc) first

richardartoul avatar Aug 15 '17 06:08 richardartoul

@Earthson here is an idea on an API that would let you send base64 images.

from hyperdash import Experiment
import matplotlib.pyplot as plt
import io
import urllib, base64

exp = Experiment("Model Name")

# ... Create data / model ...

# Matplotlib Plot (Skip for another base64 image source)
plt.plot(range(10))

# Save plot
fig = plt.gcf()
buf = io.BytesIO()
fig.savefig(buf, format='png')
buf.seek(0)

# Get base64 image
img = base64.b64encode(buf.read())

# Send base64 encoded image to Hyperdash servers, associated with experiment
exp.image_base64(img)

exp.end()

Then you'd be able to see the image next to your logs, hyperparameters, and performance metrics on the web and mobile clients.

Perhaps a more ideal API... a function that lets you directly do:

plt.plot(range(10))
fig = plt.gcf()
exp.save_fig(fig)

But we'd need an approach such that matplotlib wasn't a required Hyperdash dependency.

andrewschreiber avatar Sep 22 '17 08:09 andrewschreiber

I think it is a good idea.

Is it possible to provide an optional image_id for overwritable image?

Earthson avatar Sep 26 '17 07:09 Earthson