Hi TenderCoyote78
Here is a snippet to illustrate how to retrieve the scalars and the plots from a task
` from clearml.backend_api.session.client import APIClient
from clearml import Task
task = Task.get_task(project_name=xxxx, task.name=xxxx) #or task_id=xxxx
client = APIClient()
#retrieving the scalars
client.events.scalar_metrics_iter_histogram(task=task.id)
#retrieving the plots
client.events.get_task_plots(task=task.id) `
hey TenderCoyote78
Here is an example of how to dump the plots to jpeg files
` from clearml.backend_api.session.client import APIClient
from clearml import Task
import plotly.io as plio
task = Task.get_task(task_id='xxxxxx')
client = APIClient()
t = client.events.get_task_plots(task=task.id)
for i, plot in enumerate(t.plots):
fig = plio.from_json(plot['plot_str'])
plio.write_image(fig=fig, file=f'./my_plot_{i}.jpeg') `
for the scalars :
` import pandas as pd
import plotly.graph_objects as go
scalars = client.events.scalar_metrics_iter_histogram(task=task.id).to_dict()['metrics']
for graph in scalars.keys():
for i, metric in enumerate(scalars[graph].keys()):
df = pd.DataFrame(scalars[graph][metric]).iloc[:, 1:]
fig = go.Scatter(
scalars[graph][metric],
mode='lines',
name=metric,
showlegend=True
)
plio.write_image(fig=go.Figure(fig), file=f'./my_metric_{i}.jpeg') `