Image Generation AI with ComfyUI: InstantID Edition

2 min read
Modified
Progress 7 / 15
Table of Contents

InstantID is one of methods extending Stable Diffusion, and can fix face of person output by inputting face image. In this article I explain method to use this InstantID in ComfyUI.

Work Flow

1. Introduction of ComfyUI and update to latest version

Introduce ComfyUI. Those already introduced please update ComfyUI to latest version too.

【Stable Diffusion】ComfyUIを使って画像生成AIで遊んでみよう【導入編】

>-

blog.otama-playground.com

2. Installation of Extension

Install following extension.

GitHub - cubiq/ComfyUI_InstantID

Contribute to cubiq/ComfyUI_InstantID development by creating an account on GitHub.

github.com

3. Manual Installation of Library

Since python library (insightface) necessary for InstantID is partially not installed by error, install manually.

Download wheel of insightface from link below, then hit install command with pip.

Assets/Insightface at main · Gourieff/Assets

Contribute to Gourieff/Assets development by creating an account on GitHub.

github.com
Terminal window
python -m pip install (path to downloaded whl) onnxruntime onnxruntime-gpu

In case of standalone version replace python command with path to execution binary of python. python.exe should be placed around below.

  • In python-embedded directory in case of Comfyui-Standalone
  • In Data/Packages/{Package Name}/venv/Scripts directory in case of StabilityMatrix

4. Download and Placement of Model

First download + unzip antelopev2 and place in ComfyUI/models/insightface/models/antelopev2. Can be obtained from either of ↓.

Next place main model of InstantID in ComfyUI/models/instantid.

Finally add model of controlnet to directory of controlnet.

5. Import of Workflow

Since there is workflow of example, use it.

ComfyUI_InstantID/examples/InstantID_basic.json at main · cubiq/ComfyUI_InstantID

Contribute to cubiq/ComfyUI_InstantID development by creating an account on GitHub.

github.com

6. Generate

Change model to one placed earlier, and finally generate specifying face image and prompt.

Generation Result

Used Animagine XL for model.

Input Face Image
Input Face Image
Generation Result
Generation Result

Conclusion

From generation result, I think it was felt that image is generated along input face image. By using InstantID, controlling face to generate becomes possible, expanding breadth of image generation. (Please be careful about portrait right)

This time I used only InstantID, but by combining with ControlNet, it seems posture/composition etc. also become controllable. Since around here becomes story of application, I don’t touch in this article, but those interested should try combining while referring to following article and workflow.

ComfyUIでControlNet:姿勢指定した画像生成AIの基本

>-

blog.otama-playground.com
ComfyUI_InstantID/examples/InstantID_depth.json at main · cubiq/ComfyUI_InstantID

Contribute to cubiq/ComfyUI_InstantID development by creating an account on GitHub.

github.com