stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: batch img2img **with outpainting mk2** stores same seed number with all images

Open JLuke73 opened this issue 3 years ago • 7 comments

What happened?

Creating a batch count of 2+ images with outpainting mk2 selected stores the metadata of the first seed number with each subsequent image. e.g.: 001-12345.png 002-12345.png 003-12345.png But subsequent images have random (non-sequential) seeds, so the seeds cannot be recovered.

Steps to reproduce the problem

  1. Go to img2img tab, chose inpaint -> outpainting mk2 script.
  2. Generate images with a batch count of 2 images.
  3. Attempt to reproduce the results of image 2.

What should have happened?

a) The correct seed number should be calculated and added to metadata for each subsequent image, OR b) Images created in batches should use sequential seed numbers.

JLuke73 avatar Oct 25 '22 02:10 JLuke73

is it even working well for u? me and many other ppl have an issue where the progress bar just reaches half of the % giving a very low quality - unfinished version of the true result: image

Mikian01 avatar Oct 25 '22 03:10 Mikian01

I've encountered the same issue, but can't tell if it's a console UI bug or a real processing issue.

Better to focus on one bug per bug report.

JLuke73 avatar Oct 25 '22 03:10 JLuke73

If you use the given seed to generate the same number of images as you did the first time around, it will generate one image with that seed, then yield the same N-1 next seeds in the same order. This is not ideal, but at least the successive seeds aren't truly lost. I will take a look at saving the exact seeds themselves.

timntorres avatar Oct 25 '22 09:10 timntorres

Wait, I actually tried it, and the seeds are named correctly for me. The ith seed is merely the 0th seed plus i: seeds are updating for me I don't know why yours isn't doing that. Maybe it just looks like the seed isn't updating, because the seeds are so similar?

timntorres avatar Oct 25 '22 10:10 timntorres

Further testing revealed the issue only seems to occur with the outpainting mk2 script selected. When deselecting the script and continuing to generate images, the issue sometimes persists.

I've updated the bug report with corrected information.

JLuke73 avatar Oct 25 '22 21:10 JLuke73

Looks like it only uses the initial seed to save images.

It does this in the batch loop:

            if initial_seed_and_info[0] is None:
                initial_seed_and_info[0] = proc.seed
                initial_seed_and_info[1] = proc.info

And then when it's done all batches, it saves like this:

        res = Processed(p, all_images, initial_seed_and_info[0], initial_seed_and_info[1])


        if opts.samples_save:
            for img in all_processed_images:
                images.save_image(img, p.outpath_samples, "", res.seed, p.prompt, opts.grid_format, info=res.info, p=p)

But how should it actually work?

Let's say if you outpaint top, left, and right, it'll use 3 different seeds. Which seed should it use for saving purpose?

wywywywy avatar Oct 26 '22 15:10 wywywywy

If it works in any way that's repeatable, storing enough data with the file to reproduce results, that would be sufficient.

JLuke73 avatar Oct 27 '22 01:10 JLuke73

Closing as stale.

catboxanon avatar Aug 03 '23 16:08 catboxanon