Closed gohan2091 closed 9 months ago
a side note: mask preview image is so large, unsure why.
I see it picks up that I set the target dimensions here:
2024-01-30 18:38:05,661 | sd | DEBUG | images | Image resize: input=<PIL.Image.Image image mode=RGB size=1024x1536 at 0x19FB0EC4A90> mode=1 target=512x768 upscaler=ESRGAN 4x Ultrasharp function=control_run
then it shows this:
2024-01-30 18:38:10,352 | sd | DEBUG | images | Image resize: input=<PIL.Image.Image image mode=RGB size=512x768 at 0x19FB175C310> mode=1 target=896x1024 upscaler=ESRGAN 4x Ultrasharp function=control_run
can you check with latest dev?
can you check with latest dev?
I have updated and now using dev version: 2024-02-01 hash=060c92c0. Unfortunately I do not see any improvement. It's still doing exactly the same thing.
The preview in the output gallery within Control menu is stretched:
The image located in \AppData\Local\Temp\gradio is saved as stretched. The image located in \automatic\outputs\control is fine.
While I am sure you have more important things to spend your time with, I would love to hear an update on this issue as I am having to minimise SD.Next and open the image in the outputs\control folder everytime I generate an image. and want to see the result.
i just tried and cannot reproduce with latest dev.
try to reproduce and if you still have a problem, try to explain the workflow once again - maybe i missed something.
also, set env variable SD_CONTROL_DEBUG=true
before starting the server, it will increase verbosity of logging so I can see what is triggering apparent second resize.
Ok, I will try to explain the best I can in as much detail as I can.
I am currently using version: 2024-02-04 hash=a4dbdc04. Here is how to replicate the problem (but there are other ways, this example is very simple):
1) Open an already generated image into the Process tab. As an example, let's use this one:
2) Send this to Control using the >Control button in the Process tab (Settings aren' important, let's leave them according to the PNG file.) Here is a cropped screenshot:
3) Load a Controlnet such as Depth Zoe XL with Zoe Depth then hit the generate button
Here is the result according to the UI
This preview image is stored in: C:\Users\USERNAME\AppData\Local\Temp\gradio
It's stretched to 896 x 1024 and looks like this:
4) Navigate to \automatic\outputs\control and the image looks like the below which is correct:
The actual image is generated correctly with the correct size and aspect ratio. It's the preview image displayed in the UI (which is stored in the Temp\gradio folder) that's the problem. Here is a fresh sdnext.log and I have tried (although I may have done it wrong) to set the env variable as you asked. Here is a screenshot to show this.
debug flag is set correctly. using your image and your workflow, i cannot reproduce - see screenshot:
only way i can reproduce is if i explicitly set size -> after -> and then enter incorrect size. and that is exactly what i see in your log.
2024-02-04 21:47:16,675 | sd | INFO | processing | Processed: images=1 time=16.19 its=1.85 memory={'ram': {'used': 2.57, 'total': 63.91}, 'gpu': {'used': 12.92, 'total': 23.99}, 'retries': 0, 'oom': 0}
2024-02-04 21:47:16,706 | sd | TRACE | run | Control resize: op=after image=<PIL.Image.Image image mode=RGB size=1024x1536 at 0x1CA31840F50> width=896 height=1024 mode=1 name=ESRGAN 4x Ultrasharp
2024-02-04 21:47:16,707 | sd | DEBUG | images | Image resize: input=<PIL.Image.Image image mode=RGB size=1024x1536 at 0x1CA31840F50> mode=1 target=896x1024 upscaler=ESRGAN 4x Ultrasharp function=control_run
2024-02-04 21:47:16,728 | sd | TRACE | ui_control | Control received: type=<class 'tuple'> (<PIL.Image.Image image mode=RGB size=896x1024 at 0x1CA3139DF10>, <PIL.Image.Image image mode=RGB size=1024x1536 at 0x1CD818FFBD0>, 'Control output | 1 of 1 | Image 896x1024')
after everything was done there is one more resize which results in incorrect dimensions you're seing. and that resize after is definitely NOT enabled or set by default - that is your setting.
So from reading your reply back 5 times, I finally understand. The Resize AFTER is messing up the final output even though I am only using Resize BEFORE. So the two menus Resize BEFORE and Resize AFTER are used together? and aren't independant of each other? I did not touch Resize AFTER at all however when I installed SD.Next, I went through the different sections, opening up menus and configuring values that I commonly use and I set those as new defaults and menu states as new defaults. So I can only assume that the Resize AFTER is permanently set to that fixed value of 896 x 1024 despite whatever image I send to it. Now I know, thanks for your help.
resize before and resize after are both used. before is used on init image before processing. after is used on final output.
for example, if you have 2k input image, you cannot process that on normal gpu. but you can resize before 0.5, process at 1k and then resize after 2x back to 2k.
resize before and resize after are both used. before is used on init image before processing. after is used on final output.
for example, if you have 2k input image, you cannot process that on normal gpu. but you can resize before 0.5, process at 1k and then resize after 2x back to 2k.
That's good to know, thanks for explaining that. There is so much about the Control menu I do not know but with time I can learn and I will feel more comfortable with it especially if you continue to improve it. Not necessarily with new features (although this is welcomed) but more about improving on what it can already do, making it more intuitive to use for newbies etc. The upcoming documentation should help.
Issue Description
In the Control menu with a 1.5 checkpoint loaded, I upload an image that's for example 896 x 1024, I choose the ControlNet model and processor (can be Depth, Canny, anything really). I set the image size under FIXED to 512 x 768. After the image has generated, wtihin the Control menu interface, the preview image is stretched to 896 x 1024. This happens even if I upload an image that's 512 x 768 and keep the FIXED size the same, the preview image is always stretched to 896 x 1024, Opening the preview image in my web browser or going to the folder where it's stored (AppData\Local\Temp\gradio) confirms it is stretched. When I open the actual output file that's stored in (\automatic\outputs\control) the image is not stretched and has obeyed the dimensions I set. Here are some examples:
Version Platform Description
Dev branch 30-01-2024 hash 5faa144a, Windows 11 23H2
Relevant log output
Backend
Diffusers
Branch
Dev
Model
SD 1.5
Acknowledgements