rizavelioglu
commited on
Commit
·
6127e61
1
Parent(s):
ba4cd2c
add v2 infos
Browse files
README.md
CHANGED
|
@@ -15,48 +15,44 @@ pipeline_tag: image-to-image
|
|
| 15 |
library_name: diffusers
|
| 16 |
---
|
| 17 |
|
| 18 |
-
## TryOffDiff
|
| 19 |
|
| 20 |
-
|
| 21 |
-
[[paper]][paper_arxiv]
|
| 22 |
-
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## Usage
|
| 26 |
|
| 27 |
```python
|
|
|
|
| 28 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
-
def __init__(self):
|
| 32 |
-
super().__init__()
|
| 33 |
-
self.unet = UNet2DConditionModel.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="unet")
|
| 34 |
-
self.transformer = torch.nn.TransformerEncoderLayer(d_model=768, nhead=8, batch_first=True)
|
| 35 |
-
self.proj = nn.Linear(1024, 77)
|
| 36 |
-
self.norm = nn.LayerNorm(768)
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
repo_id="rizavelioglu/tryoffdiff",
|
| 49 |
-
filename="tryoffdiff.pth", # or one of ablations ["ldm-1", "ldm-2", "ldm-3", ...]
|
| 50 |
-
)
|
| 51 |
-
net = TryOffDiff()
|
| 52 |
-
net.load_state_dict(torch.load(path_model, weights_only=False))
|
| 53 |
-
net.eval().to(device)
|
| 54 |
```
|
| 55 |
|
| 56 |
-
>
|
| 57 |
-
|
| 58 |
-
> Also, check out [GitHub repository][github] to get more information on
|
| 59 |
-
> training, inference, and evaluation.
|
| 60 |
|
| 61 |
### License
|
| 62 |
TL;DR: Not available for commercial use, unless the FULL source code is shared! \
|
|
@@ -64,7 +60,7 @@ This project is intended solely for academic research. No commercial benefits ar
|
|
| 64 |
Models are licensed under [Server Side Public License (SSPL)][license]
|
| 65 |
|
| 66 |
### Citation
|
| 67 |
-
If you
|
| 68 |
```
|
| 69 |
@article{velioglu2024tryoffdiff,
|
| 70 |
title = {TryOffDiff: Virtual-Try-Off via High-Fidelity Garment Reconstruction using Diffusion Models},
|
|
@@ -73,11 +69,19 @@ If you find this repository useful in your research, please consider giving a st
|
|
| 73 |
year = {2024},
|
| 74 |
note = {\url{https://doi.org/nt3n}}
|
| 75 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
```
|
| 77 |
|
| 78 |
[hf_spaces]: https://huggingface.co/spaces/rizavelioglu/tryoffdiff/blob/main/app.py
|
| 79 |
[project_page]: https://rizavelioglu.github.io/tryoffdiff/
|
| 80 |
[paper_arxiv]: https://arxiv.org/abs/2411.18350
|
|
|
|
| 81 |
[github]: https://github.com/rizavelioglu/tryoffdiff
|
| 82 |
[license]: https://www.mongodb.com/legal/licensing/server-side-public-license
|
| 83 |
|
|
|
|
| 15 |
library_name: diffusers
|
| 16 |
---
|
| 17 |
|
| 18 |
+
## TryOffDiff <small>[[Project Page]][project_page]</small>
|
| 19 |
|
| 20 |
+
These models are based on the research papers:
|
| 21 |
+
1. _"TryOffDiff: Virtual-Try-Off via High-Fidelity Garment Reconstruction using Diffusion Models"_ [[paper]][paper_arxiv]
|
| 22 |
+
2. _"Enhancing Person-to-Person Virtual Try-On with Multi-Garment Virtual Try-Off"_ [[paper]][paper2_arxiv]
|
| 23 |
|
| 24 |
+
Available models:
|
| 25 |
+
- `tryoffdiff.pth`: Generates upper-body garments. Fine-tuned on `VITON-HD-train`.
|
| 26 |
+
- `tryoffdiffv2_upper.pth`: Generates upper-body garments. Fine-tuned on a subset of `Dress Code-train`.
|
| 27 |
+
- `tryoffdiffv2_lower.pth`: Generates lower-body garments. Fine-tuned on a subset of `Dress Code-train`.
|
| 28 |
+
- `tryoffdiffv2_dress.pth`: Generates dresses. Fine-tuned on a subset of `Dress Code-train`.
|
| 29 |
+
- `tryoffdiffv2_multi.pth`: Generates all three garment types (upper-body, lower-body, dresses). Fine-tuned on the entire `Dress Code-train`.
|
| 30 |
|
| 31 |
## Usage
|
| 32 |
|
| 33 |
```python
|
| 34 |
+
import torch
|
| 35 |
from huggingface_hub import hf_hub_download
|
| 36 |
+
from tryoffdiff.modeling.model import create_model
|
| 37 |
|
| 38 |
+
repo = "rizavelioglu/tryoffdiff" # Define the repository
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
# --- Helper function to load a model ---
|
| 41 |
+
def load_tryoffdiff_model(model_name, filename, device="cuda"):
|
| 42 |
+
model = create_model(model_name)
|
| 43 |
+
model_path = hf_hub_download(repo_id=repo, filename=filename)
|
| 44 |
+
model.load_state_dict(torch.load(model_path, weights_only=True))
|
| 45 |
+
return model.eval().to(device)
|
| 46 |
|
| 47 |
+
tryoffdiffv1 = load_tryoffdiff_model("TryOffDiff", "tryoffdiff.pth")
|
| 48 |
+
tryoffdiffv2_upper = load_tryoffdiff_model("TryOffDiffv2_single", "tryoffdiffv2_upper.pth")
|
| 49 |
+
tryoffdiffv2_lower = load_tryoffdiff_model("TryOffDiffv2_single", "tryoffdiffv2_lower.pth")
|
| 50 |
+
tryoffdiffv2_dress = load_tryoffdiff_model("TryOffDiffv2_single", "tryoffdiffv2_dress.pth")
|
| 51 |
+
tryoffdiffv2_multi = load_tryoffdiff_model("TryOffDiffv2", "tryoffdiffv2_multi.pth")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
```
|
| 53 |
|
| 54 |
+
> For a complete running example, see the demo code on [HuggingFace Spaces][hf_spaces].\
|
| 55 |
+
> For more information on training, inference, and evaluation, refer to the [GitHub repository][github].
|
|
|
|
|
|
|
| 56 |
|
| 57 |
### License
|
| 58 |
TL;DR: Not available for commercial use, unless the FULL source code is shared! \
|
|
|
|
| 60 |
Models are licensed under [Server Side Public License (SSPL)][license]
|
| 61 |
|
| 62 |
### Citation
|
| 63 |
+
If you use this work, please give a star ⭐ and a citation:
|
| 64 |
```
|
| 65 |
@article{velioglu2024tryoffdiff,
|
| 66 |
title = {TryOffDiff: Virtual-Try-Off via High-Fidelity Garment Reconstruction using Diffusion Models},
|
|
|
|
| 69 |
year = {2024},
|
| 70 |
note = {\url{https://doi.org/nt3n}}
|
| 71 |
}
|
| 72 |
+
@article{velioglu2025enhancing,
|
| 73 |
+
title = {Enhancing Person-to-Person Virtual Try-On with Multi-Garment Virtual Try-Off},
|
| 74 |
+
author = {Velioglu, Riza and Bevandic, Petra and Chan, Robin and Hammer, Barbara},
|
| 75 |
+
journal = {arXiv},
|
| 76 |
+
year = {2025},
|
| 77 |
+
note = {\url{https://doi.org/pn67}}
|
| 78 |
+
}
|
| 79 |
```
|
| 80 |
|
| 81 |
[hf_spaces]: https://huggingface.co/spaces/rizavelioglu/tryoffdiff/blob/main/app.py
|
| 82 |
[project_page]: https://rizavelioglu.github.io/tryoffdiff/
|
| 83 |
[paper_arxiv]: https://arxiv.org/abs/2411.18350
|
| 84 |
+
[paper2_arxiv]: https://arxiv.org/abs/2504.13078
|
| 85 |
[github]: https://github.com/rizavelioglu/tryoffdiff
|
| 86 |
[license]: https://www.mongodb.com/legal/licensing/server-side-public-license
|
| 87 |
|