Swap Cloth
This project demonstrates a Cloth Swap feature using ComfyUI, enabling users to change clothing on images seamlessly. This guide provides step-by-step instructions to set up, use, and contribute to the project.
Features
- Swap clothing on images with precision.
- Powered by ComfyUI's flexible architecture.
- Upload JSON workflows for customization.
- Simple, efficient, and open-source.
- Setup Instructions
1. Clone the Cloth Swap Repository
Clone the repository containing the Cloth Swap JSON workflows and assets:
Copy code
git clone <your-repo-url>
cd <your-repo-folder>
2. Clone ComfyUI Repository
Install ComfyUI by cloning its main repository:
Copy code
git clone https://github.com/comfyanonymous/ComfyUI.git
cd ComfyUI
Install dependencies:
Copy code
pip install -r requirements.txt
Install ComfyUI Manager:
goto ComfyUI/custom_nodes dir in terminal(cmd) and clone this repo:
Copy code
git clone https://github.com/ltdrdata/ComfyUI-Manager.git
Restart ComfyUI
To Start ComfyUI:
Copy code
python3 main.py
Note: ComfyUI requires Python 3.9 or above. Ensure all required dependencies are installed.
Now Go to Manager ->-> Custom Nodes Manager and install this two nodes "ComfyUI Layer Style" and "ComfyUI_CatVTON_Wrapper", restart and reload the page.
Make sure you have "sam_vit_h_4b8939.pth" model inside ComfyUI/models/sams directory and "groundingdino_swint_ogc.pth" model in ComfyUI/models/grounding-dino directory if not download it. (If directory name not there in ComfyUI/models/ create new)
- For Reference you can download model by below link: https://huggingface.co/ShilongLiu/GroundingDINO/resolve/main/groundingdino_swint_ogc.pth https://huggingface.co/spaces/abhishek/StableSAM/resolve/main/sam_vit_h_4b8939.pth
3. How to use
- Start ComfyUI (by running python3 main.py)
- Open ComfyUI in your browser (default: http://127.0.0.1:8188)
- Click on Load button in menu bar and select the workflow.json file provided in this repository
- Now click on Queue Prompt for generate output
or you can use by python script provided in this repository:
python3 main.py
#Remember change the input paths in script here :
#prompt["2"]["inputs"]["image"] = "\\ put your input person pose image"
#prompt["3"]["inputs"]["image"] = "\\ put your input cloth image"
4. Using Cloth Swap
-Prepare your input images (ensure proper resolution for better results). -Select the uploaded workflow in ComfyUI. -Provide necessary inputs as per the workflow: -Source Image: The base image where the clothing is to be swapped. -Cloth Image: The image of the clothing to be applied. -Start the process to generate swapped outputs. -Save the generated images for further use.
5. Compute Infrastructure
Hardware
NVIDIA GeForce RTX 3080 card
Model Card Contact
For inquiries and contributions, please contact us at info@foduu.com.
@ModelCard{
author = {Nehul Agrawal and
Priyal Mehta},
title = {Cloth Swap},
year = {2024}
}