allegroai / clearml

ClearML - Auto-Magical CI/CD to streamline your AI workload. Experiment Management, Data Management, Pipeline, Orchestration, Scheduling & Serving in one MLOps/LLMOps solution
https://clear.ml/docs
Apache License 2.0
5.42k stars 643 forks source link

report_matplotlib_figure of subplots #1274

Closed lolpa1n closed 1 month ago

lolpa1n commented 1 month ago

Describe the bug

I want to log my subplot, but subplot does not appear in Plots, it goes to Debug images and does not open (Unable to load image)

To reproduce

logger = dataset.get_logger()

fig, ax = plt.subplots(1, 3, figsize=(12, 3))

for i, stage in enumerate(['train', 'val', 'test']):
    stage_data = df_full[df_full['stage'] == stage]['label'].value_counts()
    stage_data.plot(kind='bar', ax=ax[i])
    ax[i].set_title(f'Label distribution {stage}')
    ax[i].set_xlabel('Label')
    ax[i].set_ylabel('Count')
    ax[i].tick_params(axis='x', labelrotation=45)

plt.show()

logger.report_matplotlib_figure(title=f"Data {TAG}", series=f"Class distribution", figure=fig, iteration=0)

but logging each plt separately works, but I would like 3 at once

Environment

eugen-ajechiloae-clearml commented 1 month ago

Hi @lolpa1n ! Can you please try using the latest clearml version? If that also doesn't work for you, can you please tell us how to construct df_full to reproduce the issue? As far as I checked, the plots should go under PLOTS, but they are reported as images, because clearml can't construct the multiplot as a plotly plot to report it.

lolpa1n commented 1 month ago

Thank you @eugen-ajechiloae-clearml . the new version works as you said, it logs the image, but I decided that I would use plotly