ComfyUI : Ultimate Upscaler - Upscale any image from Stable Diffusion, MidJourney, or photo!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everybody Scott dot Weller here the QA guy for stability.ai and what I want to do is to show you my upscale technique for getting really big images now I showed you a technique in a previous video and that technique is very valid in fact I oftentimes mix them as I'm trying to troubleshoot images but ideally I want a graph where I can drop any image in and it'll go ahead and upscale it I don't want to have to type in numbers or figure out things so today I want to show you how to upscale using a calculator to determine the optimal size for SD Excel because it's been trained in certain resolutions we want to make sure we match those so I'm going to show you a couple different custom nodes we're going to need so click on manager we installed the manager last time and I am going to go ahead and turn on this badge nickname here so you can see the badge over the top of the box you'll see what I mean in a moment on our custom nodes I have the set to installed you can see these are the ones I have so here's our control net we just did a couple days ago the comfy manager which you obviously see over here and with the ultimate SD upscaler here this is a fantastic tool which will break the image down into tiles and into each tile comfy math which is really needed because we do a lot of mathematical operations but it isn't built into Company by default and then a recommended resolution calculator this is the key to the whole thing here to make sure that whatever we get it will match the sdxl recommended resolutions okay so the first thing Let's do let's load in an image okay there you go you see it's pretty sizable so let's take this image and let's work with this so to start off well let's go ahead and load in our checkpoint okay here's sdxl ready to go and let's go ahead and load in the upscaler so we can see what it requires there are two versions The Ultimate SD upscaler and the upscale without upscale so what this does is just re-tile and add details so let's go ahead and use this one here and we can see what it requires it requires an image that's enough whereas a model requires a positive or negative we'll do that in a second here and of course the vae now the positive and negative we're just going to create blanks here and you could go ahead and put in something here to help guide the upscale if you'd like if you want to add additional detail and so on again depends on the amount of denoise you have here as to how much it's going to pay attention to this or pay attention to what you're prompting the other thing we have to be aware of is that as we're doing this it's going to break it down into tiles here and in fact we're going to go ahead and set this to 10 24 right now because that is what sdxl expects for tile size so whatever you have it's going to take that image and break it down into tiles of 1024 by 1024 and that's pretty much the secret to it here another other tweaks done here for resolving if you get seams but we're not going to have that and our upscale here for denoising is one that means it's 100 going to be replaced this with the tiles which means you're going to get a whole bunch of squares of random things we don't really want that now let's go ahead and set this to something like 0.25 so it means only 25 of what we're upscaling is allowed to change which is enough to add detail to this and I don't need to type a prompt in here so I'm going to go ahead and minimize these and scooch them out of the way now like I said before I don't want to have to type in numbers whenever I'm dealing with any image I just want to drop it in here and have it multiplied Whatever It Is by 4 and scale it up so that's what I want to set up so let's go ahead and load that calculator in it's under utilities recommended resolution calculator and you can see that we have a desired X and Y this is our Target X and Y is handed in and then we're going to go ahead and add this upscale Factor here which we'll talk about in a second so first of all we need to get the size of this image it's under nodes math Graphics so this is the sdxl resolution and the nearest sdxl resolution let's go ahead and use this one and it takes an image as an input and it brings out the height and the width which has been adjusted to sdx cells resolution now in this case I want to multiply these so let's go ahead and put that in so under math again under integer we want integer binary operation and we're going to change this from add to multiply now it gives us an A and A B and it doesn't really matter what you choose here but I'm going to go ahead and convert both of those into inputs and one of them is going to be just a primitive add node here utilities is primitive and changes to a 4. that's the scale factor we're going to want in fact if you didn't know what it was and you're getting lost you can actually right click right in that little Dot and rename the slot but you didn't know that one and then we're going to go ahead and multiply this again so Ctrl C and then hold down shift when you paste and it'll keep a connection so we have our width here and our height so this will multiply both of these by four to give us our upscale and of course you're hinting here that we want an upscale that's a four times upscale and we do let's pull this upscale model out load an upscale modeler and in here I'm just going to grab I like this foolhardy one here this adds a little bit of skin texture so we'll use that one so we're expecting a four times so it knows that it's going to try and get us up to four times but we don't want this to be something we type in to make it just a four because again we don't know what these numbers are going to be so let's go ahead and let this calculator do it and that's what that upscale factor is for here let's go ahead and change this to an input and we'll just use upscale Factor this way now this also comes with a pretty handy thing here this is the reverse upscale so if you're using a four times upscaler but we only want to upscale by two for example it will go ahead and upscale it and then down scale it if you're using a four times upscaler so that it only is twice the size in this case let's go ahead and we need our desired X and our desired y to be plugged in here so let's change those inputs so here's our X which is our width our Y which is our height and now no matter what image we drop in over here and we'll go ahead and multiply it by a scale factor of four and create those two numbers for our desired X and Y this will go ahead and figure out what that scale factor is going to be and hand it to this here which will then take it and only denoise it by 25 percent into 1024 by 1024 boxes let's go ahead and up our steps a little bit here because when this is done I think I'm going to love it so let's just go ahead and do that let's go ahead and save that image off and we should be good to go now this is not going to be quick okay it's a big it's a big image to start with and it's going to break it down into pieces and if we bring up our console we can actually watch this thing go so let's go ahead and keep prompt and bring that up now you may be wondering why am I using the nearest sdxl resolution from company math and then putting it into the recommended resolution calculator am I not just doing the same thing twice I am but I have a scale factor in the middle that right now is set to four and it may not always be four maybe I want to upscale by one and a half times or 1.7 times but regardless I want to know what it starts with make sure I get that to the right resolution then pass that on to the recommended resolution calculator in the second half now if I was a node that just pulled the width and height I wouldn't need to use that one but because I have comfy math anyway I kind of get both at the same time okay that took a while 354 seconds you're like wow that took forever yeah we'll learn to paint you know that takes uh years so if you were able to do this pretty fast I'm pretty satisfied with uh waiting 300 300 seconds let's go and find something to do like record a video there we go we have a nice upscale and again unguided as far as prompt goes so again you can hand it whatever kind of image you like from stable to Fusion mid-journey I'll photograph it doesn't matter it's going to go ahead and upscale it and add again detail from the sdx so model Guided by your prompts and the amount of denoise you had and again in 1024 by 1024 upscale here so it did create 16 tiles to make this work but again I don't know how many tiles it's going to take again it depends on whatever image I drop in here and I don't want to have to take the time to figure out the proper resolution for SD Excel to work great we already have that done for us here so there you go uh let me know in the comments below what you think once again thanks to everybody supporting the channel here I'll put a list of the people that have joined again click the shiny join button down below I don't have a patreon I use the one here on YouTube so super easy for you to go ahead and join it and I will put this graph as a post on the private area there for anybody's sponsor level or higher you can grab this graph and download it so you have it to use yourself otherwise go ahead and build it and then you can go ahead and save this off and again to reload it just drag the image in here and it will reload everything everybody take care stay safe and I'll catch y'all next time
Info
Channel: Scott Detweiler
Views: 58,549
Rating: undefined out of 5
Keywords: stable diffusion, stable diffusion xl, ComfyUI, stable diffusion tutorial, AI art, SDXL, comfy tutorial, control net tutorial, comfy upscaler, upscale tutorial, sdxl tutorial, ultimate upscaler
Id: CxB47DMEyYQ
Channel Id: undefined
Length: 9min 2sec (542 seconds)
Published: Wed Aug 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.