JasonCoderMaker commited on
Commit
5408e3c
Β·
verified Β·
1 Parent(s): 85cfc5b

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +299 -0
README.md ADDED
@@ -0,0 +1,299 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - video-text-retrieval
5
+ - text-to-video
6
+ language:
7
+ - en
8
+ tags:
9
+ - video-retrieval
10
+ - generative-retrieval
11
+ - semantic-ids
12
+ - text-to-video
13
+ size_categories:
14
+ - 10K<n<100K
15
+ ---
16
+
17
+ # GRDR-TVR: Generative Recall, Dense Reranking for Text-to-Video Retrieval
18
+
19
+ This dataset contains the pre-extracted video features and trained model checkpoints for the GRDR (Generative Recall, Dense Reranking) framework for efficient Text-to-Video Retrieval (TVR).
20
+
21
+ ## πŸ“„ Paper
22
+
23
+ **Generative Recall, Dense Reranking: Learning Multi-View Semantic IDs for Efficient Text-to-Video Retrieval**
24
+
25
+ *Conference: SIGIR 2026*
26
+
27
+ [Paper PDF](https://arxiv.org/abs/XXXX.XXXXX) | [Code Repository](https://github.com/JasonCoderMaker/GRDR)
28
+
29
+ ## πŸ“Š Dataset Overview
30
+
31
+ This dataset includes three main components:
32
+
33
+ ### 1. InternVideo2 Features (~3.4GB)
34
+ Pre-extracted video features using InternVideo2 encoder for four benchmark datasets:
35
+ - **MSR-VTT**: 10,000 videos (932MB)
36
+ - **ActivityNet**: 20,000 videos (1.1GB)
37
+ - **DiDeMo**: 10,464 videos (916MB)
38
+ - **LSMDC**: 1,000 movies, 118,081 clips (424MB)
39
+
40
+ **Feature Details:**
41
+ - Dimension: 512-d embeddings
42
+ - Format: Pickle files (`.pkl`) with `{video_id: embedding}` mappings
43
+ - Extraction: InternVideo2 (InternVL-2B) with temporal pooling
44
+
45
+ ### 2. GRDR Model Checkpoints (~2GB)
46
+ Trained GRDR models (T5-small based) for all four datasets:
47
+ - **MSR-VTT**: 494MB
48
+ - **ActivityNet**: 498MB
49
+ - **DiDeMo**: 504MB
50
+ - **LSMDC**: 478MB
51
+
52
+ **Checkpoint Components:**
53
+ - `best_model.pt` - Complete model checkpoint
54
+ - `best_model.pt.model` - T5 encoder-decoder weights
55
+ - `best_model.pt.videorqvae` - Video RQ-VAE quantizer
56
+ - `best_model.pt.code` - Pre-computed semantic IDs
57
+ - `best_model.pt.centroids` - Codebook centroids
58
+ - `best_model.pt.embedding` - Learned embeddings
59
+ - `best_model.pt.start_token` - Start token embeddings
60
+
61
+ **Model Architecture:**
62
+ - Base: T5-small (60M parameters)
63
+ - Codebook size: 128/96/200 (dataset-dependent)
64
+ - Max code length: 3
65
+ - Training: 3-phase progressive training
66
+
67
+ ### 3. Xpool Reranker Checkpoints (~7.2GB)
68
+ Pre-trained reranker models for dense reranking stage:
69
+ - **MSR-VTT**: msrvtt9k_model_best.pth (1.8GB)
70
+ - **ActivityNet**: actnet_model_best.pth (1.8GB)
71
+ - **DiDeMo**: didemo_model_best.pth (1.8GB)
72
+ - **LSMDC**: lsmdc_model_best.pth (1.8GB)
73
+
74
+ **Reranker Details:**
75
+ - Architecture: CLIP-based (ViT-B/32)
76
+ - Purpose: Fine-grained reranking of recalled candidates
77
+ - Format: PyTorch checkpoint files (`.pth`)
78
+
79
+ ## πŸš€ Quick Start
80
+
81
+ ### Download Specific Components
82
+
83
+ #### Using Python Script
84
+
85
+ ```bash
86
+ # Download everything
87
+ python download_features.py --all
88
+
89
+ # Download only InternVideo2 features for specific datasets
90
+ python download_features.py --features --datasets msrvtt actnet
91
+
92
+ # Download GRDR checkpoints only
93
+ python download_features.py --grdr
94
+
95
+ # Download Xpool reranker only
96
+ python download_features.py --xpool --datasets msrvtt
97
+ ```
98
+
99
+ #### Using Hugging Face CLI
100
+
101
+ ```bash
102
+ # Download entire dataset
103
+ huggingface-cli download JasonCoderMaker/GRDR-TVR --repo-type dataset --local-dir ./GRDR-TVR
104
+
105
+ # Download specific component
106
+ huggingface-cli download JasonCoderMaker/GRDR-TVR InternVideo2/msrvtt --repo-type dataset --local-dir ./features
107
+
108
+ # Download GRDR checkpoint for MSR-VTT
109
+ huggingface-cli download JasonCoderMaker/GRDR-TVR GRDR/msrvtt --repo-type dataset --local-dir ./checkpoints
110
+ ```
111
+
112
+ ### Load Features in Python
113
+
114
+ ```python
115
+ import pickle
116
+ from huggingface_hub import hf_hub_download
117
+
118
+ # Download and load InternVideo2 features
119
+ feature_file = hf_hub_download(
120
+ repo_id="JasonCoderMaker/GRDR-TVR",
121
+ filename="InternVideo2/msrvtt/msrvtt_internvideo2.pkl",
122
+ repo_type="dataset"
123
+ )
124
+
125
+ with open(feature_file, 'rb') as f:
126
+ video_features = pickle.load(f)
127
+
128
+ # Access features
129
+ video_id = "video7015"
130
+ embedding = video_features[video_id] # Shape: (512,)
131
+ print(f"Feature shape: {embedding.shape}")
132
+ ```
133
+
134
+ ### Load GRDR Model
135
+
136
+ ```python
137
+ import torch
138
+ from huggingface_hub import hf_hub_download
139
+
140
+ # Download checkpoint
141
+ checkpoint_path = hf_hub_download(
142
+ repo_id="JasonCoderMaker/GRDR-TVR",
143
+ filename="GRDR/msrvtt/best_model/best_model.pt",
144
+ repo_type="dataset"
145
+ )
146
+
147
+ # Load model
148
+ checkpoint = torch.load(checkpoint_path, map_location='cpu')
149
+ print(f"Available keys: {checkpoint.keys()}")
150
+
151
+ # Use with your GRDR model
152
+ from models.grdr import GRDR
153
+ model = GRDR(...)
154
+ model.load_state_dict(checkpoint['model'], strict=False)
155
+ ```
156
+
157
+ ### Load Xpool Reranker
158
+
159
+ ```python
160
+ import torch
161
+ from huggingface_hub import hf_hub_download
162
+
163
+ # Download reranker checkpoint
164
+ reranker_path = hf_hub_download(
165
+ repo_id="JasonCoderMaker/GRDR-TVR",
166
+ filename="Xpool/msrvtt9k_model_best.pth",
167
+ repo_type="dataset"
168
+ )
169
+
170
+ # Load reranker
171
+ checkpoint = torch.load(reranker_path, map_location='cpu')
172
+ # Use with your Xpool model
173
+ ```
174
+
175
+ ## πŸ“‚ Repository Structure
176
+
177
+ ```
178
+ GRDR-TVR/
179
+ β”œβ”€β”€ README.md # This file
180
+ β”œβ”€β”€ download_features.py # Python download utility
181
+ β”œβ”€β”€ download_checkpoints.sh # Bash download script
182
+ β”‚
183
+ β”œβ”€β”€ InternVideo2/ # Video Features (3.4GB)
184
+ β”‚ β”œβ”€β”€ actnet/
185
+ β”‚ β”‚ └── actnet_internvideo2.pkl
186
+ β”‚ β”œβ”€β”€ didemo/
187
+ β”‚ β”‚ └── didemo_internvideo2.pkl
188
+ β”‚ β”œβ”€β”€ lsmdc/
189
+ β”‚ β”‚ └── lsmdc_internvideo2.pkl
190
+ β”‚ └── msrvtt/
191
+ β”‚ └── msrvtt_internvideo2.pkl
192
+ β”‚
193
+ β”œβ”€β”€ GRDR/ # GRDR Checkpoints (2GB)
194
+ β”‚ β”œβ”€β”€ actnet/best_model/
195
+ β”‚ β”œβ”€β”€ didemo/best_model/
196
+ β”‚ β”œβ”€β”€ lsmdc/best_model/
197
+ β”‚ └── msrvtt/best_model/
198
+ β”‚
199
+ └── Xpool/ # Reranker Checkpoints (7.2GB)
200
+ β”œβ”€β”€ actnet_model_best.pth
201
+ β”œβ”€β”€ didemo_model_best.pth
202
+ β”œβ”€β”€ lsmdc_model_best.pth
203
+ └── msrvtt9k_model_best.pth
204
+ ```
205
+
206
+ ## πŸ”¬ Dataset Statistics
207
+
208
+ | Dataset | Videos | Train Queries | Test Queries | Feature Size | GRDR Size | Xpool Size |
209
+ |---------|--------|---------------|--------------|--------------|-----------|------------|
210
+ | MSR-VTT | 10,000 | 9,000 | 1,000 | 932 MB | 494 MB | 1.8 GB |
211
+ | ActivityNet | 20,000 | 10,009 | 4,917 | 1.1 GB | 498 MB | 1.8 GB |
212
+ | DiDeMo | 10,464 | 8,395 | 1,065 | 916 MB | 504 MB | 1.8 GB |
213
+ | LSMDC | 118,081 | 118,081 | 1,000 | 424 MB | 478 MB | 1.8 GB |
214
+ | **Total** | - | - | - | **3.4 GB** | **2.0 GB** | **7.2 GB** |
215
+
216
+ ## 🎯 Performance
217
+
218
+ GRDR achieves competitive accuracy with dense retrievers while being significantly more efficient:
219
+
220
+ | Dataset | R@1 | R@5 | R@10 | Storage Reduction | Speed-up |
221
+ |---------|-----|-----|------|-------------------|----------|
222
+ | MSR-VTT | 45.2 | 72.1 | 81.3 | 15.6Γ— | 287Γ— |
223
+ | ActivityNet | 41.8 | 76.2 | 86.4 | 12.3Γ— | 310Γ— |
224
+ | DiDeMo | 43.1 | 71.8 | 81.7 | 18.2Γ— | 265Γ— |
225
+ | LSMDC | 24.3 | 48.9 | 59.2 | 22.1Γ— | 298Γ— |
226
+
227
+ *Compared to CLIP4Clip baseline with exhaustive search*
228
+
229
+ ## πŸ’» Usage in GRDR Pipeline
230
+
231
+ ### Complete Retrieval Pipeline
232
+
233
+ ```python
234
+ from models.grdr import GRDR
235
+ from reranker.xpool import XpoolReranker
236
+ import torch
237
+
238
+ # 1. Load video features
239
+ video_features = load_internvideo2_features("msrvtt")
240
+
241
+ # 2. Load GRDR model for recall
242
+ grdr_model = GRDR.from_pretrained("JasonCoderMaker/GRDR-TVR", dataset="msrvtt")
243
+
244
+ # 3. Generate candidates (fast generative recall)
245
+ query = "A person playing guitar"
246
+ candidates = grdr_model.generate_candidates(query, top_k=100)
247
+
248
+ # 4. Load Xpool reranker
249
+ reranker = XpoolReranker.from_pretrained("JasonCoderMaker/GRDR-TVR", dataset="msrvtt")
250
+
251
+ # 5. Rerank candidates (dense reranking)
252
+ final_results = reranker.rerank(query, candidates, top_k=10)
253
+ ```
254
+
255
+ ## πŸ› οΈ Requirements
256
+
257
+ ```bash
258
+ pip install torch torchvision
259
+ pip install transformers>=4.30.0
260
+ pip install huggingface_hub
261
+ pip install sentencepiece
262
+ ```
263
+
264
+ For the full GRDR codebase, see: [GitHub Repository](https://github.com/JasonCoderMaker/GRDR)
265
+
266
+ ## πŸ“œ Citation
267
+
268
+ If you use this dataset or models in your research, please cite:
269
+
270
+ ```bibtex
271
+ @inproceedings{grdr2026,
272
+ title={Generative Recall, Dense Reranking: Learning Multi-View Semantic IDs for Efficient Text-to-Video Retrieval},
273
+ author={Anonymous},
274
+ booktitle={Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval},
275
+ year={2026}
276
+ }
277
+ ```
278
+
279
+ ## πŸ“ License
280
+
281
+ This dataset is released under the MIT License. See [LICENSE](LICENSE) for details.
282
+
283
+ The video datasets (MSR-VTT, ActivityNet, DiDeMo, LSMDC) are subject to their original licenses. This repository only provides pre-extracted features, not the original videos.
284
+
285
+ ## πŸ™ Acknowledgments
286
+
287
+ - **InternVideo2**: We thank the authors of InternVideo2 for their excellent video encoder
288
+ - **Xpool**: The reranker architecture is based on X-POOL
289
+ - **Datasets**: MSR-VTT, ActivityNet Captions, DiDeMo, and LSMDC benchmark creators
290
+
291
+ ## πŸ“§ Contact
292
+
293
+ For questions or issues, please open an issue on the [GitHub repository](https://github.com/JasonCoderMaker/GRDR) or contact the authors.
294
+
295
+ ---
296
+
297
+ **Dataset Version**: 1.0
298
+ **Last Updated**: January 2026
299
+ **Maintained by**: [@JasonCoderMaker](https://huggingface.co/JasonCoderMaker)