CatVTON

Zheng-Chong更新放缓

轻量级虚拟试衣扩散模型,仅需不到8G显存即可生成1024×768试穿效果,训练和推理都很省资源。

[ICLR 2025] CatVTON is a simple and efficient virtual try-on diffusion model with 1) Lightweight Network (899.06M parameters totally), 2) Parameter-Efficient Training (49.57M parameters trainable) and 3) Simplified Inference (< 8G VRAM for 1024X768 resolution).

ComfyUI发布于 2024-07-27 12:19 UTC1,907star244fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
conda create -n catvton python==3.9.0
conda activate catvton
cd CatVTON-main
pip install -r requirements.txt
硬件要求按 README 说明

README 说明 bf16 精度下生成 1024x768 结果约需 8G 显存;未说明支持的 GPU 厂商与型号,也未提及 CPU 运行。

8G 显存可跑
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

轻量高效的虚拟试衣扩散模型,用拼接方式实现换装生成

轻量级虚拟试衣扩散模型,仅需不到8G显存即可生成1024×768试穿效果,训练和推理都很省资源。

核心能力

  • 以 Stable Diffusion v1.5 inpainting 为基座,通过拼接条件实现试衣
  • 总参数 899.06M,仅 49.57M 参数参与训练
  • 1024x768 分辨率下 bf16 推理显存占用约 8G
  • 提供 Gradio 应用与 ComfyUI 工作流两种部署方式
  • 内置 SCHP 与 DensePose 自动生成人体解析掩码

容易踩的坑

推理前需自行下载 VITON-HD 或 DressCode 数据集并按指定目录结构放置;DressCode 需先运行 preprocess_agnostic_mask.py 生成 agnostic mask;首次运行 ComfyUI 工作流会自动下载权重,通常需要数十分钟。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

