Text Generation
Transformers
PyTorch
llava

Add pipeline tag, library name and project information

#1
by nielsr HF Staff - opened
Files changed (1) hide show
  1. README.md +203 -3
README.md CHANGED
@@ -1,3 +1,203 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: video-segmentation
4
+ library_name: transformers
5
+ ---
6
+
7
+ # GLUS: Global-Local Reasoning Unified into A Single Large Language Model for Video Segmentation
8
+ <div style="text-align: center;">
9
+ <p>
10
+ <a href="https://openreview.net/profile?id=~Lang_Lin3">Lang Lin</a>*,
11
+ <a href="https://openreview.net/profile?id=~Xueyang_Yu1">Xueyang Yu</a>*,
12
+ <a href="https://ziqipang.github.io/">Ziqi Pang</a>*,
13
+ <a href="https://yxw.web.illinois.edu/">Yu-Xiong Wang</a>
14
+ </p>
15
+ </div>
16
+
17
+ [[`Project Page`](https://glus-video.github.io/)] [[`arXiv`](https://arxiv.org/abs/2504.07962)]
18
+
19
+
20
+ [![arXiv](https://img.shields.io/badge/arXiv-2504.07962-A42C25?style=flat&logo=arXiv&logoColor=A42C25)](https://arxiv.org/abs/2504.07962)
21
+ [![Project](https://img.shields.io/badge/Project-Page-green?style=flat&logo=Google%20chrome&logoColor=green)](https://glus-video.github.io/)
22
+ [![HuggingFace](https://img.shields.io/badge/HuggingFace-Model-yellow?style=flat&logo=HuggingFace&logoColor=yellow)](https://huggingface.co/Swindl/GLUS-A)
23
+
24
+
25
+
26
+ <div align=center>
27
+ <img src="assets/teaserfig.png" style="width:100%;">
28
+ </div>
29
+
30
+ ## Overview
31
+
32
+ **RefVOS in complex scenarios** places high demands on models' video understanding and fine-grained localization capabilities. Recently, numerous models leveraging **MLLM-based** comprehension and reasoning abilities have been proposed to address this challenge. Our **GLUS** advances further along this methodological path.
33
+
34
+ πŸš€ **GLUS is principled.** It utilizes global-local reasoning to combine holistic video understanding with detailed frames understanding, unleashing the potential of fine-grained segmentation in complex scenarios.
35
+
36
+ ✨ **GLUS is powerful.** It unifies the methods of memory bank, object contrastive learning and key frame selection to tackle the problems of mask inconsistency and object obfuscation, achieving state-of-the-art performance in complex-scenario RefVOS tasks.
37
+
38
+ πŸ“Œ **GLUS is simple.** It elegantly integrates the approach for complex-scenario RefVOS tasks within a single MLLM framework, eliminating the necessity of utilizing other independent modules.
39
+
40
+ <div align=center>
41
+ <img src="assets/pipeline_00.png" style="width:100%;">
42
+ </div>
43
+
44
+ ## News
45
+
46
+ ## Installation
47
+ ```shell
48
+ git clone git@github.com:GLUS-video/GLUS.git && cd GLUS
49
+ pip install -r requirements.txt
50
+ pip install ./model/segment-anything-2
51
+ pip install flash-attn==2.6.2 --no-build-isolation
52
+ ```
53
+
54
+ ## Model Zoo
55
+
56
+ For more convenient following, we provide the checkpoints of GLUS without object contrastive learning.
57
+
58
+ | Model | Training Datasets | Methods | Download | MeViS J\&F | Ref-Youtube-VOS J\&F |
59
+ |--------------------------------------|---------------------------------|--------------|----------|-----------|-----------------------|
60
+ | **GLUS<sup><i>S</i></sup><sub>partial</sub>** | MeViS, Ref-Youtube-VOS | GLU + MB | [HuggingFace](https://huggingface.co/Swindl/GLUS-S-partial/tree/main), [ModelScope](https://www.modelscope.cn/models/LangLin/GLUS-S-partial/files) | 49.5 | 65.2 |
61
+ | **GLUS<sup><i>S</i></sup>** | MeViS, Ref-Youtube-VOS | GLU + MB + OC + KFS | [HuggingFace](https://huggingface.co/Swindl/GLUS-S/tree/main), [ModelScope](https://www.modelscope.cn/models/LangLin/GLUS-S/files) | 50.3 | 66.6 |
62
+ | **GLUS<sup><i>A</i></sup>** | + RefDAVIS17, ReVOS, LVVIS | GLU + MB | [HuggingFace](https://huggingface.co/Swindl/GLUS-A/tree/main), [ModelScope](https://www.modelscope.cn/models/LangLin/GLUS-A/files) | 51.3 | 67.3 |
63
+
64
+ **Notes**: β€œGLU”: Global-local unification, β€œMB”: End-to-end memory bank, β€œOC”: Object contrastive loss, β€œKFS”: key frame selection.
65
+ GLUS<sup><i>S</i></sup> refers to the model trained on a subset of existing RefVOS datasets (Mevis and Ref-Youtube-VOS), while GLUS<sup><i>A</i></sup> denotes the model trained on the full set of available datasets.
66
+
67
+ We recommend to download and store the pretrained weights at ``GLUS_ROOT/checkpoints``.
68
+
69
+ ## Training and Validation
70
+
71
+ ### 1. Data Preparation
72
+
73
+ Please follow the below architecture to prepare the datasets. We recommend to set ``DATASET_ROOT`` to ``GLUS_ROOT/data``.
74
+
75
+ 1. RefVOS Datasets: [MeViS](https://github.com/henghuiding/MeViS), [Refer-YouTube-VOS](https://codalab.lisn.upsaclay.fr/competitions/3282#participate-get-data), [Ref-DAVIS17](https://github.com/wjn922/ReferFormer/blob/main/docs/data.md).
76
+ 2. Reasoning VOS Datasets: [ReVOS](https://github.com/cilinyan/ReVOS-api), [ReasonVOS](https://github.com/showlab/VideoLISA/blob/main/BENCHMARK.md)
77
+ 3. Open-Vocabulary Video Instance Segmentation Dataset: [LV-VIS](https://github.com/haochenheheda/LVVIS/tree/main).
78
+
79
+ <details open>
80
+ <summary> <strong>Datasets Architecture</strong> </summary>
81
+
82
+ ```
83
+ DATASET_ROOT
84
+ β”œβ”€β”€ mevis
85
+ β”‚ β”œβ”€β”€ train
86
+ β”‚ β”‚ β”œβ”€β”€ JPEGImages
87
+ β”‚ β”‚ β”œβ”€β”€ mask_dict.json
88
+ β”‚ β”‚ └── meta_expressions.json
89
+ β”‚ β”œβ”€β”€ valid
90
+ β”‚ β”‚ β”œβ”€β”€ JPEGImages
91
+ β”‚ β”‚ └── meta_expressions.json
92
+ β”‚ └── valid_u
93
+ β”‚ β”œβ”€β”€ JPEGImages
94
+ β”‚ β”œβ”€β”€ mask_dict.json
95
+ β”‚ └── meta_expressions.json
96
+ β”œβ”€β”€ Refer-YouTube-VOS
97
+ β”‚ β”œβ”€β”€ meta_expressions
98
+ β”‚ β”‚ β”œβ”€β”€ train/meta_expressions.json
99
+ β”‚ β”‚ └── valid/meta_expressions.json
100
+ β”‚ β”œβ”€β”€ train
101
+ β”‚ β”‚ β”œβ”€β”€ JPEGImages
102
+ β”‚ β”‚ └── Annotations
103
+ β”‚ └── valid
104
+ β”‚ └── JPEGImages
105
+ β”œβ”€β”€ DAVIS17
106
+ β”‚ β”œβ”€β”€ meta_expressions
107
+ β”‚ β”‚ β”œβ”€β”€ train/meta_expressions.json
108
+ β”‚ β”‚ └── valid/meta_expressions.json
109
+ β”‚ β”œβ”€β”€ train
110
+ β”‚ β”‚ β”œβ”€β”€ JPEGImages
111
+ β”‚ β”‚ └── Annotations
112
+ β”‚ └── valid
113
+ β”‚ β”œβ”€β”€ JPEGImages
114
+ β”‚ └── Annotations
115
+ β”œβ”€β”€ LVVIS
116
+ β”‚ β”œβ”€β”€ train
117
+ β”‚ β”‚ └── JPEGImages
118
+ β”‚ β”œβ”€β”€ mask_dict.json
119
+ β”‚ └── meta_expressions.json
120
+ β”œβ”€β”€ ReVOS
121
+ β”‚ β”œβ”€β”€ JPEGImages
122
+ β”‚ β”œβ”€β”€ mask_dict.json
123
+ β”‚ β”œβ”€β”€ mask_dict_foreground.json
124
+ β”‚ β”œβ”€β”€ meta_expressions_train_.json
125
+ β”‚ └── meta_expressions_valid_.json
126
+ β”œβ”€β”€ ReasonVOS
127
+ β”‚ β”œβ”€β”€ JPEGImages
128
+ β”‚ β”œβ”€β”€ Annotations
129
+ β”‚ β”œβ”€β”€ meta_expressions.json
130
+
131
+ ```
132
+
133
+ </details>
134
+
135
+ ### 2. Model Weights Preparation
136
+
137
+ Follow the guidance to prepare for the pretrained weights of LISA and SAM-2 for training GLUS:
138
+
139
+ 1. Download the pretrained weights of LISA from [LISA-7B-v1](https://huggingface.co/xinlai/LISA-7B-v1/tree/main).
140
+ 2. Download the pretrained weights of SAM-2 from [sam2_hiera_large](https://dl.fbaipublicfiles.com/segment_anything_2/072824/sam2_hiera_large.pt).
141
+
142
+ <details>
143
+ <summary> Then organize them in the following architecture: </summary>
144
+
145
+ ```
146
+ WEIGHTS_ROOT
147
+ β”œβ”€β”€ LISA-7B-v1
148
+ └── sam2_hiera_large.pt
149
+ ```
150
+
151
+ We recommend to set ``WEIGHTS_ROOT`` to ``GLUS_ROOT/checkpoints``.
152
+
153
+ </details>
154
+
155
+ ### 3. Training
156
+
157
+ Set the paths in the scripts and then run ``scripts/train_glus_s.sh`` or ``scripts/train_glus_a.sh``. The scripts will automatically start the training, and transform the saved checkpoint into hugging-face format when the training finished.
158
+
159
+ #### Key Frame Selection
160
+ For the usage of key frame selection, please refer to the [KFS_README](kfs/README.md).
161
+
162
+
163
+ ### 4. Evaluation
164
+
165
+ Set the paths, ``val_set`` and ``set_name`` in ``scripts/inference.sh``, and then run it. It will detect the available GPUs firstly and then individually run parallelizable inference on each gpu.
166
+
167
+ #### Evaluation with Key Frame Selection
168
+ Set the args ``use_kf`` and ``kf_path`` in ``scripts/inference_kf.sh``, and then run it. We provide our json file on Mevis and Refyoutube-VOS for **GLUS<sup><i>S</i></sup>** on the [google drive](https://drive.google.com/drive/folders/1NcjOguZUmal7Xk7rihyhvs5GRK_RzQSO?usp=sharing).
169
+
170
+ After the masks are generated completely, run the corresponding evalaution python file in ``utils``. You may need to set the groundtruth mask path, predicted mask path and expressions json file path. Please refer to the eval files to see the help on arguments.
171
+
172
+ An example:
173
+
174
+ ```
175
+ python utils/eval_mevis.py \\
176
+ --mevis_exp_path=\'$GLUS_ROOT/data/mevis/valid_u/meta_expressions.json\' \\
177
+ --mevis_mask_path=\'$GLUS_ROOT/data/mevis/valid_u/mask_dict.json\'
178
+ --mevis_pred_path=\'$GLUS_ROOT/generated\'
179
+ ```
180
+
181
+ Specially, to evaluate the performance on ``Refer-YouTube-VOS Valid`` or ``MeViS Valid`` benchmarks, you may need to submit the predicted masks results following the guidance at [MeViS-Evaluation-Server](https://codalab.lisn.upsaclay.fr/competitions/15094) or [RefYoutube-Evaluation-Server](https://codalab.lisn.upsaclay.fr/competitions/3282).
182
+
183
+ ## Inference and Demo
184
+
185
+ Please refer to ``demo.ipynb`` to inference on your own videos and referrings.
186
+
187
+ For more examples, please refer to our [Project Page](https://glus-video.github.io/).
188
+ ## Citation
189
+ If you find this work useful in your research, please consider citing:
190
+ ```bibtex
191
+ @inproceedings{lin2025glus,
192
+ title={GLUS: Global-Local Reasoning Unified into A Single Large Language Model for Video Segmentation},
193
+ author={Lin, Lang and Yu, Xueyang and Pang, Ziqi and Wang, Yu-Xiong},
194
+ booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
195
+ year={2025}
196
+ }
197
+ ```
198
+ ## Acknowledgement
199
+ We thank the contributors to the following open-source projects. Our project is impossible without the inspirations from these excellent researchers.
200
+ * [LISA](https://github.com/dvlab-research/LISA)
201
+ * [SAM2](https://github.com/facebookresearch/sam2)
202
+ * [Mevis](https://github.com/henghuiding/MeViS)
203
+ * [VISA](https://github.com/cilinyan/VISA)