Upscaling - The Basics - Stable Diffusion (ComfyUI)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome back in today's video we're going to be talking about upscaling images and the various options that you have available to you to upscale an image so open up your comy UI make sure you running the latest updates both comfy UI and or any extensions you may have just keep seeing up toate and relevant uh once youve done that let's make sure you have these following custom nodes installed the comfy UI impact pack the tiny Teran nodes the ultimate SD upscale The Comfy roll and those are the ones that I need you to have installed to if you want to follow along with this video okay once you have the custom nodes installed also click the install models and search for upscale and go ahead and install all these upscale models and download them to your machine I've already done that ahead of times just to speed things up once you have the models and the custom nodes installed restart your comy UI and head over to this blank canvas so the first thing we're going to do is a out of the box kind of image upscaling that just comy UI gives you from from out of the box so let's load an image okay and then you can look over here at the image upscaling they've got different ways to upscale all right so the two we're going to look at today is upscale by a scale factor or upscale using a model so if I say upscale by you can see that I've got this scale by Factor right so if we want to go four times upscale we can do that and preview that image let's cue that up right so this is a way to upscale this image [Music] here if you zoom in you can see it's still got lots and lots of uh pixelization or artifacts I guess uh as they call it so this is not a great way to upscale your image uh a better way to upscale would be to use a model so if we upscale using a model and we preview this [Music] one we use this upscale model loader over here and we choose the one of the models we've downloaded so these these should be all the models that we downloaded from The Comfy UI manager and we try to preview that one and you compare these two images you can see immediately that the one using a model on the right is much better than this one on the left right so in general I recommend using an upscaling model right now how do I know the size of these images right so this is this is tip number one if you right click here and you say open image your browser tab tells you the size of the image so this is 512 x 512 and over here we are upscaling to 2048 by 2048 right so that's step number one all right now in this example this is out of the box right so I've shown you two ways out of the box to scale your your images uh if and this is more of an image to image of scaling but if you want to have text image first then we can do that too right so let's clear this out load the default workflow okay get our checkpoint selected and our positive pront to negative front Okay and of course when it runs through this workflow and it decodes it we we just going to upscale it here at end so what we do is we choose one of those upscaling methods using a model and then preview our image okay so that's how you would do it when you're running text to image and this is our upscaled four times image see it's by looking at the tab 2048 by 2048 now tip number two is you know just a nice little info is if you don't want to do mathematics here you can for example just do to 256 * 2 and it'll automatically multiply that for you and fill in the text box so that's tip number two for conf all right so that's out of the box now let's look at some of the extensions that we've installed the first extension is the comfy roll extension and the way that works is something similar so let's clear this out let's load our image all right now we need to get the comfy roll upscale so upscale image and we do that just drag this out okay and they've baked it all into one node over here so we can choose the ultra sharp upscale model and upscale by four and we can CU that prompt and now we have an upscaled image 2048 by 2048 using the comfy roll custom node and similar thing if you if you didn't have a load image and you were using text to image you would have all the nodes prior to this getting you to the pixel space and then you would just drag in your pixels to the upscale right so that's comfy Ru next on the list would be um tiny Terra so let's look at the a tiny teror way to do that so clear this out right and it's a slightly different workflow what we're going to do is use these pipes so we'll choose our checkpoint and then we will put in our negative promp and our positive front and then we need a sampler so we'll follow the same Tiny Terror sampler where we join these two pipes together and everything else is optional now the typical uh workflow would just be you know drag an image out here but what we want to do is we want to upscale it so what we do is we look here for their higher fixed scale and we join those two and the VA and we're going to use this image here to preview let's put these two side by side and key up the front all right so this one should be 512 x 512 and this one should be uh 10 24 by 1024 right so yep 1024 by 1024 Okay the reason why it's 1024 by 1024 is because we have used this 50% rescale if you went 100% then it would be four times that if you zoom in you can see it still turns out very very well and yep it's 1024 by 1024 okay so that's how you would upscale images with your Tiny Terror custom nodes now let's look at the ultimate SD upscaler all right so let's clear this out and we need to load a checkpoint and we need to load an [Music] image and then we need the ultimate SD upscale node to this one so we have quite a few inputs here we have the image model positive prompt and so on and since I'm working with an image I really don't need the positive prompt negative prompt and so we're just going to leave them blank when we when we add in the clipping codes so let's bring in this image here we bring in the model and we can bring in the vae right so but what we also need is those prompts this prompt to the positive here and we can collapse that and this negative prompt to here and we can collapse that I'm not going to type anything in there cuz I already have a an image that I'm working with and then the next up is the upscale model so we will use our Ultra shop upscale model and that sets up the ultimate SD upscale node and now we can preview our upscaled image but before I click preview let's just make sure a few things we can set this to four times upscale and be careful with the D noise make sure the D noise is not one it's somewhere between 0.2 and lower and otherwise you're you're changing the entire image and it's not going to come out the way you want it all right let's preview this ultimate SD upscale image at 2048 by 2048 okay last one that I want to show you is the impact pack okay uh I think it's a little bit more involved but let's see if we can do it so let's clear this out and let's get everything set up here so we need a load uh [Music] checkpoint we need a positive prom and a negative prom I'll just color this in so we we know what they are then the way impact PCT works is it works with these pipes so we we need to get all of these into a pipe so over here in the impact pack there's this pipe two basic pipe and we going to hook all this up okay let's just fill in our checkpoint and our prompts okay now we need to take this pipe and send it through a sampler and if you go here and you look for the cas ampler it's not here at least not the one with the pipe you have to go to sampling the default sampling menu and then there's the K sampler pipe that way now this basic pipe can be dragged to this basic pipe okay then similar thing we need empty latent image okay and uh that gives us the the latent image over here that we can decode that so let's go ahead decode that and preview the image now let's just make sure this all works yep okay great so it works what we want to do now is upscale this image okay and to upscale it there's two ways impact allows us to do that one is upscale the actual pixels or upscale the latent um space so uh before I do that I want to do another tip for you everyone uh which is if you hold down control and you select all these nodes actually let's do it one more look for an upscale model yeah this one so let's select all these nodes using control and then right click and say convert group to group node right now it's condensed all of those into a really nice node where a pipe is coming out and we can choose our checkpoint our upscale model and we have a positive a negative prompt so I just simplified the whole diagram right so now let's go ahead and find our upscale image okay so this is how we will upscale an image and it's expecting pixels so this is our decoded pixels we bring that in and we can bring in the vae and then of course we need an upscaler so the upscaler is this pixel K case sample upscaler provider pipe this is the one we need right and over here the basic pipe goes here and then our upscale model goes there then lastly we can preview that image so this is the original image and then this is the upscaled image now before we cue The Prompt let's let's use our force force times upscale but we also need to be careful with the D noise right d noise is we don't want to change this entire image completely at 100% so this make sure this is 0.2 and we can cue that up all right there's our image let's open it up you can see it's 2048 by 2048 and it's pretty good uh no pixelization or artifacts so that looks pretty good so that's one way is to use the pixel space the other ways to use the latent space so if we add another node here and we use this iterative upscale latent then it has similar s similar setup all right it's got an upscaler so we can just reuse this upscaler and but the input is samples and not pixels so what we in this case we already decoded to pixels so we will just take the latent samples over here and bring them in there and then we have to decode after that let's have a look now we should get very very very similar images okay um we made a small mistake here I just forgot to make this four times let's cue that again for okay there we go so we have very very similar images all right so just two different ways to upscale using impact pack one is with a pixels and one with the lat okay and so that's all for today and I hope you enjoyed it if you want to learn more about stable diffusion and comp UI check out the links Below in the description and I will leave this GitHub page for where I have all the workflows if you come here and you look at upscaling I've got all the various things I demonstrated in this video today and as always please support this channel by subscribing and clicking the like button below
Info
Channel: Diffusion Tinkerer
Views: 438
Rating: undefined out of 5
Keywords: #tinkerer, #ai, #art, #diffusion, #stablediffusion, #comfyui, #generative, #txt2img, #img2img, #civitai
Id: 2EP_LIQmnHA
Channel Id: undefined
Length: 21min 32sec (1292 seconds)
Published: Fri Dec 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.