File size: 2,247 Bytes
37378fe
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
license: other
license_name: picsart-inc-flowdis-model-1.0
license_link: https://huggingface.co/PAIR/FlowDIS/raw/main/LICENSE
tags:
  - remove background
  - background removal
  - dichotomous image segmentation
  - flow matching
datasets:
  - DIS5K
pipeline_tag: image-segmentation
library_name: flowdis
---

# FlowDIS

<p align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)"  srcset="https://flowdis.github.io/static/videos/teaser-dark.avif">
    <source media="(prefers-color-scheme: light)" srcset="https://flowdis.github.io/static/videos/teaser-light.avif">
    <img src="https://flowdis.github.io/static/videos/teaser-light.avif" alt="FlowDIS teaser" width="100%">
  </picture>
</p>

FlowDIS enables highly accurate foreground segmentation, optionally guided by a text prompt. When ambiguity prevents the model from producing the desired result, the user can specify which elements to retain in the foreground.

## Usage

```bash
pip install "git+ssh://git@github.com/Picsart-AI-Research/FlowDIS.git"
```


```python
from PIL import Image
from flowdis import flowdis_predict, load_models

models = load_models(device="cuda")

input_img_path = "path/to/input.jpg"     # Input image path
output_mask_path = "path/to/output.png"  # Path to save the output mask

image = Image.open(input_img_path).convert("RGB")

mask = flowdis_predict(
    image=image,
    prompt="",  # Text prompt
    models=models,
    resolution=1024,
    num_inference_steps=2,
    device="cuda",
)
mask.save(output_mask_path)
```

## License

This model is licensed under the [PicsArt Inc. FlowDIS Model License](https://huggingface.co/PAIR/FlowDIS/raw/main/LICENSE).

## Acknowledgements

This project is built on top of [FLUX.1 [schnell]](https://github.com/black-forest-labs/flux) and [DIS5K](https://github.com/xuebinqin/DIS). 

## BibTeX

If you use our work in your research, please cite our publication:

```
@article{sargsyan2026flowdis,
  title={{FlowDIS: Language-Guided Dichotomous Image Segmentation with Flow Matching}},
  author={Sargsyan, Andranik and Navasardyan, Shant},
  journal={arXiv preprint arXiv:2605.05077},
  year={2026},
  eprint={2605.05077},
  archivePrefix={arXiv},
  url={https://arxiv.org/abs/2605.05077}
}
```