ototadana / sd-face-editor

Face Editor for Stable Diffusion
MIT License
1.03k stars 85 forks source link

[Feature Request]: Use Refiner, if given #164

Closed ElPrudi closed 1 year ago

ElPrudi commented 1 year ago

It came to my attention that this extension does not use the refiner, if I specified one. Since it's a inpaint extension, I would love the option to use the refiner instead of the base model for the whole process.

ototadana commented 1 year ago

This extension uses the refiner. If you specify both the base model and the refiner in the Web UI, it will use both for face modification as well as for source image generation, and if you specify the refiner model instead of the base model, it will use the refiner model for face modification.

ElPrudi commented 1 year ago

I can't quite follow you. I want to use both the base model and the refiner in the image generation, but only the refiner in the extension. I don't see any option to only use the refiner, so the extension makes the face worse as my base model is worse than the refiner. That is my problem.

ototadana commented 1 year ago

Okay, I understand. You want to use only the refiner. In that case, I think it would be effective to specify refiner instead of base model in img2img, set denoising strength to 0, and use Face Editor to modify the face. Have you tried this?

ElPrudi commented 1 year ago

The only reason why I want this is to automatically inpaint after generation not to extra send it from text2img to img2img.

ototadana commented 1 year ago

@ElPrudi I have added a use_refiner_model_only option to Img2ImgFaceProcessor to fulfill your request.

It can be used in the following workflow:.

{
    "face_detector": "RetinaFace",
    "rules": {
        "then": {
            "face_processor": {
              "name": "img2img",
              "params": {
                "use_refiner_model_only": true
              }
            },
            "mask_generator": {
                "name": "BiSeNet",
                "params": {
                    "fallback_ratio": 0.1
                }
            }
        }
    }
}

Please try it out.

ElPrudi commented 1 year ago

Thank you! The faces look much better now!