首页
/ 【亲测免费】 CatVton-Flux 使用教程

【亲测免费】 CatVton-Flux 使用教程

2026-01-30 04:39:01作者:郁楠烈Hubert

1. 项目介绍

CatVton-Flux 是一个结合了 CATVTON 和 Flux fill inpainting 模型的虚拟试衣解决方案。它利用 CATVTON 模型强大的虚拟试衣能力以及 Flux fill inpainting 模型的高质量图像修复功能,实现了逼真准确的衣物转移效果。此外,项目还受到了 In-Context LoRA 技术的启发,用于提示工程。

2. 项目快速启动

环境准备

确保您的系统满足以下要求:

  • VRAM >= 40GB(建议使用 80GB GPU,以避免内存溢出错误)

创建并激活 Conda 环境:

conda create -n flux python=3.10
conda activate flux

安装依赖:

pip install -r requirements.txt

登录 Hugging Face:

huggingface-cli login

训练模型

准备数据集:从 VITON-HD 下载数据集,并确保数据目录结构如下所示:

train
|-- ...
test
|-- image
|-- image-densepose
|-- agnostic-mask
|-- cloth

运行训练脚本:

bash train_flux_inpaint.sh

确保调整数据集路径和文本文件。

推理演示

Try-off 推理

从着装模型图像中恢复正面衣物:

python tryoff_inference.py \
--image ./example/person/00069_00.jpg \
--mask ./example/person/00069_00_mask.png \
--seed 41 \
--output_tryon test_original.png \
--output_garment restored_garment6.png \
--steps 30

Try-on 推理

使用 LoRA 版本:

python tryon_inference_lora.py \
--image ./example/person/00008_00.jpg \
--mask ./example/person/00008_00_mask.png \
--garment ./example/garment/00034_00.jpg \
--seed 4096 \
--output_tryon test_lora.png \
--steps 30

使用微调版本:

python tryon_inference.py \
--image ./example/person/00008_00.jpg \
--mask ./example/person/00008_00_mask.png \
--garment ./example/garment/00034_00.jpg \
--seed 42 \
--output_tryon test.png \
--steps 30

启动 Gradio 演示

使用 LoRA 权重启动 Gradio 演示:

python app.py

不使用 LoRA 权重启动 Gradio 演示:

python app_no_lora.py

3. 应用案例和最佳实践

  • 使用 CatVton-Flux 进行虚拟试衣时,确保使用高质量的图像和准确的遮罩。
  • 在训练模型时,使用足够大的数据集以获得更好的性能。
  • 考虑使用 LoRA 技术来提高模型的泛化能力。

4. 典型生态项目

  • 无相关生态项目信息提供。
登录后查看全文
热门项目推荐
相关项目推荐