-
Notifications
You must be signed in to change notification settings - Fork 37
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
Image support #166
Image support #166
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## master #166 +/- ##
==========================================
+ Coverage 91.82% 92.25% +0.43%
==========================================
Files 17 19 +2
Lines 416 465 +49
==========================================
+ Hits 382 429 +47
- Misses 34 36 +2
Continue to review full report at Codecov.
|
for more information, see https://pre-commit.ci
β¦into image-support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added an option for using a step
placeholder in the output path of the image. With the current html layout, overriding the image at each step is kind of the only option that looks nice.
Overriding (dvclive.log("image.png", img)
):
r = 5
for i in range(r):
img = Image.new('RGB', (200,200), (250,250,250))
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("OpenSans-Regular.ttf", 100)
draw.text((20, -5),str(i),(0,0,0), font=font)
dvclive.log("image.png", img)
dvclive.log("loss", (1-i/r) + (np.random.random() / 10))
dvclive.log("accuracy", (i/r) + (np.random.random() / 10))
dvclive.next_step()
Using the placeholder (dvclive.log("image_{step}.png", img)
):
r = 5
for i in range(r):
img = Image.new('RGB', (200,200), (250,250,250))
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("OpenSans-Regular.ttf", 100)
draw.text((20, -5),str(i),(0,0,0), font=font)
dvclive.log("image_{step}.png", img)
dvclive.log("loss", (1-i/r) + (np.random.random() / 10))
dvclive.log("accuracy", (i/r) + (np.random.random() / 10))
dvclive.next_step()
If they don't include the dvclive.log(f"image_{step}.png", image) Anyhow, we kind of already have a similar ux regarding
Not sure if I am missing something but why would be having a separate subdir a requirement? Using |
I removed the subdir part from this P.R. as it is not a strict requirement and could be addressed in a separate P.R. |
for more information, see https://pre-commit.ci
Right, its not a strict requirement. If we document the |
TBH I'm pretty torn. The flexibility is nice, but it puts more burden on the user and moves away from a canonical tree structure. Would you recommend "image_{step}.png" for both DVC and non-DVC workflows?
This seems slightly different to me:
On the other hand, it might be nice to make model saving more similar so that, for example, integration with dvc could manage the model output instead of needing to specify this separately in |
This brings us to the question how would we save the model? Do we |
@daavoo How would you recommend users log images in 1) DVC workflows and 2) non-DVC workflows? What path/pattern would you suggest for each? Edit: Also, do you have an idea of how DVC would track these outputs? |
I think that just to move forward, we can hide the "{step}" formatting from the users and be opinionated for now. In my mind, the division would be more about With or Without Checkpoints. For example, we can just tell the user to call:
And we would internally save the image under: a) b) AFAIK, both outputs will be tracked by DVC as expected (just like the If later on, some changes on the DVC HTML layout require the images to be in a different folder structure, we can change it internally. WDYT? |
I wonder whether we should not allow some kind of configuration for that. It seems to me that both cases:
Checkpointing approach does resolve that, but what about users not using checpoints? |
If I'm ignoring DVC, checkpoints, the HTML output, etc., and only considering how I would expect a logger to save this data, it would be in the Currently, this makes for an ugly visualization, but are there ways we can mitigate this in the future? We could visualize a folder of images in a lot of ways, like make a slider to scroll between images like tensorboard and wandb do. Even if we completely leave it out of the HTML, I could easily scroll through the photos locally in this format. Is there any compelling reason other than the current limits of our visualization to save them in a different format? |
I don't think there are any. |
Sorry for the close, random shortcut has been hit. |
I updated the code to use |
Is there a docs PR for this @daavoo? |
|
β I have followed the Contributing to DVCLive guide.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Close #150