AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
137.03k stars 26.08k forks source link

[Feature Request]: Save interstitial image during generation #8474

Open shadowlocked opened 1 year ago

shadowlocked commented 1 year ago

Is there an existing issue for this?

What would your feature do ?

Oftentimes the 'developing' images are better than the final image, or at least are more suitable fodder for further development than the final image. It would be great in there was a Save button that could save the currently-visualized image to the default generation folder.

Proposed workflow

  1. You start generating the image, either txt2img or Img2Img, whatever
  2. Visualizations roll by as the noise evolves
  3. You see a really great mid-development image you'd like to save (i.e., without saving the entire roll of interstitial images)
  4. You press the dedicated Save button that appears during the corner of the results window during generation.

Additional information

No response

iluzek commented 1 year ago

There is an extension for this that works somewhat well but you might need to adjust it in terms of output folder/naming if you want it to be consistent with your preferred way to save files. With the caveat of it actually saving 'all' or every 'n' number or 'starting from n' number. So not exactly what you propose. I do however find it a bit 'too hands-on' to sit and stare at a PC when it generates images when it can do it on its own and results can be previewed after.

sd_save_intermediate_images https://github.com/AlUlkesh/sd_save_intermediate_images.git

You need to, however, disable preview and or find options in settings that disable approximation images for preview. When I had preview enabled, saved images were 'thumbnails' of horrible quality, while with that setting off I was able to get full images of good quality.

This however should be an inbuild option into the automatic1111 as playing with plugins and modifying them to work as needed is a hassle.

vladmandic commented 1 year ago

When I had preview enabled, saved images were 'thumbnails' of horrible quality

Default for previews is 1/4 resolution. Simply change it in options to full.

shadowlocked commented 1 year ago

I installed that plugin, but have not had a good experience with it.

Zueuk commented 1 year ago

I would love to be able to save images from the last N generation steps, this would save us lots of time, especially with samplers that produce good enough results with fewer iterations

vladmandic commented 1 year ago

if you want, you can try out https://github.com/vladmandic/sd-extension-steps-animation, simply don't save video, set intermediate images to be left on disk and skip n initial steps.

Zueuk commented 1 year ago

if you want, you can try out https://github.com/vladmandic/sd-extension-steps-animation, simply don't save video, set intermediate images to be left on disk and skip n initial steps.

Not exactly what I'm looking for, the images saved from there are:

which might not be such a problem if I had a 4090 and/or lots of time to re-generate the step(s) I liked every time... but I don't

vladmandic commented 1 year ago

if there is a demand, all those requests are easily addressable.

shadowlocked commented 1 year ago

I don't think that saving the entire roll is worthwhile, as the early ones will be noisy nonsense. I still think one should be able to rip out a transient stage with a save button, to the default images folder. Though it's not simple, I'm sure, it's simpler than figuring out how to handle complete denoising image sequences, in terms of naming, etc.

vladmandic commented 1 year ago

@shadowlocked like i said, extension i've mentioned already has a configurable skip initial steps option. on your proposal, there are two major issues:

shadowlocked commented 1 year ago

Thanks for that. Eventually I will install FFMPEG (which the mentioned extension needs).

vladmandic commented 1 year ago

It only needs it to create videos, shouldn't be needed just to get intermediary images. I'll check if check for ffmpeg is too early.

Zueuk commented 1 year ago

Can confirm, it only complains about no ffmpeg if "Create animation" is checked

iluzek commented 1 year ago

@Zueuk and anyone else interested.

Just to address my first mention about 'sd_save_intermediate_images https://github.com/AlUlkesh/sd_save_intermediate_images.git'.

You can in fact save 'good quality' images with settings as I initially mentioned, just didn't remember the exact setting in SD settings page. You can save them as png and they do include all the png info. You can also save get additional .txt file (not sure if that was the SD setting or default in the extension).

And while it doesn't have the option to save the previewed image, it does have the option to set saving from 0 or a specified step and can skip every n specified step or save every single one.

The only issue I've found in regards to that plugin and step count is that if your specified step count in the plugin is lower than the actual step count within SD, it then doesn't save anything. It was a bit of a pain for me because I struggled with another bug where my png info wasn't saved in the final files so I used this plugin instead.

Another useful feature that this plugin DOESN'T have is saving 'last n' steps. this could be useful if the plugin knew how many steps are 'predicted/set by sd', but sadly that is not implemented.

I found this plugin useful with bug I experienced but I think most importantly it can help figure out actually needed steps for your generations so you don't waste 2-10 min when 30 sec is enough (depending on hardware/settings).

vladmandic commented 1 year ago

Another useful feature that this plugin DOESN'T have is saving 'last n' steps. this could be useful if the plugin knew how many steps are 'predicted/set by sd', but sadly that is not implemented.

requested steps vs executed steps is not the same. its easy to know how many steps are requested, but quite a few samplers have early exit when they consider sampling as "done". so there's no way to do it cleanly (you could save all and then delete everything except last n at the end, but i don't like that)

btw, i've updated https://github.com/vladmandic/sd-extension-steps-animation with feedback:

Zueuk commented 1 year ago

requested steps vs executed steps is not the same

So when you interrupt image generation and it turns out good, there is no easy way to reproduce it because no idea on which exact step it was interrupted 😕 Just another reason to use your extension