L6: Model Switch and Masking in ComfyUI - Comfy Academy

Olivio Sarikas www.youtube.com

סיכום תמציתי

הסרטון מציג שני טריקים ב-ComfyUI: החלפת מודלים ושימוש במסכות. החלפת מודלים מאפשרת מעבר בין סגנונות שונים (למשל, מציור דיגיטלי לתמונה) תוך שמירה על קומפוזיציה דומה. שימוש במסכות מאפשר עריכה סלקטיבית של אזורים בתמונה, כמו החלפת פנים או הוספת אלמנטים, באמצעות כלי ציור מובנה.

  • החלפת מודלים ליצירת תמונות מגוונות.
  • שימוש במסכות לעריכה סלקטיבית של תמונות.

החלפת מודלים

הטריק הראשון הוא החלפת מודלים, המאפשר מעבר בין סגנונות שונים. לדוגמה, ניתן להתחיל עם מודל Ref Animated (סגנון ציור דיגיטלי) ולסיים עם תמונה בסגנון צילומי. כדי לעשות זאת, יש להשתמש בשני מודלים שונים עם Clip Skip מתאים (לדוגמה, מינוס 2 עבור Ref Animated ומינוס 1 עבור תמונה). יש ליצור שני ערוצי טקסט חיוביים (Positive Prompt) כדי להתאים ל-Clip Skip השונים. ניתן להשתמש באותו טקסט עבור שני המודלים או להתאים אותו לכל מודל לקבלת תוצאות טובות יותר. התהליך כולל טקסט שלילי (Negative Prompt) זהה לשני המודלים, Latent ריק בגודל 512x768, ושני K Sampler. ה-K Sampler הראשון מבצע Upscale ל-Latent, והשני משתמש ב-Denoise נמוך (לדוגמה, 0.35).

שימוש במסכות

הטריק השני הוא שימוש במסכות, המאפשר עריכה סלקטיבית של אזורים בתמונה. כדי להשתמש במסכה, יש לטעון תמונה קיימת ולפתוח אותה בעורך המסכות (Mask Editor) על ידי לחיצה ימנית על התמונה ובחירה באפשרות "Open in Mask Editor". בעורך המסכות, ניתן לצייר על האזורים שרוצים לערוך ולשמור את המסכה. לאחר מכן, יש להשתמש ב-VAE Encode כדי להמיר את התמונה ל-Latent, ולשלב אותה עם המסכה באמצעות Set Latent Noise Mask. את ה-Latent המשולב יש להזין ל-K Sampler. חשוב להתאים את ה-Denoise ואת הטקסט החיובי (Positive Prompt) לאזור המסומן בלבד. ניתן להשתמש בתצוגה מקדימה (Preview) כדי לראות את השינויים לפני השמירה.

Summarize any YouTube video in seconds

Get summaries like this one for any video, in your language, with the free Summ app.

Download on the Apple Store
Get it on Google Play

Transcript

YouTube Transcript Generator

0:00 [Music] one of my favorite tricks is model switching and in confu ey of course you can do some awesome stuff while building the workflow to follow my workshop you can download my workflow on open art you see here there's a download button and above that you have a green button that says Lounge workflow where you can actually run my workflow in the cloud for free let me show you what model switching is all about so first of all over here we are starting with our model in this case I'm using ref animated which is more digital painting style but I want to have a photo at the end of the

0:45 process also because we are using ref animated we have here clip skip you can see with min-2 while for a photo you need minus one now the thing here is because we have two different clip skips we want to use here we basically have to have also two inputs of the positive prompt maybe even the negative prompt in this case we're just sticking to the positive prompt here so how do we actually do that well you can see over here I have my clip text encode but there is no text in here because I'm sending the text from a prompt text field that is only sending out text doing nothing else how do I get the

1:31 input here well I'm using using a normal clip text encode note and you can rightclick and in that list down here you have convert text to input so that the text field which is also called the videt is being removed and is replaced by a text input so up here we can see the converted clip to text encode here we have the text input and from our prompt text this is then connected here to the input and of course going to use the same one up here for the second clip text encode I want to use here the rest of the process as we can see here is pretty much the same as always we have here our negative prom which is the same for both images no changes needed here

2:18 ugly and deformed we have here our empty latent 512 by 768 and then we have here our K sampler the first one we do a latent upscale and then we have here our second K sampler in this case I'm using a low D noise of only 0.35 you want to experiment with the D noise value to see what gives you the best results of course we need a second loader for the second model so up here we have our low checkpoint and as you can see if I stretches out a little bit I'm using epic realism natural sin really good for photos gives very good skin texture also here we have our clip

3:05 text encode that is using the same text for the prompt you can also of course use a different text prompt if you want to or if this is better for either the model or the image output because sometimes for example different models require different kind of words in the prompt for example you might want to use here raw photo or professional photo or other terms that are photo related to get a better output so as you can see here we are sending the second model and of course our clip text encode that is now not using a clip skip of minus two into the positive prompt and the model input of our second Cas sampler and up here you can see the image this has been

3:51 rendered with ref animated it's a beautiful digital painting style of a woman standing in a park very nice now ref animated is very good with poses is very good with hands often it's very good with colors so I like a lot about this model and because of that I want to use the output of this model as the input for my photo creation so I have the same composition and colors that are beautiful but then I have a photographic style so when we render through all of it this is our output and I would say that is pretty amazing you can see it's a very similar dress very similar colors everything is very similar but now it is

4:38 the style of a photo so be creative with model switching and any kind of other creative process because this is the power of comi to experiment and use it as your little laboratory for AI image Generation all right I built another easy workflow for you this time we're going to look into how to use masks in comu ey that are hand paint in this case it's pretty easy to do so again we have a simple text to image workflow here again let's go here through the basic steps we have the model loader positive prompt negative prompt the vae loader and the case sampler of course and then over here the ve code that creates the image of course if we want to create a

5:24 mask for an image we need to load that image so down here we have load image you can see here this is another image that I have created with AI and to paint this mask it's a little bit hidden but it's very easy right click on that note and then here it says open in mask editor when you open that up it gives you this kind of popup window here and with that you can for example click here to clear the mask you have here a slider for the size of your brush and with that you can simply paint for example over the face to make a mask for the face click on save to note so that now we have the image here with the mask in it now of course we need to send the mask to our case sampler the way to do that

6:12 is that first of all we have here a vae encode and then let's zoom out here a little bit more we need to have a set latent noise mask this is one of the ways of doing that there's different ways how you can apply a mask so in this case we convert the complete image into a latent image and then we combine it with the mask it's coming out from here into set latent noise mask and then both of that goes into our latent image now to be able to change the content of the image you want to experiment down here with the D noise that you're using for creating the new image in your picture another important thing here is that you

6:59 might want to reduce the prompt to what you actually want to inpaint not the complete prompt because that might be confusing for the AI to what you actually want to inpaint there only what you actually want to have there and then also maybe some style words on top of that depending also on the D noise you're using as you can see here I have a preview this is loading the original image and then I have here a safe image this is showing us the changed image so let's zoom in here a little bit closer and as you can see here we have a new face and also so glasses that the woman is wearing so that worked wonderfully for us of course you can experiment more with different face expressions all kinds of things you can basically change any kind of thing in the image you want

7:45 that can be very creative and also very helpful to get you the results you desire by inpainting the elements afterwards it doesn't always all have to happen in one go thank you for watching this video leave a like if you enjoyed this and see you soon bye hi oh you're still here so uh This is the End screen there's other stuff you can watch like this or that really cool and yeah I hope I see you soon uh leave a like if you haven't yet and well um yeah

Share

YouTube Video Summaries