JuliaLogging / TensorBoardLogger.jl

Easy peasy logging to TensorBoard with Julia
MIT License
101 stars 28 forks source link

Visualizations (tensorboard alternative)? #74

Open jbrea opened 4 years ago

jbrea commented 4 years ago

Are there any plans to add some Julia-based visualization of the log files (as an alternative to tensorboard)?

I tried the following simple example for the log file of the usage example in the readme. I think with @essenciary's Stipple.jl one could get something nice here.

using TensorBoardLogger, Genie, Genie.Router, Genie.Renderer.Html,
Stipple, StippleCharts, StippleCharts.Charts

function pushdata!(model, i, v)
    model.i = i
    push!(model.plot_data.val[1].plotdata.data, v)
end

function loaddata(path, var, model; timeout = 1)
    while true
        map_summaries((s, i, v) -> s == var ? pushdata!(model, i, v) : nothing,
                      path, steps = model.i + 1 : typemax(UInt))
        sleep(timeout)
    end
end

Base.@kwdef mutable struct Dashboard <: ReactiveModel
    i::Int = 0
    plot_option::PlotOptions = PlotOptions(chart_type = :scatter)
    plot_data::R{Vector{PlotSeries}} = [PlotSeries(name = "test/j",
                                                   plotdata = PlotData(Float32[]))]
end

Stipple.register_components(Dashboard, StippleCharts.COMPONENTS)
model = Stipple.init(Dashboard)

function ui()
  page(
    root(model), class="container", [
        row([
        cell(class="st-module", [
          h5("Series")
          plot(:plot_data; options = :plot_option)
        ])
      ])
    ], title="TBoardLogger"
  ) |> html
end

route("/", ui)

up()

loaddata("logs/run", "test/j", model) # no auto-refresh of the browser...
PhilipVinc commented 4 years ago

Hi, sorry I'm on holidays those days so I seldom check on GitHub.

Anyhow, the TLDR is: I don't have plans in that direction, but if someone wanted to go down that road I would be glad to chip in.

-- TensorBoardLogger started as an attempt to log to TensorBoard from Julia without requiring a working Python installation. Right now it can serialise (and deserialise) TensorBoard .proto files. The front-end (tensoboard) is a separate program. If you wanted to write a different frontend, using Stripple or anything else really, I think the best direction would be starting a new package, and rely on map_summaries, as you did.

If anyone was to do this, I would surely help by improving the map_summaries interface and it's performance, and there is also some leeway to add some more metadata to the .proto files, that will keep the files compatible with tensor board but could provide more info to a new front-end

But I don't have the need for this right now, so I would not be starting it myself. (however, I think it's a very cool idea! Tensorboard has several little things I don't like)