Img2img Tutorial for Stable Diffusion.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello friends and welcome to this image to image tutorial inside of stable Fusion today I'm going to teach you how it works and I'm going to show you some tips and tricks along the way so let's get started with the tutorial oh and by the way what do you think of the new camera and uh the new setup here you like it I think it's kind of cool and you know the difference between a camera and the sock well the camera takes photos and the sock takes five tails hello hello hello my friends good to see you again so I have this picture here of a woman with a blue hair and this image is actually generated from the journey but it doesn't matter you can use anything you can use stable Fusion generated images you can use mid-turn generated images you can use photos you can use paintings it doesn't matter stable Fusion is going to look at basically in layman's terms the color in the image now let's drag this into our image to image which we will be working in today we're going to check out the various features and tools inside of image image like a sketch in paint in paint sketch Etc but let's just start with a regular image to image let's say we want to change this let's put in man with blue hair I'm gonna load some of my Styles and load the default negative and realistic photo portraits these styles are not default in stable Fusion you're going to need to go into the video description and download them there they're free now if you've been following one of my other tutorials You're Gonna Change the sampling method to DPM plus plus 2m Keras this is not necessary it's just a good sampler to use in general sampling steps between 15 and 25. today we're using the deliberate model most models are natively using five 12x512 768 is also a good Square resolution to use if you don't know what you're doing you can use whatever but if you're new stick with the rectangle formats for now and then work your way up we're doing one image now and now this the denoising strength down here this is the most important setting inside of image to image and all the subsequent features like in paint in paint sketch Etc so this decides how much much of this first image is gonna get transferred into this second image so let me show you quickly here if I lower this to zero we will get zero percent change so we will retain the previous image so it will read the image and basically do nothing with it if we would change this to 1 which would be a hundred percent change we will change the previous image dramatically and if we run several images here let's do four here at the denoising one you will see that they should vastly differ from each other now you will get a man with blue hair but it doesn't really follow this image and I can show you that by doing the same thing so here we have a couple of images man with blue hair but if you just take another image to take let's take this black and white image instead and we're running this again you might be thinking well we should be getting a lot of black and white images right well no because the denoising strength is set so high that the image changes dramatically as you can see there's a slight resemblance in what we have here but we really have no control and this is basically pointless what you should be aiming for let's put this image back in is a denoising strength value between I would say 0.4 and 0.7.8 depending on what you want to do if you want to keep as much as possible of this image while still giving you more detail you can use 0.4 this will keep a lot of the image still intact but still introduce changes and as you can see here it's a different image but they look similar now we said man but it still looks sort of like a woman or maybe a mix between them you can see the piercing here in the nose has almost vanished so if you would want to change it this even further you would have to introduce more noise into the image and the diffusion with the generation and you do that by increasing this slider so let's try 0.6 this time now this looks visually like a man with blue hair and it is vastly different in appearance from the left one if you would ask someone they would probably say that the left one looks like a woman and the right one looks like a man however the composition is still here you can see the blue hair where the angle of the face is similar you have the little bokeh blurred lights in the background those are still retained so that's a great way to change the image but use the same composition and that exact value 0.6 is something I use 90 of the time and when I'm not getting the results I'm looking for I'm adapting this value a little I might erase it a little bit to get more changes I'll lower it a little bit to get less changes and let me show you here if you run four images with these exact settings we will get four different images here but they will all resemble our left input and as you can see all the images that are popping up here live are resembling the left one but you will get different people as you can see in the face well they sort of have similar facial features but they're different people and that's also true for the bokeh and light at the background it's similar but it introduces more detail more changes into the image even the jackets changes a little bit in each of the images so a good way of thinking of it is like think of the colors in this image those colors will transfer to the next step in image to image I think that's a great segue to image to image sketch and impaint sketch so if I would send this to sketch for example send this over here to sketch and if I would paint something let's take some red here and just paint the lips here super red and let's run this again so we have everything the same except we still have a random seed but apart from that everything is the same we have man with blue hair we have the same same Styles in the same settings and if we generate this now it will read this left image as something that it has well a blob of red over the mouth and if you look at these I would say that well we didn't get the desired result in some of the images maybe the lips are a little red or more red but I I can't say that we're getting what we're looking for so what you could do here them if you lower this denoising let's put it at 0.5 for example you should be able to see that we're introducing more red onto the lips and as you can see here except for maybe the third one here these lips are super red these are red these are red and this is just a very crude way of painting straight on top of the image now you could make changes inside of Photoshop photo P or photobash something together but this works too and it's super powerful I could for example let's remove this let's paint here for example let's take yellow here and now let's paint some kind of glasses here so we're trying to do glasses on our face now I can't say this is the best looking glasses I've painted so we have a man with blue hair and we're not changing the prompt now you could add in up here man with blue hair and yellow glasses let's try that in a bit but first let's just run this again so we've removed the red lips and we have man with blue hair and true looking glasses and now we're getting glasses here but they're not looking great at all and this is to be expected when you're working with stable Fusion or image generation in general especially in image to image there is no perfect setting for everything and you need to adapt the denoising strength for every time you test this so let's again let's put it back up to 0.6 and let's run this once more and let's see if we get a more favorable result this time let's let's hope for a happy little accident so this time around we are getting glasses that look a little better now they're not perfect in any way some of the eyes are these eyes are kind of weird these are okay-ish and I like this one here maybe we shouldn't have painted yellow over the eyes it's changed it change the glass too much but this glass here the side looks very nice now you might ask well what if we raise the denoising even more of course you can so let's go over higher let's go let's say 0.8 here now it will dramatically change the image and as you can see in the first one we didn't even get glasses the second one has glasses but it wasn't resembled to how we painted it and the third and fourth didn't even have them however looking at this one here the glasses look much better because we introduced more noise and given the AI more to work with on top of our crude looking yellow painting it can make its own decisions easier when we have a lower denoising strength it's really locked into what we have painted and I wouldn't say that this is a great looking painting of glasses and I don't think you would either now what we can do especially since we had three of these don't have glasses at all then we can add in up here and yellow glasses and if we generate again with the same settings we should be able to see more glasses and I hope you are because I'm not cherry picking these results these are all live generated here with you and me together and as you can see we now have four images with yellow glasses number one and four here kind of messed up behind the ears with the glasses but number two here looks pretty good and the number three here as well so just remember the denoising strength and what it can do for you together with the prompt now another great way to keep working with this is you can iterate on an image moving forward so let's say you have this and you keep generating you aren't getting what you're looking for maybe you're getting this all the time or or this so what you can do is just you can send this to for example image to image or in paint depending on what is wrong with the image in paint will fix a part of the image in image to image will fix the whole image so let's send this to image to image for example now we have an input where the glasses are actually looking pretty good except for the back part here so if we work with this image we could actually lower the denoising to about 0.6 and we could run four Images here and this input will be better than what we had with the woman and our crudely painted yellow glasses maybe you you can tell I got an A in art from how I painted that and as you can see in our result here it will except for we are getting here the first one is actually pretty good now some of these are a little messed up but just keep working with them and let's take the say we have it this is a good image so take that one and you can keep it rating on that and then if you say okay this is very close to what I want but I need I need like oh this isn't exactly I need a difference somewhere then you can just keep working and lower the denoising let's go 0.5 because we're getting close to what we want we're lowering the amount of change we get into the image so we're getting four new images and these will be more similar to the left one but still introduce some changes in the image and here you have a new Choice let's say oh I don't like this one because there's some hair here and oh I don't like this one because of the eye and you say okay this one feels good and that's how a great way of improving and iterating on an image now let's say you have an image that you like but you don't want to change all of the image then inside of image to image there's a feature called in painting and I have a full guide on that so you can check that out in the link above but I'm going to quickly cover it because it's a feature of image to image so if you send this to inpaint two modes of him painting the first one just basically paints a mask so let's say you paint the eye here you can say human eye we're changing this to only masked which will give it more detail and if we generate now let's put it up to 0.6 again we're doing four Images if we generate this now you will see that it zooms in as it will only generate this part of the image of the eye here and it will give you hopefully a better eye but at the very least a higher resolution I these turned out a little bit too big in my opinion let's actually change it also to Blue human eye and then let's lower the denoising so we're not going too far away because we're just changing one eye we don't want it too different from the other one now we're using more of over there previously but we're still raising the detail of the image and as you can see in these versions we're getting better looking eyes and I think even the third one here is looking pretty sweet now this is obviously not a super sharp high-res image it's just a 768 by 768 but I think you you see what we're getting at so this is the regular in painting and again check my detail guide for that because that's like a full 10 plus minute video the cover is specifically just to the end painting now if you send this to in paint sketch let's drag that over there and send that to in paint sketch now in the sketch previously you will remember we painted red for the lips and yellow to get his glasses and the regular impainting you're just painting a mask painting black but you're not getting black if you paint within paint sketch you're getting that color so if we do paint red here for example you're not only masking the eye you're getting red in that eye so let's see this paint there let's put it into a little white here so this should get us a pretty weird looking eye let's change it to Red human eye and the difference here within paint sketch and the previous sketch that we used in the previous sketch everything of the image changed now we have a mask and a sketch so the eye is masked and the color is added so you will see again that it zooms in here if you have only masked selected let's add the denoising because we want more changes this time around now this eye will probably not match the other eye but it will give you us a different results depending on how you've painted this and again this is a super crude way to do it you can do it much much better if you work in like Photoshop or a better tool and as you can see we're getting sort of the result we're looking for but it's kind of blown out so we could do is we could revert back here and let's paint that red again and just do that this part here the red here and maybe raise the denoising a little bit and generate again now you'll get you will keep the white on the outside that's more resemblant of what was there previously in the picture and just adding red on top of this now it's a very strong red but that can be adjusted with the denoising slider so just to play around with that and like we did previously you could send this let's say that you like where this is going let's take this one instead of our crude sketch we're going to send this to in paint now we have the red one here so we could mask this and make more eyes out of this better input so I think that's a great way of thinking about it generative AI is not just a one-click solution it can be depending on what you're looking for but if you want more control of the process you're gonna have to iterate one step at a time and as you can see here the eyes are well turning a little bit better each time now it's still not it's still kind of popping out too much the in the image but I think a third one here we're starting to get what we're looking for and you can also treat this at a photobash let's say this is a result that you want to upscale and get better you could send this back straight into image to image where we started and rework this whole image so let's say man with blue hair yellow glasses red eye and let's lower the denoising because we're very very close to what we're looking for and let's raise the size here let's do a thousand by a thousand let's do two images and we're generating this so now we have a new input that's vastly different from what we had in the beginning with a woman we have the glasses we have the red dye and everything this will get us a result that is more realistic all over basically I would say this isn't perfect looks like some sort of reptile eye this one's maybe getting closer to what we're looking for but this is where you're gonna have to keep working with it yourself like I said the denoising strength there's no perfect value I tend to go between 0.4 and 0.6 and raise it above 0.6 if I wanna increase more changes I rarely go below 0.4 unless I have a specific use case in mind now a different use case of image image could be something like this let's say you have this image generated from stable fusion and this is a low res 512x512 image and you want to get this to a high resolution and upscaling it will not introduce more detail now another way of working could be using text to image and using the high-res fix but if you have an image already what you can do is input this here so this is a castle here you have a character standing in front of it this is 5 12 by 512 so you can either change the settings here by yourself or you can use the resize buy so if you change this we're going to scale this up to two so it's going to be from 512 by 512 to 1024 by 1024 and let's do four images of this and my favorite setting 0.6 so this will introduce some changes into the image while still retaining a lot of what is here we're not changing anything else now the resize mode is here we haven't talked about them but they're only interesting if you're using images that are different in scale to what you're resizing let's say you have a square image here and you're resizing to like a vertical or horizontal then these decide how this is changed so crop and resize your lab you will crop this and lose part of the image resize will basically just resize it resize and fill is used to a lot without painting because then you can resize this and add to the edges but you don't need to worry about that too much now just check on my in painting guide or the out painting guide to go through that in detail anyway let's go back to resize this by two and let's say here hero Adventure standing in front of Epic Castle and we're gonna raise this up a bit with Ctrl Arrow up we are generating four images with denoising strength 0.6 and you can instantly see that we are retaining a lot of what was there previously all the images will resemble the left input however the input is 5 12 and the output is 10 24 in resolution so we'll get a bigger image with more detail now bear in mind big resolution will take more GPU power but as you can see we are getting better looking images you can also see why there are similar they're not exactly the same especially if you look at the hollow part here under the rock or the mountain here we even have some sort of lighting going through which looks pretty cool so this is a great way to introduce more detail into an image that is low resolution and you can even keep iterating on this so you could send this back to image to image and resize it again now this will take immensely more of your resources because you would resize it up again to 2048 and going that high I'd recommend you use the tile up scaling I have a tutorial on that so just check the one with the says 8K something something so I hope you enjoyed this um that basically concludes this image to image guide I hope I covered everything and that you feel that you understand the image to image in stable Fusion a little bit better now please let me know what you think in the comments below and if you have any more questions pop them right in there and I'll see if I can answer and also let me know what you want to see in my next videos as always have a good one see ya
Info
Channel: Sebastian Kamph
Views: 159,948
Rating: undefined out of 5
Keywords:
Id: 2hH2-esDBQY
Channel Id: undefined
Length: 23min 9sec (1389 seconds)
Published: Fri Jun 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.