1 个版本ComfyUI
  1. ComfyUIv1.0.0-ComfyUI最新正式版2024-07-27 · 2024-07-27 12:19 UTC

    We have modified the main code to enable easy deployment of CatVTON on ComfyUI. Due to the incompatibility of the code structure, we have released this part in the Releases, which includes the code placed under custom_nodes of ComfyUI and our workflow JSON files.

    WX20240727-195601

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    [ICLR 25]🐈 CatVTON: Concatenation Is All You Need for Virtual Try-On with Diffusion Models

    CatVTON is a simple and efficient virtual try-on diffusion model with 1) Lightweight Network (899.06M parameters totally), 2) Parameter-Efficient Training (49.57M parameters trainable) and 3) Simplified Inference (< 8G VRAM for 1024X768 resolution).

    Updates

    • 2025/02/24: 🎉 We are excited to announce CatV2TON, our new DiT-based model that supports both image and video try-on! Check it out!
    • 2025/02/20: Our Paper on ArXiv has been updated to v2, which includes more details.
    • 2025/01/24: 🥳 CatVTON has been accepted to ICLR 2025!
    • 2024/12/20: 😄 Code for gradio app of CatVTON-FLUX has been released! It is not a stable version, but it is a good start!
    • 2024/12/19: CatVTON-FLUX has been released! It is a extremely lightweight LoRA (only 37.4M checkpints) for FLUX.1-Fill-dev, the lora weights are available in huggingface repo, code will be released soon!
    • 2024/11/26: Our unified vision-based model for image and video try-on will be released soon, bringing a brand-new virtual try-on experience! While our demo page will be temporarily taken offline, the demo on HuggingFace Space will remain available for use !
    • 2024/10/17:Mask-free version🤗 of CatVTON is release !
    • 2024/10/13: We have built a repo Awesome-Try-On-Models that focuses on image, video, and 3D-based try-on models published after 2023, aiming to provide insights into the latest technological trends. If you're interested, feel free to contribute or give it a 🌟 star!
    • 2024/08/13: We localize DensePose & SCHP to avoid certain environment issues.
    • 2024/08/10: Our 🤗 HuggingFace Space is available now! Thanks for the grant from ZeroGPU!
    • 2024/08/09: Evaluation code is provided to calculate metrics 📚.
    • 2024/07/27: We provide code and workflow for deploying CatVTON on ComfyUI 💥.
    • 2024/07/24: Our Paper on ArXiv is available 🥳!
    • 2024/07/22: Our App Code is released, deploy and enjoy CatVTON on your mechine 🎉!
    • 2024/07/21: Our Inference Code and Weights 🤗 are released.
    • 2024/07/11: Our Online Demo is released 😁.

    Installation

    Create a conda environment & Install requirments

    conda create -n catvton python==3.9.0
    conda activate catvton
    cd CatVTON-main  # or your path to CatVTON project dir
    pip install -r requirements.txt
    

    Deployment

    ComfyUI Workflow

    We have modified the main code to enable easy deployment of CatVTON on ComfyUI. Due to the incompatibility of the code structure, we have released this part in the Releases, which includes the code placed under custom_nodes of ComfyUI and our workflow JSON files.

    To deploy CatVTON to your ComfyUI, follow these steps:

    1. Install all the requirements for both CatVTON and ComfyUI, refer to Installation Guide for CatVTON and Installation Guide for ComfyUI.
    2. Download ComfyUI-CatVTON.zip and unzip it in the custom_nodes folder under your ComfyUI project (clone from ComfyUI).
    3. Run the ComfyUI.
    4. Download catvton_workflow.json and drag it into you ComfyUI webpage and enjoy 😆!

    Problems under Windows OS, please refer to issue#8.

    When you run the CatVTON workflow for the first time, the weight files will be automatically downloaded, usually taking dozens of minutes.

    Gradio App

    To deploy the Gradio App for CatVTON on your machine, run the following command, and checkpoints will be automatically downloaded from HuggingFace.

    CUDA_VISIBLE_DEVICES=0 python app.py \
    --output_dir="resource/demo/output" \
    --mixed_precision="bf16" \
    --allow_tf32 
    

    When using bf16 precision, generating results with a resolution of 1024x768 only requires about 8G VRAM.

    Inference

    1. Data Preparation

    Before inference, you need to download the VITON-HD or DressCode dataset. Once the datasets are downloaded, the folder structures should look like these:

    ├── VITON-HD
    |   ├── test_pairs_unpaired.txt
    │   ├── test
    |   |   ├── image
    │   │   │   ├── [000006_00.jpg | 000008_00.jpg | ...]
    │   │   ├── cloth
    │   │   │   ├── [000006_00.jpg | 000008_00.jpg | ...]
    │   │   ├── agnostic-mask
    │   │   │   ├── [000006_00_mask.png | 000008_00.png | ...]
    ...
    
    ├── DressCode
    |   ├── test_pairs_paired.txt
    |   ├── test_pairs_unpaired.txt
    │   ├── [dresses | lower_body | upper_body]
    |   |   ├── test_pairs_paired.txt
    |   |   ├── test_pairs_unpaired.txt
    │   │   ├── images
    │   │   │   ├── [013563_0.jpg | 013563_1.jpg | 013564_0.jpg | 013564_1.jpg | ...]
    │   │   ├── agnostic_masks
    │   │   │   ├── [013563_0.png| 013564_0.png | ...]
    ...
    

    For the DressCode dataset, we provide script to preprocessed agnostic masks, run the following command:

    CUDA_VISIBLE_DEVICES=0 python preprocess_agnostic_mask.py \
    --data_root_path <your_path_to_DressCode> 
    

    2. Inference on VTIONHD/DressCode

    To run the inference on the DressCode or VITON-HD dataset, run the following command, checkpoints will be automatically downloaded from HuggingFace.

    CUDA_VISIBLE_DEVICES=0 python inference.py \
    --dataset [dresscode | vitonhd] \
    --data_root_path <path> \
    --output_dir <path> 
    --dataloader_num_workers 8 \
    --batch_size 8 \
    --seed 555 \
    --mixed_precision [no | fp16 | bf16] \
    --allow_tf32 \
    --repaint \
    --eval_pair  
    

    3. Calculate Metrics

    After obtaining the inference results, calculate the metrics using the following command:

    CUDA_VISIBLE_DEVICES=0 python eval.py \
    --gt_folder <your_path_to_gt_image_folder> \
    --pred_folder <your_path_to_predicted_image_folder> \
    --paired \
    --batch_size=16 \
    --num_workers=16 
    
    • --gt_folder and --pred_folder should be folders that contain only images.
    • To evaluate the results in a paired setting, use --paired; for an unpaired setting, simply omit it.
    • --batch_size and --num_workers should be adjusted based on your machine.

    Acknowledgement

    Our code is modified based on Diffusers. We adopt Stable Diffusion v1.5 inpainting as the base model. We use SCHP and DensePose to automatically generate masks in our Gradio App and ComfyUI workflow. Thanks to all the contributors!

    License

    All the materials, including code, checkpoints, and demo, are made available under the Creative Commons BY-NC-SA 4.0 license. You are free to copy, redistribute, remix, transform, and build upon the project for non-commercial purposes, as long as you give appropriate credit and distribute your contributions under the same license.

    Citation

    @misc{chong2024catvtonconcatenationneedvirtual,
     title={CatVTON: Concatenation Is All You Need for Virtual Try-On with Diffusion Models}, 
     author={Zheng Chong and Xiao Dong and Haoxiang Li and Shiyue Zhang and Wenqing Zhang and Xujie Zhang and Hanqing Zhao and Xiaodan Liang},
     year={2024},
     eprint={2407.15886},
     archivePrefix={arXiv},
     primaryClass={cs.CV},
     url={https://arxiv.org/abs/2407.15886}, 
    }