it'll run out of the box just by typing: python loop_roop.py
loop_roop.pyJUST_USE_POSES_DIRECTLY:
DELETE_ORIGINAL_SD_IMAGE_UPON_COMPLETION:
USE_POSE:
pics/poses for generating new images.NUMBER_OF_IMAGES:
DEFAULT_MODEL:
SINGLE_FACE_IMAGE_PATH:
POSES_DIR:
GENERATED_IMAGES_PATH:
ROOP_OUTPUT_PATH:
PROMPT:
NEGATIVE_PROMPT:
FIXED_SEED:
CFG_SCALE:
NUMBER_OF_STEPS:
imageWIDTH & imageHEIGHT:
SUPPORTED_EXTENSIONS:
This project generates images of superheroes in various poses and uses a face-swapping tool to insert a specific face into the generated images. The process combines Stable Diffusion with ControlNet for pose conditioning and Roop for face swapping and enhancement.
The project requires the following dependencies:
insightface==0.7.3
onnx==1.14.0
onnxruntime==1.15.0
cython
diffusers
huggingface_hub
mediapipe
tqdm
Pillow
controlnet_aux
numpy
opencv-python
psutil==5.9.5
tensorflow==2.13.0
protobuf
gfpgan
Installation
Clone the repository:
git clone git@github.com:itsitgroup/FaceClone-SD-Script.git
cd FaceClone-SD-Script
Install the required dependencies:
pip install -r requirements.txt
Ensure you have the necessary models downloaded and placed in the appropriate directories.
Usage
Update Paths: Remember to update paths in loop_roop.py
Example command within the script:
SINGLE_FACE_IMAGE_PATH = "pics/face.jpg"
POSES_DIR = "/pics/superhero.png"
roop_command = [
sys.executable, "run.py",
...
"/content/FaceClone-SD-Script/..."]
Generate Images: The script loop_roop.py generates images of superheroes based on the given prompt and pose. It then uses Roop to swap faces in the generated images.
python loop_roop.py
The generated images will be saved in the generated_images directory.
Roop Face Swapping: After generating the images, the script calls Roop's run.py to perform face swapping and enhancement.
Example command within the script:
python run.py -s "input_face_image_path.jpg" -t "input_pose_image_path.jpg" -o "output_image_path.jpg" --execution-threads 14 --many-faces --execution-provider cuda --frame-processor face_swapper face_enhancer --output-video-quality 35 --temp-frame-format jpg --max-memory 46
Project Structure
.
├── generated_images # Directory where generated images and output images will be saved
├── pics # Directory containing input face and pose images
├── loop_roop.py # Main script to generate images and perform face swapping
├── requirements.txt # Project dependencies
├── README.md # Project documentation
├── roop # Roop Related Stuff
└── run.py # Roop script for face swapping and enhancement
3 commits
Python
100.0%
it'll run out of the box just by typing: python loop_roop.py
loop_roop.pyJUST_USE_POSES_DIRECTLY:
DELETE_ORIGINAL_SD_IMAGE_UPON_COMPLETION:
USE_POSE:
pics/poses for generating new images.NUMBER_OF_IMAGES:
DEFAULT_MODEL:
SINGLE_FACE_IMAGE_PATH:
POSES_DIR:
GENERATED_IMAGES_PATH:
ROOP_OUTPUT_PATH:
PROMPT:
NEGATIVE_PROMPT:
FIXED_SEED:
CFG_SCALE:
NUMBER_OF_STEPS:
imageWIDTH & imageHEIGHT:
SUPPORTED_EXTENSIONS:
This project generates images of superheroes in various poses and uses a face-swapping tool to insert a specific face into the generated images. The process combines Stable Diffusion with ControlNet for pose conditioning and Roop for face swapping and enhancement.
The project requires the following dependencies:
insightface==0.7.3
onnx==1.14.0
onnxruntime==1.15.0
cython
diffusers
huggingface_hub
mediapipe
tqdm
Pillow
controlnet_aux
numpy
opencv-python
psutil==5.9.5
tensorflow==2.13.0
protobuf
gfpgan
Installation
Clone the repository:
git clone git@github.com:itsitgroup/FaceClone-SD-Script.git
cd FaceClone-SD-Script
Install the required dependencies:
pip install -r requirements.txt
Ensure you have the necessary models downloaded and placed in the appropriate directories.
Usage
Update Paths: Remember to update paths in loop_roop.py
Example command within the script:
SINGLE_FACE_IMAGE_PATH = "pics/face.jpg"
POSES_DIR = "/pics/superhero.png"
roop_command = [
sys.executable, "run.py",
...
"/content/FaceClone-SD-Script/..."]
Generate Images: The script loop_roop.py generates images of superheroes based on the given prompt and pose. It then uses Roop to swap faces in the generated images.
python loop_roop.py
The generated images will be saved in the generated_images directory.
Roop Face Swapping: After generating the images, the script calls Roop's run.py to perform face swapping and enhancement.
Example command within the script:
python run.py -s "input_face_image_path.jpg" -t "input_pose_image_path.jpg" -o "output_image_path.jpg" --execution-threads 14 --many-faces --execution-provider cuda --frame-processor face_swapper face_enhancer --output-video-quality 35 --temp-frame-format jpg --max-memory 46
Project Structure
.
├── generated_images # Directory where generated images and output images will be saved
├── pics # Directory containing input face and pose images
├── loop_roop.py # Main script to generate images and perform face swapping
├── requirements.txt # Project dependencies
├── README.md # Project documentation
├── roop # Roop Related Stuff
└── run.py # Roop script for face swapping and enhancement
3 commits
Python
100.0%