인물유지한채로 사진 변경! MASK활용 (그대로 따라하기, comfyui)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello, this is Neural Ninja. In this video, I will teach you how to change a photo while maintaining the person's appearance using a mask and ControlNet. We will automatically create masks with Segment Anything and create more natural photos by combining masks in various ways. Masks can be used in so many different places, so they will help you organize your workflow. If you are using Colab, please install an additional custom node. I'll clear it and start. Let's add Load image and load the image. I will add a Dino node among the Segment Anything nodes. This is a node that automatically creates a mask when you enter the prompt. We will connect the models and connect the input images. We will connect the input image and add an image preview. Let's add a Mask to image node to view the mask. From now on, I will continue to convert the mask to an image like this and add a preview. Let’s select the hair by entering it through the prompt. Now let’s run it and check. Let me select the device mode. The hair was well chosen. Let’s add one more dino node. Let's copy the nodes. The hair was well chosen. I'll also copy the preview. This time, let's choose a face. Each was well chosen. Now we will combine the masks to make one mask. You can use the Mask Composite node. Adding or subtracting two masks, etc. It is a node that combines. Please select Add as the operation. Now connect the two masks and combine them. I'll add a preview. Let me run it and check. There are some gaps on the inside like this. Let me fill this out. And I'll add a mask node. The white part of the mask expands. I'll enter 30. It expands by 30 pixels. Let's add a Grow Mask node again. This time, I will reduce it to the same negative value. It's the same size after adding and subtracting, but the tiny gaps have disappeared. Because the outside should be white I will invert it using an invert mask. using this mask I will select parts other than the face and head. Now let’s add image creation nodes. I will add Checkpoint Loader. using this mask I will add VAE Loader. Let's add a clip text Encode node to be used as a positive prompt. I will also add a negative prompt. I will add a case influencer. I will convert the input image to Latent and connect it. We are going to create an image. When creating, the important thing is to set the generated image size to within 512,768. The current input image is too large at 1024,1536, so I will reduce the image. I will reduce it using the constraint image node. I will set the maximum size to 768. Let's connect the input image and input this image into Latent. I'll add a preview. Let’s enter the prompt we prepared. I'll also add a prompt. I will choose the sampler appropriately. Now let's create it. I'll also add a prompt. It was created in size 768. We will add a Set Latent mask node to set the area to be created. If you set a mask through this node, Case inflation is applied only to the white part of the mask. The black part does not apply. Now, if you create it, it will be created to fit the mask area. The mask was applied well, but it does not match the generated image. I will use open pose to create a similar idea. I'll put it between the prompt and the case infuser. I will add OpenPose ControlNet. I will choose an open pose. I will add DW Preprocessor. Let's connect the input image. I will also add a preview of the open pose image. I will connect the nodes. Now let's create it. I will connect the input image. It was created well. Instead of creating it like this, reduce the denoising a little without ControlNet. It's okay to create something that retains more of the original photo feel. Or add an inpainting model It's okay to create photos that match regardless of the pose. The white area of the mask needs to be a little more than the border for it to look natural. Let's adjust it by slightly increasing the mask area. And I'll increase it to a mask node. I'll increase it by about 10 pixels. I'll increase it to a mask node. I'll increase it a little more. Now I'll reconnect the mask. Now let's create it again. The boundaries are much smoother now. For comparison, let's also add a node that is created without a mask. I will connect the nodes equally. I'll connect you without a mask. I'll grow it mask area. For comparison, I will set the seed values to be the same. Let's change the seed to input. I will set the seed value to fixed. Let's create it. Now you can compare the images when the raw mask was applied. Let's apply a mask here and paste only the selected part. This is a node that combines two images using a mask. I'll get the original image. Before inverting, you need to get a mask with a white head. The mask has been applied. While creating it, I ended up creating an image that was much smaller than the original size. I'll try upscaling it. First, let’s do simple upscaling using the upscaler model. I will use the Ultra Sharp model. I'm going to upscale it by two. Let's do a simple upscale. Since it is a simple upscale, the picture quality is disappointing. I will try to improve the quality by pasting the original image here. This time, I will paste it from Latent. This is almost identical to what we did earlier with the Image Composite mask. We will add a constraint image node that limits the size to 1536, which is twice the existing size. I will convert it to a latent image and connect it. I'll connect you to the mask. When I pasted the image, the border was messy. Let's reduce the border area by reducing the mask area. The image of the base image is almost identical. Since there are images with the same mask area, it doesn't matter if you reduce them a little higher. Reduce the mask area to reduce the border area. Reduce the border area to reduce the border area. It feels quite natural now. I will upload the details through the sampler. I'll add a sampler and reconnect the latent. I will also apply a latent mask and set it so that the pasted part does not change. I will choose the sampler appropriately. I will lower the denoising to about 0.4. Let's create it. It was created well. Even after creation, there are times when additional correction work on the border is required. Select the border part like this and inpaint it once more. Let's create a mask that selects the border like this. Expand the original mask once with the Grow Mask node and shrink it once. And this time, subtract using the mask composite node. If you check, you will see a thick selection line around the boundary like this. You can increase the size by adjusting the value. Let me apply this and correct it once more. I'll copy the previous nodes. I will change the seed and connect the newly created mask. Now let’s run it and check. The surrounding boundaries have become more natural. I think this work should be done additionally only when necessary. Now let’s check by applying various prompts. It was created well. I will also apply other prompts. Now let’s run it and check. Also, I think there is a limit in cases where the lighting is completely different, such as during the day and at night. This time, we will create it with slightly reduced denoising. The feel of the original image was reflected, making it look a little more natural. Let's apply it to other images as well. Now let’s run it and check. Let's apply it to other images as well. Now let’s run it and check. Above, I used a mask to change the photo while maintaining the person. I think it can be used in various areas such as hands, backgrounds, and clothes. I hope the video helps. I'll come back with a good video next time. thank you
Info
Channel: 뉴럴닌자 - AI공부
Views: 4,859
Rating: undefined out of 5
Keywords:
Id: NfgOEmD-nXY
Channel Id: undefined
Length: 27min 55sec (1675 seconds)
Published: Sun Feb 11 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.