Mastering SDXL Inpainting: Create Stunning Art with Stable Diffusion and Automatic 1111

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hey everyone welcome back to alchem zero phase this is Eric and in this video we'll be rehashing the inpainting process uh going through my workflow but this time we'll be uh incorporating the sdxl models it's been brought to my attention that some people people have been having some issues in painting using the sdxl in painting models um I think what it is that it's coming down to uh it's leaving too much of an edge uh you can see the area you've inpainted it's not blending it properly or something now it's been a while since I've done inpainting uh in the sense that uh I had to focus on a lot of other things but the principle should still be the same so we're going to go through that and hang on and we'll try to address your concerns okay so let's start with this you know as I watched a lot of these models come out um I noticed there was not a lot of development on in painting models for sdxl specifically now there is the official in painting model uh for sdxl uh which does not get very good ratings we're going to try it um does not have a lot of downloads and I don't I guess people just didn't uh ReSound with it so um we are going to focus on we'll try that but I'm going to focus on showing you how to use the 1.5 in painting models or even the 2.1 in painting models to achieve what we want to do here so we're going to start off with my favorite model that's sastra Kai model um you can find this one on uh civit AI it's a good uh allround model that does just about everything it does realism it does Fine Art does abstract mixes things really well and so um definitely check it out okay so we're going to start with that we're going to get ourselves an image going here I know a lot of people like to focus on uh people um whether it's in painting eyes the mouth and things like that I usually don't go there just because I use a detailer and um it's very rare I have to actually go in and paint a face but we're going to start off there uh let's get a couple of portraits going here um maybe something a little more intricate uh we're going to um let's do a uh be something uh interesting maybe something like um uh old old photograph of um aristocratic family in fine in ah let's just do that let's just see how that turns out let's just get a couple of prompts going see where it takes us from there we just need something so I can show you how to do the faces and and change things different aspects of the clothing that kind of thing so let's grab those drop this over here into the script that says prompts for f from file or text box we're just going to drop those two prompts in there just going to do one prompt each we're going to do the DPM Plus+ 3M SD carass updated version of the um the the SD DPM Plus+ SD cross uh 2 and and the original one um these particular Samplers tend to have work better in realism and uh uler tends to have a softer look so we're going to do 16 by9 and we're not going to use highrose fixer refiner yet I just want to see what this is going to give us I'm not even going to use a negative prompt let's pump those out and see what we get here it's not bad it's definitely the old photography that I was looking for it's got kind of the sepia tone this is interesting it's actually putting a frame in there so probably not going to use that we'll use the the other one I'll let that finish up okay so here we have um family portrait um definitely interesting maybe you got the I don't know how this would be husband wife and maybe some uncles kids whatever we're just going to roll with it and see what we can get okay so we're going to take that image and take it over to end painting now normally I would have just enabled a detailer it would have gone through all the faces and fixed all the faces for me but uh we're going to go through this so you can kind of see what's involved with this we'll even change some things in it see if we can't uh add some features um and change stuff I think we may even go into using in paint anything to show you how uh you can change very specific things about the image okay so first thing I want to do is uh we come in here and we can see oops that there we go okay so what I'm doing is using the control key which allows me to change the size of the brush um the ALT key and the scroll button will change the size of the actual image okay and um you can actually move the let see if we can do it here I remember how to do it here let's take a look at the information on this again oh that's right F so grab use F and we can actually grab and pull it back over here uh this is kind of a a feature in automatic 1111 uh gives you a little bit of functionality when it comes to being able to uh get in a little closer on some of those images okay so we're actually going to drop that back down like that and then bring this up like that okay so let's uh clear that out and we'll start with this guy's face here we're just going to mask that out now here's where a lot of people have some problems um you know we're not going to do the whole face let's we're just going to fix that part of his face so now the problem that people are having is when they do this they're getting an edge around wherever the masked area is okay I get that it's it's very frustrating um and that deals a lot with the uh mask blur so the default settings on this go to four and when you're dealing with an image that has more pixels than the original 1.5 models worked with you know typically they were anywhere from 512 to 768 um it was easier to do this because it blended it better at four so you got to keep that in mind when you're in painting to increase the mask blur okay you know when working with sdxl images whether you use a model or an sdxl in painting model or not you want to have a higher mask blur on this to alleviate that edge um we're going to do it at four okay we're going to do only masked and we're going to grab the original print prpt on this and then we're going to modify it so that um we're talking specifically about this person's face okay so we want the old photograph and aristoc aristocratic family but we're going to do aristocratic man I think let's give him uh arogant and pompus oops and we can get rid of the the oh you know what yeah no we're going to get rid of that that's fine so we're only masking that we're leaving the mask blur at four cuz I want to show you what it does here let we'll see if it does it and the other thing is we want for in painting we want to switch this to a one: one and we're going to switch it down to 768 because well first of all we're going to start off at 120 uh uh 1024 because we're going to try using the sdxl in painting model so we're going to come up here we're going to come down and see if it shows it in [Music] here oh that's interesting it's not showing it now okay we got it I just had to refresh the list so come in here and so so this is the official one that was released uh again I'm not sure why nobody's really creating in painting models for sdxl I think mostly because the images that sdxl generates are fantastic they they typically don't really need it uh especially with u uh control net okay so we got that selected we're going to do only masked original we're going to leave it at one: one here for uh sdxl size um we're not going to change it a whole lot I don't think we need to we're going to put it 6 we're not going to use a detail we're going to try and do this strictly using in painting okay we're going to try with two batch uh batch size of two to get some uh variation and let's say render generate I keep saying render I think that's a throwback to when I used to use uh oh yeah so this this is something that people were saying um this particular model imp model had issues with let's see if we can fix that I think we had to no it's not the vae what was this let's give it a try we may just bag it here I think this is one of the reasons people yeah I think there one one of the reasons it was getting such a low rating and uh some people were complaining that was just throwing the nans error um guy not working error tensor nans yeah so what we're going to do we're going to shift modes here we're going to just use an in painting mod a 1.5 in or 2.1 in painting model so let's jump over here uh something one of the ones I really liked using was the RPG artist tool since we're working working with something that's more realistic um I think we're going to go with the uh zooya uh in painting one so this is uh one done by RPG artist but um it's photo uh this does have the vae baked in so I don't need the uh vae selected here so we're going to select none if you're curious about how I've got the U stable diffusion vae drop down menu that is under the settings uh I'm not going to jump into that right now there's a place where you can go under UI that you can select which quick access ones you want to have up at the top okay let's try this again okay so for because we're using a I think this is a 1.5 or 2.1 so we should be fa safe using 768 for the size and we're leaving everything else the same okay should pop up the face definitely a much better looking face so as you can see it did do the face but what we're looking at here and let's see if I can I don't know if I can zoom this in at all let's see here is that you're getting a a lot more sharpness you can see how this face right here is not bad it's it's you the eyes are a little odd but um there's a softness to it and it's just due to the camera style I don't know if this is going to be a problem with people but you can see an edge here um around part of this where it just feels a little out of place a little too sharp okay so what we're going to do is try um The Mask bar we're going to pull up to eight okay we're going to render that I mean it looks good don't get me wrong but I think for the type of photo we want something a little softer and now the Mas BL may not fix that but we'll see how it does here so already um we are getting something that looks a little more in line with the rest of the image okay um so we can we can accept that the The Edge that we were seeing before is not necessarily there see if we can get in on this here and so yeah that definitely looks better I mean the it's not as sharp around that edge uh it it mixed it in better so what we're going to do is move on to the next phase so what we want to do is send this over to in painting now that we have a finished face you'll have to excuse me uh my daughter's with me while my uh wife works on other things so that face is pretty good this one's pretty messed up here so let's go ahead and grab that face we're just going to mask out let's redo that we're just going to mask out that part of the face okay we could probably get away with doing a couple at a time but I don't like that um I want to work one face at a time it works better that way uh we're going to change this to woman and hit render on that give me a second that spools up I want that softness I think having it at eight seems to be working pretty good giving us what we want it's not giving us that edge so you got to understand the mask blur is how many pixels deep is it going to be kind of blending with the surrounding area um sometimes you may need to go to 12 it depends on how much of an array you're trying to mix together see if we can get this over here yeah that one turned out well too again we're dealing with an image that's only 1,24 by something a 16 by9 ratio so it is pixelized obviously um and we can go through and do this for each and every one now hands are a little different this has always been the bane of most AI uh image generator especially when you're dealing with multiple individuals a lot of times it's just it's best to mask the hand somehow meaning like hide them behind something but if you absolutely need hands um we can try rendering a few of these to see if we can get something better um let's start with these here uh see if we can't adjust those so let's send this over to in paint and let's go in here we're just going to mask out that and that okay and then we're going to come up here all of I don't know we're going to just say uh 8 year8 year old boy hands okay and yeah bring that back down generate on that I mean we don't have to be too complex with this set up your set up your settings down here get your mask blur where it seems to work okay and make sure everything else set the same and then from here it really is just about uh get the image you like send it back to in painting mask out the new area you know get what you want send it back to in painting so you're kind of going through this cycle okay so again those hands are not exactly what we're looking for let's see I think I've got my yeah this is turned down to 6 let's turn this up to 77 just to see if we can't get something a little different here when rendering this so we are getting I don't know this just just doesn't look right see this is the thing I mean if you're going to do something maybe we ought to have put a gloves on him we could try that uh gloved hands I mean everybody wore gloves back then right who knows they look like uh baseball uh like a batters glove uh not exactly sure what to think of that anyway you know different models handle hands differently and uh so you can also use um the where is it here the depth Library you know they have these different hands this will require a whole another video to go through and explain how to use and uh and understand how that fits on an image as you're trying to fix things like that um a lot of the times it's best to um just render something until you get something that's at least decent or what I've done in the past is I've inpainted objects like they're holding something um for women like I'll I'll make it so they're holding like FL a bouquet of flowers uh for men maybe holding a cane or something like that with this young man here I'm not entirely sure what I would do with that um just definitely interesting we can put that over and move on to something else we can hit eagor here and uh let's mask him out let's actually clear it out make sure we don't have any hidden mask we're just going to do a full mask on him and again we're just going to do photograph of an aristocratic man not going to have to mess with the settings too much I did change the dooy strength we're going to bring that back down and hit that again and a second there we go he looks like somebody would wear a top hat he's got the mustache oh wow interesting gave him a real mustache there anyway so as you can see it's blending the edges pretty nicely I feel like the faces I would go through and redo all these faces just so that they all had the same sharpness to them um just to make the image seem a little more uniform that way and uh yeah that's not bad I'd run with that so we can do other things imp painting other objects where you really going to find the problem is on flat areas back here like let's say we want to add something to this wall back here um like say a photo okay maybe a a wall hanging photo okay so what we're going to do is we're going to grab this we're going to just mask out an area right here okay and what we're going to do is we're going to do old let's do a let's do a uh old photograph of a wall hang hang hanging painting of a forest and Mountain okay doesn't again it doesn't need to be complex but here's the thing you're working in an area that is pretty flat there is no like detail there it's a almost a solid color you get a little bit of gradient going on there and so the AI is going to have some difficulty with that we are going to increase this to 12 on the mask blur we are going to increase the sampling steps this is another thing I should have been doing the sampling steps at least 50 or above for some of this or even 40 and above I'm going to put this at 50 because um it does actually give the AI a bit more room to kind of fit in the steps it needs to do what you want it to do but the config scale we're going to increase two and the dooy strength we're also going to bring up above 80 this is going to I I don't even know if that's going to work we're probably still just going to get a a bland blank wall but we'll see what we'll see what happens a lot of times you have to use fill which basically tells it to start with nothing okay and it Blends the edges into it and and hopefully gets something that looks like it belongs there but we're going to try this anyway we're going to do um we got two batches oh that was where I saw the different mustache yeah I like that one better let's send that one over okay all right so we we're we're looking to get a picture on a wall and we're going to see if that gives it to us with those settings okay I'll try to explain yeah it's not going to give it to us oh oh oh there it goes there it goes but here's the problem it's in color we don't want it in color I mean it is a wall hanging photo um intricate frame so we got the photo but it's color and everything else is the sepia tone right so we're going to that we since we actually got something I'm going to leave those settings as is because we actually got something let's see what the other one looks like yeah color okay now that we're specifying old black and white photo intricate frame cuz I want something that looks a little richer let's see what that does okay now we're getting something that looks like um it's kind of following the same color theme is the rest of it you got rid of the hanging string that's good yeah that looks a lot better A lot better see what it looks like when it come finishes up here gives the drop shadow on it and okay so we got the picture let's check the other one out that's not bad I don't like the fact that it's got a hanging string so we're going to go with this one I like that one send that one over so that worked out better than I thought so we got the settings right on it meaning um increasing cig scale allows AI to have a little more imagination on what's there okay increasing the D noise strength allows for a bit more Randomness and it's able to work with less how would you say it uh context in the masked area because I didn't give it much to work with in there just a flat area so it's harder for the AI to bring something in if you're don't don't increase the the doo strength okay so we're going to do one last thing here we're going to wipe out this okay we're going to come over here and we're going to add some potted plants um these areas this should go pretty well because there's a lot of intricate detail here there's noise it's almost like giving the AI resources to work with you know almost like U I don't know how you how you call it uh um can't work with nothing you know there has to be some sort of a a resource there so let's go ahead and put in a photograph of a a uh Ming vas with a house plant in it let's see what that does oops get rid of my voice dictation get rid of that probably don't need the word in it so let's just see what that does we're going to leave all the noise settings and the big scale and everything else uh as is he's not giving it to us see what we need to change I mean we're rendering two pictures so maybe the second one will we may need to increase these two a little bit so yeah that one didn't oh there it is that that's not bad that's okay it's not a Ming vase but it's a a potted plant it kind of messed up the straight lines here so this is something that you'll notice AI has a hard time with when you break the line of sight of something and I'm not saying your line of sight I'm saying the line between two sides and you'll see this in this image too you see over here you have the uh the um what do you call it the wall railing here or whatever the the um molding along the wall it comes across here you it kind of looks like it might have something here you can see it kind of right here but then it just disappears right here it's cu the AI doesn't there's a consistency it's not quite getting with that you see this a lot in like landscape photos that you render if there's a tall tree that bif skates the the landscape you on one side you'll see the mountains go One Direction and on the other side of the tree you might see the mountains emerge at a completely different height or different style of mountain sometimes so what you're seeing over here with this plant is the plant comes up and kind of intermingles with that and kind of messes up the uh the banister I banister or whatever you know the the Victorian molding along the wall but that that actually turned out pretty good I could render this top part and get something a little bit different now that we actually have a plant we don't have to rerender this the the blankness we'd actually send this over and oh you know what that was actually part of the original thing interesting okay um maybe maybe just mass that out and let's just see what happens here when I um just render that cuz now that it has a plant with a planter there it actually knows and can work with that a lot better oh you know what I think am I yeah somehow I'm I'm rendering what looks like another area over here let's wipe this out start over again make sure it's focused on just this area here make sure we're not touching the man because that will cause some issues because it'll try taking context from the man so let's render that and see what it comes up with so initially it starts off looking like that but it should like did before hopefully maybe not in this one maybe in the other one it's kind of completing the wall a little bit maybe the other one will have a better image of the plane it's interesting that it did that there old black and white photo of a Ming vase with a house maybe we need to simplify that and tell it not a Ming vase just a a floor vase or something let's see how about just vase render that and see what that does here this is the one of theuh tricks to in painting sometimes it just does not want to give you what you're looking for and I think part of the problem is I'm touching the edge yeah you know what that's the problem when you're in painting if you touch the edge it takes that into kind of context with what it is you're trying to imp paint so you try to stay away from the things you don't want to mess with so let's try that a little bit yeah see what I mean now we're going to get an actual plant there this might be a little more fitting to the scene too a little more drab almost yeah and see and you can see how it fixed the the molding up here from the original image where it was kind of messed up right there it's now got a straight line and a corner you actually have a flower it looks like at the top of the plant so that actually fixed the whole thing right there that's not bad um I would actually stick with that so that's kind of a the end painting uh in a gist there's really not much else to it so for those of you who are having problems with sdxl images getting that edge you got to mess with the mask blur okay The Mask blow will help in blending out the the those edges you're seeing the masked area Edge um you can mess with the uh only mask padding but that is what that does that dictates how how big the square area or the the the width and height area are um around the area you've masked and how much padding it has around that area so if let's just as an example here let's erase this let's mask out his face okay and if I set the only Mass padding to 32 pixels what it's going to do it's going to go 32 pixels away from this and create the square area you know the 1ex one square area around his face and the smaller this padding the more focused the is going to be on that area the less context around it it's going to have to work with and it may give you something really weird okay the more padding you give the more context you're giving the AI but you're going to get less detail um so if I did like let's say8 pixels out that means you're going to get from The Mask area somehow it measures like 128 pixels out and you're going to get this big square area around it and so if I were to do this um I'll block my photo of a young boy smiling show you the different uh kind of what happens so I've got it 128 pixels right now see how small his face is I mean how small how much it's taking in around the the subject that we're trying to in paint okay and it's almost like like if you're just rendering the image it's a distant face you're going to get less detail we may have to go back in and it may look good it's you know we're we're dealing with uh an Ina model this one's actually pretty good at doing faces but and it started off looking like it was in color but it gradually has now moved it over to uh the CPA black and white tone okay that one's not bad see that one's not not bad either again they really sharp I probably stick with that one doesn't quite fit again you're dealing with the fact you gave it way too much padding so let's drop it all the way down we're going to go to 20 pixels and Just for kicks we're going to uh we're going to get rid of the batch size here we're going to leave it at 60 steps though or 50 steps what is it 50 steps see how close it is you're going to get a lot more detail this way it's almost like random ing an entire image at that size before it fits it back into the picture this image this will look a lot better okay I'm not saying it's it's uh um better to go down smaller but if you're looking to get more detail it's going to take this square area and render this whole area that size which gives you a lot more detail but the problem is you're going to Lo again it's losing context which means it's you might get things like this so the head's too big you know that's why it's best to kind of leave it at uh I think what we had it by default I think it's like 32 or something like that so that way it has enough context like I could bring in his shoulders a little bit and that'll give the AI a bit more reference as to what it's actually rendering you'll see what I mean here see it's taking into context the rest of the shoulders it's sizing the head properly uh giving him a good smile hair's right everything looks better so when in painting think in terms of context when you're in painting something are you giving the AI enough context to know it's a face or uh this is a head on shoulders and it needs to be sized right the shoulders will help the AI size things properly I think the head still looks a little odd anyway but what we're not getting is the uh that that weird Edge okay it Blends it out nicely I think that's really my goal in this is I've had left people talk to me about how they keep getting that edge so uh take that into account um leave your comments uh if you have any questions I'll try to answer them as best I can and uh like And subscribe and we'll talk to you guys later
Info
Channel: AIchemy with Xerophayze
Views: 1,372
Rating: undefined out of 5
Keywords: Stable Diffusion, Automatic 1111, SDXL models, AI art, Inpainting techniques, High-resolution images, Artifacts removal, AI-generated art, Creative workflow, Stable Diffusion inpainting, Mastering AI art, Artistic techniques
Id: -neAxC6Jz_I
Channel Id: undefined
Length: 37min 22sec (2242 seconds)
Published: Wed Nov 01 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.