Open stevenhales opened 1 year ago
highres fix is img2img it takes the img gens at a smaller res and then upscales with img2img you can already do this with img2img just take the img your generating use the same or similar prompt reduce denoising rate then change resolution and you will effectively have a highresfix
Not quite that straightforwards, but it's also not clear if an actual 'Highres Fix' run inside img2img would actually be any better than what you describe, could certainly be an interesting test.
The only tricky thing Highres Fix does is calculates proper low-res dimensions according to your target resolution:
For example, if you want to manually apply hr_fix-alike behavior for 800*600 image, you will need to calculate this: (paste in browser JS-console, for example)
var W=800,H=600;
var S=Math.sqrt(512*512/(W*H));
console.log(Math.ceil(S*W/64)*64,Math.ceil(S*H/64)*64);
It gives 640 448
, thus you need to generate an image with Width=640 and Height=448, and then transfer the result to img2img for upscaling with the same prompt.
Actually, I prefer doing it manually rather then with "Highres Fix" because it greatly saves time when I'm satisfied with lowres image, but want to experiment with "Denoising strength" (by the way, my experience shows that you ought to set it 0.3-0.6: when it less then 0.25 you'll have still blurry as lowres. but larger than 0.65 an image becomes scary psychedelic mess https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/1716! In contrary, you may safely raise CFG Scale up to 15-25, it will make the whole image much sharper).
I pre-calculated useful dimension ratios for myself, sorted by increasing area discrepancy: (for vertical orientation, swap the numbers) 1) 512512, square 1:1 (for 640×640, 768×768, 1024×1024) 2) 704384, wide 16:9 (for 960×540, 1280×720, 1600×900) 3) 640448, vga 3:4 (for 800×600, 1024×768, 1280×960) 4) 768384, double 2:1 (for 1024×512, 1200×600, 1600×800)
This would be majorly helpful. I'm not entirely sure the internal details, but using img2img on resolutions above 512x512 has a strong tendency to produce multiple heads, stacked bodies, etc similar to using txt2img without highresfix. I primarily use img2img at very high denoising strength mainly just to sample an image's color pallet. Having a way to get highres results without the typical warping would be wonderful, whether that's a highresfix checkbox or loopback.
We definitely need a fix for img2img. I use img2img to basically add more details to an lower res image by setting "everything to 50%" and it works perfectly as it will draw they same image just at higher res. But you can still see at the bottom of the image it will add weird stuff that weren't part of the original image, like extra heads or the concrete ground being transformed into weird architecture...
I can confirm that highrez fix in img2img is not working. the minute you use 1024x1024 everything gets messed up. Just to makes things clear I don't talk about upscaling, rather use an image as a template with basic details. The reason is when using txt2img, it's very hard to get an image that is not cropped.
see attached images, exact same settings except resolution output
img2img @ 960x960
img2img @ 1024x1024
I believe this issue is somewhat related to a bug report I made a few days ago https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/2841 where the noise resize function does not work. if it did work it should resolve the issue where we can use seed variation to generate a low-res seed for hi-res img2img
Was this problem solved? I still get multibody or extra heads if I put resolution higher that 512x512. I tried to make input img 512x512 and change it to resolution I want - same effect. The only way to fix this includes much more steps that i need, and it means much more time. I need to make first a small resolution image and then adding 10% of noise every step, to get what should be done from the start.
The option of Highres Fix. is missing SO very much I definitely agree. I generate a hundred let's say 512x512 images. I chose the one(s) that look already great. Send them to img2img in order to generate similar variants at 1024x1024 and ... I end up with 3 legs, 2 head, faces inside the body, pieces of legs and arms everywhere. It's a f..king mess. Only way to use img2img is to reduce diffusion enough so that all results will be very very close the original. It sure works, but it's way less interesting. Highres Fix option should be in img2img, most definitely agree. Hope it's something that's being implemented. As it shortens a lot perspectives of creativity.
I don't have any knowledge of how the underlying system works, so if someone more knowledgeable could comment, it would be great.
But if it isn't a dirty hack or requires a lot of code, I too would love to see the high res. fix option become available in img2img.
High-res fix is needed for (inpainting) 100%
highres fix is img2img it takes the img gens at a smaller res and then upscales with img2img you can already do this with img2img just take the img your generating use the same or similar prompt reduce denoising rate then change resolution and you will effectively have a highresfix
I think the point here is that the steps are well known and can be automated but currently aren't for img2img.
Any progress on this? This feature will be added?
I'd also like to see this implemented. My scenario: I want to use inpainting to mask the subject but keep the background the same while running an X/Y/Z plot script using Prompt S/R, which is used to generate slight variations in the subject's appearance while keeping the pose fixed via ControlNet/OpenPose. I can easily achieve the slight variations in the subject that I'm after in txt2img, while also doing a Hires. fix for each iteration of the script in order to add detail/sharpening; the issue is keeping the background the same, hence the need for inpainting. With inpainting however, I don't get the added detail/sharpening of Hires. fix. Trying to upscale in img2img results in super weird changes to the image (extra legs, bent arms, and horrific other things 🤣). Maybe I'm not using it correctly, and if not, then trying to do what I can achieve in txt2img is just not intuitive. My above scenario/process would greatly benefit from having Hires. fix in img2img.
So, still no "Hires. fix" support in img2img ? I know that hires fix is practically img2img already, but, we can NOT choose the >>upscaler<<. We can choose the upscaler in Extras, for example (even two of them), but we can not choose the denoising strenght there. There is no place where you have FULL control in A1111. It might be doable in ComfyUI
I started to develop it today
@Nampo
I know that hires fix is practically img2img already, but, we can NOT choose the >>upscaler<<.
we always can Setting > Upscaling > Upscaler for img2img
typically upscaler is something that you set and forget about it so there's not much benefit for it to be placed on the UI by default
but if you do want that you can add it yourself
read wiki/User-Interface-Customizations#additional-options-for-txt2img--img2img
just add upscaler_for_img2img
to Settings for img2img
Yes, it's useful. I use this + inpaint-difference extension, to simulate hires fix for inpaint. And it can be used for img2img upscaling with no tilling. Much convenient then Ultimate SD / SD upscale if you don't use tiles
I really think the highres fix is valuable for txt2image, and would love to see this option available for img2img as well. Thanks