How to UPSCALE with Stable Diffusion. The BEST approaches.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
I was so wrong regarding StableDiffusion XL. Sure, it has quite high resolution, understands short prompts and generates great pictures. But for StableDiffusion 1.5 there are improved custom models which deliver same quality or even better. And they have a better performance and require much less memory than SDXL. There is only one challenge, the resolution. Usually these custom models are trained with 512x512 or by 768. But there is a fantastic solution. Upscale. In this video you will learn in detail how to use different ways to upscale a picture generated by a custom model and by comparing the results you will see the advantages of each method immediately. Let's start. StableDiffusion XL is great, but now there are many models for StableDiffusion 1.5 that have been specialized and improved. You find these models usually at CivitAI and HuggingFace. And if you scroll down, then you find a description and advices how to use them. We will use the epicRealism model, but if you want to download one of the models yourself, make sure to read the advices. In how to use there is a description which parameters shall be used. In order to show you how to upscale we need to create a picture. And we will use the epic Realism model. I quickly show you how to install this model. Be sure to click the right button and download the model save tensor. We put the downloaded model file into the StableDiffusion home directory and models StableDiffusion. Well, as you can see I have already some models here. We just replace. We have downloaded the model, but as we have seen in the description below there is a hint to a certain upscaler which we will install too. Following the link we find the database has moved. So we go to the new URL, look for the Superscale. Here it is. We look into these directories. The Superscale is here. Look inside. We want to have the 4x Superscale. And here it is. That's what we need. Download. In this tutorial we use the Automatic1111 WebUI. The steps are same for Windows, Linux and macOS. We go to downloads and move the file to the StableDiffusion models ESRGAN-directory. You can see it's already there. Okay, just replace. Now we are prepared to generate a picture. We make sure to consider these parameters. First of all we select the model "epicRealism". By the way, once you have downloaded the model and the upscaler you might have to reload the UI or maybe even stop the backhand and start both the backhand and the UI again. So as we have seen in the parameters for this model we have to set the sampling steps for something above 20, say 25. Sampling method, I think this one here is the best. We increase the height to 768, CFG scale to 5. Then of course we need a prompt and a negative prompt. Generate. As you can see the generation is much faster as with StableDiffusion XL. This one here looks good. I think for our upscaling exercise that's a perfect picture. In case you want to use this prompt yourself even when using this special negative prompt for some reason sometimes the model has, well, not that much cloth. So be careful with that. When using the image viewer you will notice when zooming in you can immediately see the pixels. What I should mention here is that you could in theory use the high-res fix for upscaling. Don't be confused by the name, it's an upscaler. Here you can choose the upscale module so like ESRGAN and the anime version. If you choose 0 for the high-res steps then it's equal to the sampling steps. Otherwise you can simply set whatever you like. The denoise strength, well, we shouldn't put it to such a high number. It's better to have it around 0.2 and upscale by 2 or by 4 times. You can try yourself but on my machine with a GPU which has 16 GB VRAM it doesn't work. It simply crashes with an out of memory error. The only thing I can do is upscale by 1.5 no more and the quality is quite okay but well because of the memory consumption that's from my point of view not the best option and that's why we choose a different way. So now we choose the simplest version of upscaling a picture. Send this image to the extra step, resize by 4. That's a good value. Now we have to choose an upscaler. In order to show you how it works first we will choose nearest because nearest is working on pixels and nearest pixels. By the way you can find these images in the StableDiffusion web UI directory then in outputs, extra images and you can see it's bigger but the algorithm is not that good. We can still see pixels here and that's definitely not what we want. So we choose another upscaler and usually this one. ESRGAN. That's a good one for most cases. In case of anime you should choose this one. It includes a deep learning network itself and well somehow it's trained with a lot of images. Then it analyzes our image and scales it with some more intelligence. You will see the result immediately. Resize to 4 times and when we just zoom you can see no more pixels but it's that smooth that you cannot see any details. It's much better than the nearest pixels algorithm and if you want to do a quick upscale without seeing all pixels then that's perfectly fine. But there are better options if you want to have such a good result including more details. Now in order to improve the upscaling quite a bit we go again to text to image and we send the image and the parameters to the image to image tab. We can still use the negative prompt but for the prompt we remove everything that is specific for the woman. In large office can stay as it is. The rest details now have been removed. In case you have only one or very few expressions in the prompt you can remove them completely and just write highly detailed. That's good enough in this case. Now we have to make sure to fit the parameters for our upscaling sampling method so it should be same as during the image generation. This includes the epicRealism model too. Don't change it. Sampling step 25 that's okay. CFG is 5. Denoising don't use too high value something around 0.2 is most of the time sufficient. More denoising results in more deforming so usually that's not what we want. Yeah we choose a script. The SD upscale script is already included in your default web UI installation so just choose that one. And scale factor is four. That is quite important. We have to use the tile size by using the width and height and we set both to 512. 512 by 512 is the default size of stable diffusion 1.5 and usually it doesn't consume that much VRAM so we can easily use this one here and the upscale picture is divided in several of those smaller tiles and that's why it's very easy to use graphic cards with low memory even they will be able to generate an upscale picture. Okay I think that's all regarding the parameters. Now we have to choose the upscaler we have just downloaded as you remember the Superscale and that's what we choose and now generate. Then we go to the output this time to image to image and here we have the upscaled picture. As you can see no pixels so that's great. And we have lots more details. It's not that smooth anymore but instead you have lots of details. Look at the eyebrows, look at the eyes, the hair that's much improved but although it looks good it's still not perfect and we can choose another upscaler which is even better than this one. We want to improve the result and choose a different script which has even more detail. In order to do so we choose again the epic realism webpage and there we find useful extensions ultimate as the upscale. Let's open it and we have instructions in the wiki. How to installation we choose this way. Simply copy the url, go to stable diffusion, extensions, install from url, paste the url and install. On my machine it already exists but once you have installed then you will see that it's finished and you can simply go to installed, check for updates, then apply and quit. Then it's reloading. After the reloads we have to drop the source image here again. The one we have generated by text to image. And this time we will choose the script Ultimate SD upscale. Nevertheless we have to set the rest of the parameters here. So sampling method is 2M SDE Karras. Sampling steps increased to 25. Resize yeah that's the tile size of course. CFG is 5. The denoising well 0.2 is good enough. We have the ultimate as the upscale target size type is scale from image size. And we scale by 4 times. Upscaler is the Superscale again. The rest stays as it is. Now let's generate. To the left there is the result of the ultimate SD upscale and you can see there is a bit more detail. The difference is not that big but if you look at the skin and at the eyebrow then you can see we have a bit more detail. Now we'll have a look at the best upscaling solution ControlNet. By the way if you want to see more videos like this press the subscribe button. In order to use the best method for upscaling we go to the epicRealism webpage again and in the useful extensions there is ControlNet. Maybe you've already heard about it. It's another neural network and it can be used for several tasks even like defining a pose of a person and installation that's quite easy and very similar to the ultimate upscaler. So again we go to extensions install from url. We have just copied, pasted there, install and as usual we go to the installed tab, check for updates and apply and quit. Again my backend has been quit so maybe like on my machine you have to restart the backend. There are still something left. We have to download some models for the ControlNet. You will find them here in HuggingFace and required are the files with ending pth. I have downloaded all of them and installed them all on my machine but for upscaling you only require this sd15 tile pth. You can download it here. After you have downloaded all files or at least the tile one you move them into StableDiffusion, webui, extensions, webui control net, models. Well i've chosen all of them but for upscaling as i've mentioned you only need the one with tile. After copying everything you just have to reload the ui and then as you already know we put the original file here. Select the parameters as usual. We enable ControlNet unit zero. Control type is tile. Tile resample is correct. That's the model. Control weight. You can experiment a bit with that one but for the start I suggest to choose one. Starting with 0 and ending with 1 says the ControlNet is applied to all of the sampling steps. You could choose another interval but at least for starting with this ControlNet I suggest using the default values. Downsampling rate. Well we don't change something here. Then we just choose a script again for upscaling. Again we choose ultimate sd upscale script. Here from image size scale by 4. Upscaler is the Superscale. You can try different upscalers like ESRGAN or even the ultra sharp upscaler. You can download that one at the same place we have downloaded the Superscale. Just do some experiments and feel free to change those things. Same is true for the denoising strength. Start by say 0.1 or 0.2 and increase slightly if you want. But from my experience higher values than 0.4 or 0.5 might have bad results. So let's start. You can see we haven't entered any prompts. Usually the ControlNet is sufficient in order to upscale just on the base of the source image. An advantage of using ControlNet is the result is a bit more stable. But let's compare the last two results. To the left you have the version which is upscaled by using ControlNet. To the right that's been done with the ultimate sd upscale. Although here are just very few improvements the result is much more stable and you can use this as a source for another upscale and upscale again, again and again. Easily upscale to 8k or whatever you like. Here is the comparison with the upscale without using a script. The skin is much smoother and has nearly no details and by using ControlNet we have a lot more details. And just to remember here to the right is the original picture. I hope you can see the difference. To summarize use ESRGAN in the extras tab if you don't need details or if you want to see the results immediately. For details use the sd upscale script or the ultimate sd upscale script in the image to image tab. If you have some time choose ControlNet for best results or if you want to repeat upscaling several times. If this video has helped you upscaling your pictures please consider leaving a like or a comment.
Info
Channel: Next Tech and AI
Views: 31,939
Rating: undefined out of 5
Keywords: stable diffusion, stable diffusion tutorial, stable diffusion ai, stable diffusion xl, nexttechandai, automatic1111 stable diffusion, ai art, stable diffusion upscale, upscale stable diffusion, upscale sdxl, sdxl upscale, upscale image, upscale image ai, upscale image ai free, automatic1111 upscaling, automatic upscale, upscaling automatic1111, upscale stable diffusion images, upscale stable diffusion anime, stable diffusion upscale image, stable diffusion upscale low vram
Id: eV-ZQfIqFfQ
Channel Id: undefined
Length: 22min 16sec (1336 seconds)
Published: Sun Dec 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.