Generate Masks In Fooocus With Mashb1t’s Fork | (Stable Diffusion)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today I want to start talking about some of the forks for Focus while there are several popular ones you may have heard of I'm going to start with one that I briefly touched on in my last video and that is Mash bits oneup Edition and with that let's get started without going too deep into what a fork is it's simply a breakoff from the original Focus code at some point just treat this as a separate install of focus if you have installed Focus onto your computer before then this works exactly the same way on the GitHub page we can go down to the installation section if your operating system is Windows and you use an Nvidia GPU like me then you can download the zip file here extract it wherever you like and you should be good for the next step if you have another combination of Hardware follow the same steps you took to get this working as you did the original Focus there's also a free collab version of this as well if you want to try that once you extract the files the first thing to do before running the program is to change the folder locations so it uses all the models we have have already downloaded for the original Focus so I'll open my original Focus config text and then the new config text select all from the end of the focus expansion path to the top under the first bracket then copy then go into the new config text and select everything again from the end of the focus expansion to the top and then paste you can change the output folder also at the bottom if you want that somewhere else but I'm going to leave it with the new Focus folder then make sure you save now let's start up our Mash bit Focus I won't go over every little difference but here are a few notable ones first in the settings tab near the bottom is this check box translate prompts with this checked it will use the internet to translate non-english prompts to English it won't show the translation itself but you can see the difference with it checked and unchecked in your Generations another small but interesting feature is the autod describe when loading an image into the upscale or variation tab it only works there is no text in the prompt a small but perhaps important feature for some now in the debug menu we will scroll to the bottom of the debug tools Tab and see the blackout not safe for work checkbox this will basically remove the preview of the image as it's being created and if any not safe for work content is detected the result will just be an image entirely blacked out I didn't thoroughly test this out I'm not sure how sensitive this is nor what entirely considers not safe for work but the option is there okay now let's try the autogenerate mask feature to do that let's go to the inpaint tab and load an image now we need to go back to the debug menu and then the inpaint tab then check enable mask upload and here you will see something new labeled mask generation model and a generate mask Button as of making this there are eight models available and each one will have to be downloaded upon first use so if it seems like nothing's happening at first check your command window and see if something's is downloading they range from a couple hundred megabytes to 1 to 2 gigs each the isnet general use model is so far the best one to get fine details basically like using a removed background and then turning it into a mask this is important because only the solid white parts will be masked and with most of these you don't have any kind of control over it these five models give me very similar results with the isnet general use giving me the best out of all of them the isnet anime I would guess is geared more towards cartoon images when I've used it it does seem to mask more of the background than other models but you have to try it for yourself then we have the uet cloth segment model this does okay with some images when trying to get the upper or lower clothing items using the full so far doesn't seem to work for me now the model with the most options is the Sam which is the segment anything model this might sound familiar as it has been implemented in things like automatic 1111 and comfy UI for some time this is still a pretty Bare Bones version but still very useful with this you can prompt for the items in the image that you want masked this is by no means perfect and some items it mask very well and others terribly I had trouble getting these shoes to be masked when I prompted for shoes and then sneakers and then finally with tennis shoes it worked so I suppose some trial and error is going to be involved in the advanced options there are three Sam models and each one is around 1.6 gig I think each will give a little different result so it's good to try them all quantization I believe is to help reduce memory and latency at a small cost of detail I really haven't noticed too much of a difference with this on or off but it might work differently for you turning the Box threshold down will cause the white area of the mass to be larger and include more areas turning it up will make it get smaller and too high will actually cause it to invert and have the white and black parts of the mass flip I've tried messing with the text threshold and perhaps my prompts are just too basic but I didn't really see any noticeable differences now the downside of this is that you can add to the white areas with the manual mask but you can't erase and or add to the black areas you will have to download the mask and use a Photoshop like program to edit in that way unfortunately that is just the limitations of these masks and you can't just right click and get the mask it will download an empty image so to get the mass go to the debug menu and the inpaint tab check the debug inpaint processing and then generate then you can right click and save this image and then you can load it into an image editing software if needed so let's go through a couple examples of how to use this say you wanted to change these pants on the default settings with the Sam model I'm just going to type in jeans and pants then generate mask this gets pretty close I'm going to manually cover the little rip down here and also the button here then I'm going to go up to the main prompt first uncheck the debug in paint pre-processing box and I'm going to type in something like black pants and generate and we get decent results if you feel like the mask is not getting far enough out maybe the edges look a little rough or you see some white lines we can bump up the mask erode or dilate slider usually just one or two is probably enough and try again and this looks better to me now let's try to change the t-shirt and let's say you get the T-shirt mask and it's good but you want to make some minor alterations but you can't because it's adding more black and not white for that we will need to bring this into an image editor but first thing is turn back on the debug in paint pre-processing and generate now there's one problem with the mask because of how this mask is it changed its resolution so if we downloaded this mask and edit it and then re-upload it it wouldn't work because it's a different size so in order to fix this what we have to do is go back down to the mask and put four white dots in each of the corners and then generate again now the mask is their correct resolution and we can download it now we're going to go into photo we want to open or drag and drop the original image into photo and then the black and white mask then with the mask layer on the top we can change the opacity and see how it lines up with the original image this way we can make better edits then we can black out the spots that we want and make any other edits that you like when done make sure to remove the white masks in the corner and then we can save back in Focus load in The Mask turn off debug inpaint pre-processing checkbox type in your prompt for what you want to change the shirt to and then generate and I know this seems like a lot of trouble especially when you still might end up having to use an image editor which in some ways feels like defeating the entire purpose of this but if you run into something where your mask is almost perfect at least there is a way to fix it if you need to and that is all I have for you guys in this one I hope you learn something and I will see you in the next one
Info
Channel: Jump Into AI
Views: 4,327
Rating: undefined out of 5
Keywords: Fooocus ai, Fooocus Generate Mask, Generate Mask, Segment anything, stable diffusion tutorial, Stable Diffusion, Fooocus tutorial, Stable Diffusion made easy, Fooocus ai tutorial, Fooocus segment anything, Fooocus forks, Mashb1t Fork
Id: 9qnl8SnjRGA
Channel Id: undefined
Length: 8min 29sec (509 seconds)
Published: Sat Apr 20 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.