Stable Diffusion - Background Replacement with Fooocus Inpainting

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Welcome to Kleebz Tech and another video in  our Fooocus for Stable Diffusion series. In   this video, I will go over background  replacement using inpainting. Fooocus   offers a straightforward and powerful  inpainting engine, which is particularly   useful for regenerating parts of an image.  This also includes replacing the background   of an image when needed. This can also be done  on real photos, but results can vary with those. With this video, I'm going to assume you  already have Fooocus installed and know the   basic features and the basics of inpainting.  If you need information on those things,   I do have other videos in the  series that cover all that,   and I'll include those in the description. I'll  also be running it with the default run.bat and   settings unless I show otherwise, and we're  going to get going on replacing backgrounds. Now, a lot of times, what can happen is you  might generate an image and you like most   of it, like the subject or something like  that, but you don't like the background.   Just like with regular inpainting, if you  don't like a certain part of an image,   you can also do the same to replace the background  on an image. You can also take images, actual photos, and replace the background. I've  actually done it with personal photos as well. So, let's start off with an image here, of a  bowl of fruit. Grab this bowl of fruit that   I've generated earlier. Down below, you want to  be on the 'Modify Content, Change Background.' So,   you want to change that. You don't want  to be using the standard inpaint for this,   that's what we're going to be doing here. And the  prompt will be putting down here of what we want. So, I'm going to go ahead and mask off the area  that I want to replace the background. Do keep   in mind that when you do this, you do want to  overlap slightly onto the subject that's going   to stay. That way, Fooocus can blend things  in properly, and depending on how perfect   you want it, it will determine how much you  want to spend time masking the outside edge. I find that Stable Diffusion does a  pretty good job of fixing the edges,   blending things in. Another tip I would suggest  when doing this is not to mask everything all at   one time because then if you just want to undo,  like if you hit something by mistake, you'll   have to undo the whole thing. So, if you just do  sections at a time and then go ahead and fill in,   you're less likely to have to redo your masking,  and that's pretty much for any of the inpainting. Sometimes, I forget, I get going, and the next  thing I know, I've done the whole thing. I make   one little tiny mistake, and I have to fix it all.  So, we've gone ahead and masked off the outer edge   of this bowl of fruit. We have it on 'Modified  Content,' and we have put a prompt in here:   'a bowl of fruit sitting on a table at a bar.'  I'm going to go ahead and hit 'generate.' When you do these, sometimes, especially in  my experience with people, if you mask around   someone's head, it might change the hairstyle  slightly, add extra strands, things like that. So,   you may have to go back and touch some things up  with the standard inpainting afterwards. Like on   this bowl here, it might actually add a  stem or something to some of the fruit. Okay, so our images are generated, and  as you can see, the backgrounds have   been changed. It also has added certain  things, like, look at this picture here,   you can see this leaf has been added. As I said,  it may add stuff to the outer edge. Those things   can be changed with regular inpainting once you  get what you want for an image. You'll notice it   also blends it in; you'll have the shadows and  everything else, so it actually does a pretty   good job of blending it in. And it's got this  random apple just hanging onto the back there. Now, another thing I'm going to show you is  actually a little bit more of an advanced   feature. It's actually hidden, which is  one thing I wish they didn't hide in the   advanced debug features because it's actually  something that you might want to use more often,   especially for regular inpainting as well. So,  for this, let's say we had the background was   pretty close to what we wanted, we just  wanted it slightly different. We don't   want a drastic, completely different  background like we were doing before. When we generated it before, it replaced the  background completely with what we had in the   prompt down below. But let's say we want a similar  image, the similar background to what we already   have, so we don't want to change it completely.  What you can do at that point, just like in   regular inpainting, you can do this as well, is go  into the advanced section and then the developer   debug mode. And when you check that off, now you  want to be careful when you get in here and start   messing with things. A lot of this stuff can  really have strange effects if you aren't sure. And you've moved some things around, you can  always just refresh the page, and it will   set those all back to their original settings.  Now, whenever you are changing this down here,   the type of inpainting you're doing, it  will change these settings as well. So,   your regular inpainting actually isn't  using the same settings as this by   default. This is actually for that section,  the 'add objects, change the background.' So, the only thing you're going to do in here  is first uncheck this 'disable initial latent   in inpaint.' For this purpose, if you're don't  want to change this too drastically. Then, we have   the 'Inpaint Denoising Strength.' That is similar  to the weight that we have talked about in other   videos. It's like a volume knob. So, when  it's at 100%, it completely changes the image,   but when we slide this down, it'll actually lower  the amount that the image will change. When you   get down real low here, it's going to keep this  almost exactly the same image, just minor details   will change. And as you increase that, more and  more changes will happen to that original image. So, for this one, I'm going to just  change it to about 0.5, roughly,   just to demonstrate the difference from  what we saw before, where we saw before   everything was changed completely. You're  going to notice with this, it's not going   to change everything completely. So, we're  going to go ahead and hit 'generate' here. Okay, so we have our images generated,  and as you can see in this batch,   they're all very similar to the original image.  We haven't had any drastic changes. I mean,   there are still changes, but the  glass is a little bit different,   the fruit over here is slightly different.  And if we were to crank that down even lower,   you'd see even less change. And if you crank  it up higher, you're going to see more change. So, for example, let's, for this one,  we're going to increase that just a   little bit. I know if I increase it way  up, it'll start really changing it. So,   I want to kind of give an idea of how  much of a change it will give here. So,   I haven't changed anything else, and we're  going to go ahead and generate some more,   and I'll show you the difference between how  this denoising strength can affect that change. See, there's more of a change than we had  in the original ones. I'll go ahead and   bring one of those up, just so this is the  first batch with the lower denoise when we   had this down in the 0.5, all minor changes.  And then, now the new ones, as we can see,   much more drastic changes. You notice, you do have  it added in certain things like I had mentioned. So, that gives you an idea, and if we increase  that up even further, it would be a much more   drastic change, until we get all the way to one,  where it would do everything. But at that point,   you want to just go back to the original  settings. If you're going to be completely   replacing the background, you want to adjust the  denoising strength, go ahead and change it down,   but do uncheck this because what'll happen is  I'm going to show you the difference. If you   leave that checked, and you put this down,  if you leave it part most of the way up,   you won't see this happen, but once you  get down into a certain lower amount,   you're going to find out. And if you see  this happen, you'll know that you forgot   to uncheck that box. Well, there you go. If you  get results like that, then you forgot to uncheck   this if you were trying to adjust the denoising  strength. So keep that in mind, but by default,   that's what it's going to be normally at when  you're changing using the 'Modify Content' method. So, I'm going to give you another example. This  is actually using a real image. I'm going to   take an old photograph here, and I am going  to paint out the background on this one. So,   we're going to put 'a woman holding a dog and  sitting in a garden, black and white, old photo.' Okay, so the images are generated, and as you can  see, I did a pretty good job of blending things in   with the original and the new images. But one  thing I did want to show with this is what it   ends up doing sometimes when it comes to these  things. So, as we can see in this image here,   compared to the original image, you'll see that  the hairstyle has changed. It actually has taken   and expanded and filled in that hairstyle. So,  that's one thing to keep in mind when you're   doing this because the way you're masking the  edges, it may actually add on or change things. You'll see around the edges of this, it's  also, so each one, the hairstyle is slightly   different. This one is pretty close to the same,  but that's the sort of thing you're going to run   into. You'll also notice other minor details  along the edges, on the shoulders, and things   like that will have changed because of the way the  inpainting the background works and the overlap.   But those things can be changed later. It does a  pretty good job of actually blending things in. So, you can use it for actual photographs,  generations, play around with it, have fun.   It's very useful when you generate something  and you like everything but the background.   You can go through and try different  backgrounds and see what works best. That pretty much covers it for the basics  of replacing the background in Fooocus using   inpainting and should get you started with fixing  your images. If you found this video helpful,   please do consider clicking the like  button because it does help. Any questions   or suggestions for video ideas, please leave a  comment. Thanks for watching, and don't forget,   I do have other videos on Fooocus and will  have many more in the future. Have a great day!
Info
Channel: Kleebz Tech
Views: 2,144
Rating: undefined out of 5
Keywords: stable diffusion tutorial, stable diffusion, stable diffusion outpainting, fooocus inpaint, controlnet tutorial, stable diffusion secrets, controlnet stable diffusion, digital art, automatic 1111, stable diffusion tips and tricks, fooocus tutorial, stable diffusion inpainting, inpainting, inpainting stable diffusion, stable diffusion install, stable diffusion fix bad hands, fooocus replace background, background replace
Id: fARdZK2fCPo
Channel Id: undefined
Length: 11min 2sec (662 seconds)
Published: Tue Jan 30 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.