Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,77 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
<h1 align="center">High-Precision Dichotomous Image Segmentation via Probing Diffusion Capacity</h1>
|
6 |
+
|
7 |
+
|
8 |
+
<div align="center" style="display: flex; justify-content: center; flex-wrap: wrap;">
|
9 |
+
<a href='https://arxiv.org/pdf/2410.10105'><img src='https://img.shields.io/badge/arXiv-DiffDIS-B31B1B'></a> 
|
10 |
+
<a href='https://github.com/qianyu-dlut/DiffDIS'><img src='https://img.shields.io/badge/Github-DiffDIS-blue'></a> 
|
11 |
+
<a href='LICENSE'><img src='https://img.shields.io/badge/License-MIT-yellow'></a> 
|
12 |
+
</div>
|
13 |
+
|
14 |
+
|
15 |
+
This repository contains the official implementation for the paper "[High-Precision Dichotomous Image Segmentation via Probing Diffusion Capacity](https://arxiv.org/pdf/2410.10105)" (ICLR 2025).
|
16 |
+
|
17 |
+
<p align="center">
|
18 |
+
<img alt="DiffDIS teaser image" src="https://raw.githubusercontent.com/qianyu-dlut/DiffDIS/master/assets/image.png" width="900px">
|
19 |
+
</p>
|
20 |
+
|
21 |
+
## How to use
|
22 |
+
> For the complete training and inference process, please refer to our [GitHub Repository](https://github.com/qianyu-dlut/DiffDIS). This section specifically guides you on loading weights from Hugging Face.
|
23 |
+
|
24 |
+
### Install Packages:
|
25 |
+
```shell
|
26 |
+
pip install torch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 --index-url https://download.pytorch.org/whl/cu118
|
27 |
+
pip install -r requirements.txt
|
28 |
+
pip install -e diffusers-0.30.2/
|
29 |
+
```
|
30 |
+
|
31 |
+
### Load DiffDIS weights from Hugging Face:
|
32 |
+
|
33 |
+
```python
|
34 |
+
# Use codes and weights locally
|
35 |
+
import torch
|
36 |
+
from diffusers import (
|
37 |
+
DiffusionPipeline,
|
38 |
+
DDPMScheduler,
|
39 |
+
UNet2DConditionModel,
|
40 |
+
AutoencoderKL,
|
41 |
+
)
|
42 |
+
from transformers import CLIPTextModel, CLIPTokenizer
|
43 |
+
|
44 |
+
hf_model_path = 'qianyu1217/diffdis'
|
45 |
+
vae = AutoencoderKL.from_pretrained(hf_model_path,subfolder='vae',trust_remote_code=True)
|
46 |
+
scheduler = DDPMScheduler.from_pretrained(hf_model_path,subfolder='scheduler')
|
47 |
+
text_encoder = CLIPTextModel.from_pretrained(hf_model_path,subfolder='text_encoder')
|
48 |
+
tokenizer = CLIPTokenizer.from_pretrained(hf_model_path,subfolder='tokenizer')
|
49 |
+
unet = UNet2DConditionModel_diffdis.from_pretrained(hf_model_path,subfolder="unet",
|
50 |
+
in_channels=8, sample_size=96,
|
51 |
+
low_cpu_mem_usage=False,
|
52 |
+
ignore_mismatched_sizes=False,
|
53 |
+
class_embed_type='projection',
|
54 |
+
projection_class_embeddings_input_dim=4,
|
55 |
+
mid_extra_cross=True,
|
56 |
+
mode = 'DBIA',
|
57 |
+
use_swci = True)
|
58 |
+
pipe = DiffDISPipeline(unet=unet,
|
59 |
+
vae=vae,
|
60 |
+
scheduler=scheduler,
|
61 |
+
text_encoder=text_encoder,
|
62 |
+
tokenizer=tokenizer)
|
63 |
+
|
64 |
+
```
|
65 |
+
|
66 |
+
|
67 |
+
|
68 |
+
## Citation
|
69 |
+
|
70 |
+
```
|
71 |
+
@article{DiffDIS,
|
72 |
+
title={High-Precision Dichotomous Image Segmentation via Probing Diffusion Capacity},
|
73 |
+
author={Yu, Qian and Jiang, Peng-Tao and Zhang, Hao and Chen, Jinwei and Li, Bo and Zhang, Lihe and Lu, Huchuan},
|
74 |
+
journal={arXiv preprint arXiv:2410.10105},
|
75 |
+
year={2024}
|
76 |
+
}
|
77 |
+
```
|