Skip to content

phamhungd/RoopSD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FaceSwap Extension - Automatic 1111 - Proof of Concept

This repository contains a quick and dirty proof of concept inspired by roop and using insightface, allowing you to swap faces in images generated by stable diffusion.

The main objective of this extension is to enable face swapping for single images in stable diffusion.

To ensure compatibility, this extension currently runs only on CPU. However, it can be easily ported to GPU for improved performance.

example

Ethical viewpoint : The primary goal of this extension is to ensure consistency in generated images through the capability of face swapping. It is essential to clarify that this extension does not incorporate censorship functionalities. Although censorship mechanisms can be implemented (as demonstrated by roop), they inherently remain vulnerable to bypassing when users have access to the source code. Consequently, it is crucial to exercise responsible usage of this extension and abstain from employing it for malicious purposes. We strongly emphasize the ethical application of this tool, urging respect for the privacy and consent of individuals when swapping faces in images. Engaging in activities that may cause harm, violate privacy rights, or infringe upon the well-being of others is strictly discouraged.

Furthermore, it is equally important to raise awareness among the general public about the existence of such tools and the ease with which deepfakes can be generated. As the technology advances, it becomes increasingly crucial for individuals to exercise critical thinking and skepticism when encountering media content. By fostering a culture of media literacy, we can collectively mitigate the potential negative impacts associated with the misuse of these tools and promote responsible use in the digital realm.

In the event of violation of the legal and ethical requirements of the user's country or region, this code repository is exempt from liability

Install

To install the extension, follow these steps:

  • Clone the repository to your automatic 1111 extensions directory.
  • Download the pre-trained model used by "Roop" and place it in the models directory of this extension (/stable-diffusion-webui/extensions/RoopSD/models/ or /stable-diffusion-webui/models/RoopSD). The model file required is "inswapper_128.onnx".Mirrors are given the roop project installation guide.

On Windows, Microsoft Visual C++ 14.0 or greater is required. During the install, make sure to include the Python and C++ packages.

The inswapper_128.onnx model I use has the following sha1sum : 17a64851eaefd55ea597ee41e5c18409754244c5

Use of the models must comply with their respective terms of the license (see insightface repository). No model will be directly provided or hosted here.

Usage

To use the FaceSwap extension, follow these instructions:

  1. In the face swap box, import an image containing a face.
  2. Click on the "Activate" before generate.
  3. Optionally, select the face number you wish to swap (from right to left) if multiple faces are detected in the image.
  4. The resulting swapped face will be displayed.
  5. If the quality is not satisfactory (and it is often quite average), you can try using the "Restore Face" feature or explore additional options in the "Extra" tab for further improvement. You can also select an upscaler from the menu. This will activate CodeFormer and the chosen upscaler (scale=1). The result may be satisfactory, but gives less control than the extra tab.

Img2Img :

You can choose to activate the swap on the source image or on the generated image, or on both. Activate on source image allows you to start from a given base and apply the diffusion process to it.

Inpainting should work but only the masked part will be swapped.

Credits

  • The developers of roop for their great work.
  • deepinsight for their insightface project, which offers a well-crafted library and models that have greatly enhanced the capabilities of this project.

Releases

No releases published

Packages

No packages published

Languages