Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show images in Live plots without checkpoints. #1378

Closed
daavoo opened this issue Mar 3, 2022 · 2 comments
Closed

Show images in Live plots without checkpoints. #1378

daavoo opened this issue Mar 3, 2022 · 2 comments
Labels
A: experiments Area: experiments table webview and everything related A: plots Area: plots webview, side panel and everything related

Comments

@daavoo
Copy link
Contributor

daavoo commented Mar 3, 2022

Note: This feature is not as common as Scalar plots, already covered by iterative/dvc#1256.

In addition to scalars, DVCLive supports logging images in-between steps:

import random

from dvclive import Live
from PIL import Image
from PIL import ImageDraw 

live = Live()

for i in range(10):
    live.log("foo", i + random.random())
    live.log("bar", i + random.random())

    img = Image.new("RGB", (50, 50), (255, 255, 255))
    draw = ImageDraw.Draw(img)
    draw.text((20, 20), f"{i  + random.random():.2f}", (0,0,0))
    live.log_image("img.png", img)
    live.next_step()

When running DVCLive with DVC, the images are shown and updated in the Live HTML Report .

The current output format is described here: https://dvc.org/doc/dvclive/api-reference/live/log_image#step-updates

This is an arbitrary output format and could be changed if needed. There are still open issues on DVC regarding how to improve the rendering of per-step images: iterative/dvc-render#6

In Studio, this subfolder format comes handy given how the current Directories view works.

@daavoo daavoo added A: experiments Area: experiments table webview and everything related A: plots Area: plots webview, side panel and everything related labels Mar 3, 2022
@mattseddon
Copy link
Member

Do you have an example of this not working?

The reason that I ask is that the path to the image should come through in the plots diff output. We then watch that path for updates and if the file is shown to be changed we should update the image.

If you have an example it will be much easier for me to debug. Thanks.

@daavoo
Copy link
Contributor Author

daavoo commented Mar 3, 2022

It looks like I was using old version of the extension 🙏

@daavoo daavoo closed this as completed Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: experiments Area: experiments table webview and everything related A: plots Area: plots webview, side panel and everything related
Projects
None yet
Development

No branches or pull requests

2 participants