jianfeng0369 commited on
Commit
9f30907
·
verified ·
1 Parent(s): f5908dc

Add files using upload-large-folder tool

Browse files
LICENSE CHANGED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ VidLLVIP License Notice
2
+
3
+ VidLLVIP is an unofficial processed video dataset derived from the raw visible-infrared videos of LLVIP.
4
+
5
+ The use of VidLLVIP is subject to the original LLVIP Terms of Use and License:
6
+ https://github.com/bupt-ai-cz/LLVIP
7
+
8
+ Users must:
9
+ 1. Follow the original LLVIP Terms of Use and License.
10
+ 2. Use the data only for non-commercial research or educational purposes.
11
+ 3. Cite the original LLVIP paper.
12
+ 4. Cite the VidLLVIP dataset if they use the processed paired video clips, preprocessing pipeline, or registration matrices.
13
+
14
+ VidLLVIP does not grant any rights beyond those permitted by the original LLVIP Terms of Use and License.
README.md CHANGED
@@ -1,5 +1,284 @@
1
- ---
2
- license: other
3
- license_name: license
4
- license_link: LICENSE
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <img src="figs/vidllvip_title.svg" alt="VidLLVIP" width="560">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>Temporally and Spatially Aligned Infrared-Visible Video Dataset</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ English | <a href="README_zh-CN.md">简体中文</a>
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/jianfeng0369/VidLLVIP"><img alt="VidLLVIP GitHub" src="https://img.shields.io/badge/VidLLVIP-GitHub-181717?style=for-the-badge&logo=github&logoColor=ffffff"></a>
15
+ <a href="https://huggingface.co/datasets/jianfeng0369/VidLLVIP"><img alt="Hugging Face Dataset" src="https://img.shields.io/badge/VidLLVIP-Hugging%20Face-FFD21E?style=for-the-badge&logo=huggingface&logoColor=000000"></a>
16
+ <a href="https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv"><img alt="Quark Drive Download" src="https://img.shields.io/badge/Quark%20Drive-Download-14A7F5?style=for-the-badge&logo=icloud&logoColor=ffffff"></a>
17
+ <a href="https://arxiv.org/abs/2108.10831"><img alt="LLVIP Paper" src="https://img.shields.io/badge/LLVIP-Paper-B31B1B?style=for-the-badge&logo=arxiv&logoColor=ffffff"></a>
18
+ <a href="https://github.com/bupt-ai-cz/LLVIP"><img alt="LLVIP GitHub" src="https://img.shields.io/badge/LLVIP-GitHub-181717?style=for-the-badge&logo=github&logoColor=ffffff"></a>
19
+ <a href="https://doi.org/10.1016/j.inffus.2026.104212"><img alt="CMVF Paper" src="https://img.shields.io/badge/CMVF-Paper-FF6C00?style=for-the-badge&logo=elsevier&logoColor=ffffff"></a>
20
+ <a href="https://github.com/jianfeng0369/CMVF"><img alt="CMVF GitHub" src="https://img.shields.io/badge/CMVF-GitHub-181717?style=for-the-badge&logo=github&logoColor=ffffff"></a>
21
+ </p>
22
+
23
+ VidLLVIP is an unofficial processed paired infrared-visible video dataset derived from the raw [LLVIP](https://github.com/bupt-ai-cz/LLVIP) videos. The dataset provides temporally aligned, spatially registered, quality-checked, 5-second video pairs for video fusion, cross-modal registration, and multimodal video understanding.
24
+
25
+ ![VidLLVIP overview](figs/01_overview.jpg)
26
+
27
+ > VidLLVIP is derived from LLVIP. Please follow the original LLVIP license and citation requirements when using or redistributing this dataset.
28
+
29
+ ## 📰 News
30
+
31
+ - 🚀 **2026-05-06**: We released the [VidLLVIP dataset](https://github.com/jianfeng0369/VidLLVIP).
32
+ - 🎉 **2026-02-05**: Our multimodal video fusion paper [CMVF](https://doi.org/10.1016/j.inffus.2026.104212) was accepted by *Information Fusion*. The code is available in the [CMVF GitHub repository](https://github.com/jianfeng0369/CMVF).
33
+
34
+ ## Download
35
+
36
+ The large video files are distributed separately:
37
+
38
+ - Option 1: Download from [Hugging Face](https://huggingface.co/datasets/jianfeng0369/VidLLVIP)
39
+ - Option 2: Download from [Quark Drive](https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv)
40
+
41
+ After downloading, if you want to reproduce the full pipeline, extract `datamaker.zip` and `matrix.zip` and place them under the corresponding `datamaker/` directory; extract `raw.zip` and place it under the corresponding `raw/` directory. If you only want to use the final dataset directly, extract `dataset.zip` and place it under the corresponding `dataset/` directory.
42
+
43
+ ## Highlights
44
+
45
+ - Built from `14` source infrared-visible video pairs, numbered `01` to `14`.
46
+ - Provides `894` final 5-second paired clips with one IR video and one VI video per sample.
47
+ - Uses same-name files under `dataset/ir` and `dataset/vi` as the pairing rule.
48
+ - Final clip format: `1280 x 1024`, `25 FPS`, `125` frames, no audio.
49
+ - Includes scripts for temporal alignment, spatial registration, checkerboard quality inspection, and 5-second clip generation.
50
+
51
+ ## Dataset Snapshot
52
+
53
+ | Item | Value |
54
+ | --- | --- |
55
+ | Source | LLVIP raw infrared-visible videos |
56
+ | Processed source pairs | 14 pairs, IDs `01`-`14` |
57
+ | Final paired clips | 894 pairs |
58
+ | Modalities | Infrared (`ir`) and visible (`vi`) |
59
+ | Clip length | 5 seconds |
60
+ | Resolution | `1280 x 1024` |
61
+ | Frame rate | 25 FPS |
62
+ | Frames per clip | 125 |
63
+ | Pairing rule | Same file name under `dataset/ir` and `dataset/vi` |
64
+
65
+ ![Representative infrared-visible sample pairs](figs/02_sample_pairs.jpg)
66
+
67
+ ## Repository Layout
68
+
69
+ ```text
70
+ VidLLVIP/
71
+ README.md
72
+ README_zh-CN.md
73
+ raw/
74
+ videos/{ir,vi}/ # Original LLVIP videos before alignment
75
+ datamaker/
76
+ 01_time_align.py # Temporal alignment
77
+ 02_space_align.py # Spatial registration
78
+ 03_checkerboard.py # Checkerboard QA videos
79
+ 04_split_5s_videos.py # 5-second clip generation
80
+ requirements.txt
81
+ matrix/ # 3x3 perspective matrices for IDs 01-14
82
+ 01_align/ # Time-aligned full videos and timestamp sheets
83
+ 02_warp/ # Spatially registered full videos
84
+ 03_ckboard/ # Checkerboard QA videos
85
+ dataset/
86
+ ir/ # Final infrared clips
87
+ vi/ # Final visible clips
88
+ figs/ # README figures
89
+ ```
90
+
91
+ ![Dataset construction pipeline](figs/03_pipeline.jpg)
92
+
93
+ ## Data Format
94
+
95
+ Final clips are stored as paired files:
96
+
97
+ ```text
98
+ dataset/
99
+ ir/01_0000_0005.mp4
100
+ vi/01_0000_0005.mp4
101
+ ```
102
+
103
+ The file name format is:
104
+
105
+ ```text
106
+ {source_id}_{start_second}_{end_second}.mp4
107
+ ```
108
+
109
+ For example, `01_0000_0005.mp4` means source video `01`, from `0s` to `5s`. The same file name in `dataset/ir` and `dataset/vi` forms one paired sample.
110
+
111
+ ![Dataset structure and pairing rule](figs/04_dataset_structure.jpg)
112
+
113
+ ## Quick Start
114
+
115
+ If you only need the final paired clips, read `dataset/ir` and `dataset/vi` directly:
116
+
117
+ ```python
118
+ from pathlib import Path
119
+
120
+ root = Path("dataset")
121
+
122
+ for ir_path in sorted((root / "ir").glob("*.mp4")):
123
+ vi_path = root / "vi" / ir_path.name
124
+ assert vi_path.exists(), f"Missing visible pair: {vi_path}"
125
+ # Load ir_path and vi_path with your video reader.
126
+ ```
127
+
128
+ To reproduce the preprocessing pipeline, install the Python dependencies:
129
+
130
+ ```bash
131
+ cd datamaker
132
+ conda create -n vidllvip python=3.10 -y
133
+ conda activate vidllvip
134
+ pip install -r requirements.txt
135
+ ```
136
+
137
+ The system also needs `ffmpeg` and `ffprobe` on `PATH`.
138
+
139
+ ## Reproduce the Dataset
140
+
141
+ ### 1. Temporal Alignment
142
+
143
+ ```bash
144
+ python 01_time_align.py
145
+ ```
146
+
147
+ Inputs:
148
+
149
+ - `raw/videos/ir/{id}.mp4`
150
+ - `raw/videos/vi/{id}.mp4`
151
+
152
+ Outputs:
153
+
154
+ - `datamaker/01_align/{id}/ir.mp4`
155
+ - `datamaker/01_align/{id}/vi.mp4`
156
+ - `datamaker/01_align/{id}/timestamp.xlsx`
157
+
158
+ The script reads frame timestamps, chooses the shorter stream as the base, and matches the other modality with monotone nearest-frame matching. The default maximum timestamp gap is `0.08s`.
159
+
160
+ ### 2. Spatial Registration
161
+
162
+ ```bash
163
+ python 02_space_align.py
164
+ ```
165
+
166
+ Inputs:
167
+
168
+ - `datamaker/01_align/{id}/ir.mp4`
169
+ - `datamaker/01_align/{id}/vi.mp4`
170
+ - `datamaker/matrix/{id}.csv`
171
+
172
+ Outputs:
173
+
174
+ - `datamaker/02_warp/{id}/ir.mp4`
175
+ - `datamaker/02_warp/{id}/vi.mp4`
176
+
177
+ The script warps IR frames into the VI coordinate system with a 3x3 perspective matrix, then crops both modalities to `1280 x 1024`.
178
+
179
+ ![Temporal and spatial alignment quality](figs/05_alignment_quality.jpg)
180
+
181
+ ### 3. Checkerboard QA
182
+
183
+ ```bash
184
+ python 03_checkerboard.py
185
+ ```
186
+
187
+ Inputs:
188
+
189
+ - `datamaker/02_warp/{id}/ir.mp4`
190
+ - `datamaker/02_warp/{id}/vi.mp4`
191
+
192
+ Outputs:
193
+
194
+ - `datamaker/03_ckboard/{id}.mp4`
195
+
196
+ The checkerboard videos alternate IR and VI blocks, making edge continuity and object alignment easier to inspect by eye.
197
+
198
+ ### 4. Split Into 5-Second Clips
199
+
200
+ ```bash
201
+ python 04_split_5s_videos.py
202
+ ```
203
+
204
+ Inputs:
205
+
206
+ - `datamaker/02_warp/{id}/ir.mp4`
207
+ - `datamaker/02_warp/{id}/vi.mp4`
208
+
209
+ Outputs:
210
+
211
+ - `dataset/ir/{id}_{start}_{end}.mp4`
212
+ - `dataset/vi/{id}_{start}_{end}.mp4`
213
+
214
+ The default window and stride are both `5s`. Tails shorter than `5s` are skipped.
215
+
216
+ ## Suggested Uses
217
+
218
+ - Video fusion: use same-name clips from `dataset/ir` and `dataset/vi`.
219
+ - Cross-modal registration: use `datamaker/01_align` as temporally aligned but spatially unregistered input, and `datamaker/02_warp` as the registered reference.
220
+ - Joint fusion and registration: train registration on `datamaker/01_align`, then train or evaluate fusion on `datamaker/02_warp` or `dataset/`.
221
+
222
+ ## Figures
223
+
224
+ The `figs/` directory is ordered by first appearance in this README:
225
+
226
+ | File | Purpose |
227
+ | --- | --- |
228
+ | [`figs/01_overview.jpg`](figs/01_overview.jpg) | Dataset overview and key statistics. |
229
+ | [`figs/02_sample_pairs.jpg`](figs/02_sample_pairs.jpg) | Representative IR/VI/fusion frame examples. |
230
+ | [`figs/03_pipeline.jpg`](figs/03_pipeline.jpg) | End-to-end construction pipeline. |
231
+ | [`figs/04_dataset_structure.jpg`](figs/04_dataset_structure.jpg) | Released file structure and pairing rule. |
232
+ | [`figs/05_alignment_quality.jpg`](figs/05_alignment_quality.jpg) | Temporal and spatial alignment quality checks. |
233
+
234
+ ## Citation
235
+
236
+ VidLLVIP is an unofficial processed version derived from the raw LLVIP infrared and visible videos. If you use VidLLVIP or the processing scripts, registration matrices, or paired video clips in this repository, please also follow the original LLVIP license and citation requirements.
237
+
238
+ ### 1. Original Dataset Citation
239
+
240
+ VidLLVIP is derived from LLVIP. When using this dataset, please first cite the original LLVIP dataset:
241
+
242
+ ```bibtex
243
+ @inproceedings{jia2021llvip,
244
+ title = {LLVIP: A visible-infrared paired dataset for low-light vision},
245
+ author = {Jia, Xinyu and Zhu, Chuang and Li, Minzhen and Tang, Wenqi and Zhou, Wenli},
246
+ booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision},
247
+ pages = {3496--3504},
248
+ year = {2021}
249
+ }
250
+ ```
251
+
252
+ ### 2. VidLLVIP Citation
253
+
254
+ If you use the processed VidLLVIP dataset, registration matrices, or preprocessing pipeline provided by this project, please also cite VidLLVIP:
255
+
256
+ ```bibtex
257
+ @dataset{ding2026vidllvip,
258
+ author = {Ding, Jianfeng},
259
+ title = {VidLLVIP: A visible-infrared paired video dataset for low-light vision},
260
+ year = {2026},
261
+ version = {v1.0.0},
262
+ url = {https://github.com/jianfeng0369/VidLLVIP}
263
+ }
264
+ ```
265
+
266
+ ### 3. Related Paper Citation
267
+
268
+ CMVF is an infrared and visible video fusion method based on spatio-temporal consistency and designed for unregistered inputs. If your research uses the CMVF method or code, or is related to infrared and visible video fusion, please also consider citing the following paper:
269
+
270
+ ```bibtex
271
+ @article{cmvf2026ding,
272
+ title = {CMVF: Cross-modal unregistered video fusion via spatio-temporal consistency},
273
+ journal = {Information Fusion},
274
+ volume = {132},
275
+ pages = {104212},
276
+ year = {2026},
277
+ issn = {1566-2535},
278
+ author = {Jianfeng Ding and Hao Zhang and Zhongyuan Wang and Jinsheng Xiao and Xin Tian and Zhen Han and Jiayi Ma}
279
+ }
280
+ ```
281
+
282
+ ## Contact
283
+
284
+ If you have any questions, please contact: <jianfeng0369@gmail.com>.
README_zh-CN.md ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p align="center">
2
+ <img src="figs/vidllvip_title.svg" alt="VidLLVIP" width="560">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>时间与空间对齐的红外与可见光视频数据集</strong>
7
+ </p>
8
+
9
+ <p align="center">
10
+ <a href="README.md">English</a> | 简体中文
11
+ </p>
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/jianfeng0369/VidLLVIP"><img alt="VidLLVIP GitHub 仓库" src="https://img.shields.io/badge/VidLLVIP-GitHub-181717?style=for-the-badge&logo=github&logoColor=ffffff"></a>
15
+ <a href="https://huggingface.co/datasets/jianfeng0369/VidLLVIP"><img alt="Hugging Face Dataset" src="https://img.shields.io/badge/VidLLVIP-Hugging%20Face-FFD21E?style=for-the-badge&logo=huggingface&logoColor=000000"></a>
16
+ <a href="https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv"><img alt="夸克网盘下载" src="https://img.shields.io/badge/Quark%20Drive-Download-14A7F5?style=for-the-badge&logo=icloud&logoColor=ffffff"></a>
17
+ <a href="https://arxiv.org/abs/2108.10831"><img alt="LLVIP 论文" src="https://img.shields.io/badge/LLVIP-Paper-B31B1B?style=for-the-badge&logo=arxiv&logoColor=ffffff"></a>
18
+ <a href="https://github.com/bupt-ai-cz/LLVIP"><img alt="LLVIP GitHub 仓库" src="https://img.shields.io/badge/LLVIP-GitHub-181717?style=for-the-badge&logo=github&logoColor=ffffff"></a>
19
+ <a href="https://doi.org/10.1016/j.inffus.2026.104212"><img alt="CMVF 论文" src="https://img.shields.io/badge/CMVF-Paper-FF6C00?style=for-the-badge&logo=elsevier&logoColor=ffffff"></a>
20
+ <a href="https://github.com/jianfeng0369/CMVF"><img alt="CMVF GitHub 仓库" src="https://img.shields.io/badge/CMVF-GitHub-181717?style=for-the-badge&logo=github&logoColor=ffffff"></a>
21
+ </p>
22
+
23
+ VidLLVIP 是基于 [LLVIP](https://github.com/bupt-ai-cz/LLVIP) 原始红外/可见光视频整理得到的非官方处理版成对视频数据集。本项目完成了时间对齐、空间配准、质量检查和 5 秒切片,适用于视频融合、跨模态配准和多模态视频理解等任务。
24
+
25
+ ![VidLLVIP 数据集总览](figs/01_overview.jpg)
26
+
27
+ > VidLLVIP 来源于 LLVIP。使用或再分发本数据集时,请遵守 LLVIP 原始数据许可和引用要求。
28
+
29
+ ## 📰 新闻
30
+
31
+ - 🚀 **2026-05-06**:我们发布了 [VidLLVIP 数据集](https://github.com/jianfeng0369/VidLLVIP)。
32
+ - 🎉 **2026-02-05**:我们的多模态视频融合论文 [CMVF](https://doi.org/10.1016/j.inffus.2026.104212) 被 *Information Fusion* 接收,代码已发布在 [CMVF GitHub 仓库](https://github.com/jianfeng0369/CMVF)。
33
+
34
+ ## 数据下载
35
+
36
+ 大体量视频文件单独发布:
37
+
38
+ - 方式一:通过 [Hugging Face](https://huggingface.co/datasets/jianfeng0369/VidLLVIP) 下载
39
+ - 方式二:通过 [夸克网盘](https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv) 下载
40
+
41
+ 下载后,如果需要复现完整处理流程,请将 `datamaker.zip` 和 `matrix.zip` 文件解压后放入对应的 `datamaker/` 目录;将 `raw.zip` 文件解压后放入对应的 `raw/` 目录。如果想直接使用最终数据集,请将 `dataset.zip` 文件解压后放入对应的 `dataset/` 目录。
42
+
43
+ ## 主要特点
44
+
45
+ - 基于 `14` 组红外/可见光源视频对构建,编号为 `01` 到 `14`。
46
+ - 最终提供 `894` 组 5 秒配对片段,每个样本包含一个 IR 视频和一个 VI 视频。
47
+ - `dataset/ir` 与 `dataset/vi` 下同名文件构成一组配对样本。
48
+ - 最终片段规格为 `1280 x 1024`、`25 FPS`、`125` 帧、无音频。
49
+ - 提供时间对齐、空间配准、棋盘格质量检查和 5 秒切片的完整处理脚本。
50
+
51
+ ## 数据集概览
52
+
53
+ | 项目 | 数值 |
54
+ | --- | --- |
55
+ | 数据来源 | LLVIP 原始红外/可见光视频 |
56
+ | 已处理源视频对 | 14 组,编号 `01`-`14` |
57
+ | 最终配对片段 | 894 组 |
58
+ | 模态 | 红外(`ir`)和可见光(`vi`) |
59
+ | 片段长度 | 5 秒 |
60
+ | 分辨率 | `1280 x 1024` |
61
+ | 帧率 | 25 FPS |
62
+ | 每段帧数 | 125 |
63
+ | 配对规则 | `dataset/ir` 与 `dataset/vi` 下文件名相同 |
64
+
65
+ ![红外/可见光样例对](figs/02_sample_pairs.jpg)
66
+
67
+ ## 仓库结构
68
+
69
+ ```text
70
+ VidLLVIP/
71
+ README.md
72
+ README_zh-CN.md
73
+ raw/
74
+ videos/{ir,vi}/ # 对齐前的 LLVIP 原始视频
75
+ datamaker/
76
+ 01_time_align.py # 时间对齐
77
+ 02_space_align.py # 空间配准
78
+ 03_checkerboard.py # 棋盘格质量检查视频
79
+ 04_split_5s_videos.py # 5 秒片段切分
80
+ requirements.txt
81
+ matrix/ # 编号 01-14 的 3x3 透视变换矩阵
82
+ 01_align/ # 时间对齐后的完整视频和时间戳表
83
+ 02_warp/ # 空间配准后的完整视频
84
+ 03_ckboard/ # 棋盘格质量检查视频
85
+ dataset/
86
+ ir/ # 最终红外片段
87
+ vi/ # 最终可见光片段
88
+ figs/ # README 图片
89
+ ```
90
+
91
+ ![数据集构建流程](figs/03_pipeline.jpg)
92
+
93
+ ## 数据格式
94
+
95
+ 最终片段以成对文件形式存放:
96
+
97
+ ```text
98
+ dataset/
99
+ ir/01_0000_0005.mp4
100
+ vi/01_0000_0005.mp4
101
+ ```
102
+
103
+ 文件名格式为:
104
+
105
+ ```text
106
+ {source_id}_{start_second}_{end_second}.mp4
107
+ ```
108
+
109
+ 例如,`01_0000_0005.mp4` 表示源视频 `01` 中从 `0s` 到 `5s` 的片段。`dataset/ir` 和 `dataset/vi` 下文件名相同的两个视频构成一组配对样本。
110
+
111
+ ![数据集结构与配对规则](figs/04_dataset_structure.jpg)
112
+
113
+ ## 快速开始
114
+
115
+ 如果只需要使用最终配对片段,可直接读取 `dataset/ir` 和 `dataset/vi`:
116
+
117
+ ```python
118
+ from pathlib import Path
119
+
120
+ root = Path("dataset")
121
+
122
+ for ir_path in sorted((root / "ir").glob("*.mp4")):
123
+ vi_path = root / "vi" / ir_path.name
124
+ assert vi_path.exists(), f"Missing visible pair: {vi_path}"
125
+ # 使用你的视频读取工具加载 ir_path 和 vi_path。
126
+ ```
127
+
128
+ 如需复现预处理流程,先安装 Python 依赖:
129
+
130
+ ```bash
131
+ cd datamaker
132
+ conda create -n vidllvip python=3.10 -y
133
+ conda activate vidllvip
134
+ pip install -r requirements.txt
135
+ ```
136
+
137
+ 系统还需要在 `PATH` 中提供 `ffmpeg` 和 `ffprobe`。
138
+
139
+ ## 数据集复现流程
140
+
141
+ ### 1. 时间对齐
142
+
143
+ ```bash
144
+ python 01_time_align.py
145
+ ```
146
+
147
+ 输入:
148
+
149
+ - `raw/videos/ir/{id}.mp4`
150
+ - `raw/videos/vi/{id}.mp4`
151
+
152
+ 输出:
153
+
154
+ - `datamaker/01_align/{id}/ir.mp4`
155
+ - `datamaker/01_align/{id}/vi.mp4`
156
+ - `datamaker/01_align/{id}/timestamp.xlsx`
157
+
158
+ 脚本读取逐帧时间戳,选择较短的视频流作为基准,并用单调最近帧匹配方式对齐另一模态。默认最大时间差为 `0.08s`。
159
+
160
+ ### 2. 空间配准
161
+
162
+ ```bash
163
+ python 02_space_align.py
164
+ ```
165
+
166
+ 输入:
167
+
168
+ - `datamaker/01_align/{id}/ir.mp4`
169
+ - `datamaker/01_align/{id}/vi.mp4`
170
+ - `datamaker/matrix/{id}.csv`
171
+
172
+ 输出:
173
+
174
+ - `datamaker/02_warp/{id}/ir.mp4`
175
+ - `datamaker/02_warp/{id}/vi.mp4`
176
+
177
+ 脚本使用 3x3 透视变换矩阵将 IR 帧映射到 VI 坐标系,并将两个模态裁剪为 `1280 x 1024`。
178
+
179
+ ![时间与空间对齐质量](figs/05_alignment_quality.jpg)
180
+
181
+ ### 3. 棋盘格质量检查
182
+
183
+ ```bash
184
+ python 03_checkerboard.py
185
+ ```
186
+
187
+ 输入:
188
+
189
+ - `datamaker/02_warp/{id}/ir.mp4`
190
+ - `datamaker/02_warp/{id}/vi.mp4`
191
+
192
+ 输出:
193
+
194
+ - `datamaker/03_ckboard/{id}.mp4`
195
+
196
+ 棋盘格视频交替显示 IR 和 VI 图像块,便于人工检查边缘连续性和目标对齐效果。
197
+
198
+ ### 4. 切分为 5 秒片段
199
+
200
+ ```bash
201
+ python 04_split_5s_videos.py
202
+ ```
203
+
204
+ 输入:
205
+
206
+ - `datamaker/02_warp/{id}/ir.mp4`
207
+ - `datamaker/02_warp/{id}/vi.mp4`
208
+
209
+ 输出:
210
+
211
+ - `dataset/ir/{id}_{start}_{end}.mp4`
212
+ - `dataset/vi/{id}_{start}_{end}.mp4`
213
+
214
+ 默认窗口长度和步长均为 `5s`,不足 `5s` 的尾部片段会被跳过。
215
+
216
+ ## 推荐用途
217
+
218
+ - 视频融合:使用 `dataset/ir` 和 `dataset/vi` 下同名片段。
219
+ - 跨模态配准:使用 `datamaker/01_align` 作为时间对齐但空间未配准的输入,使用 `datamaker/02_warp` 作为配准参考。
220
+ - 融合与配准联合任务:先在 `datamaker/01_align` 上训练配准,再在 `datamaker/02_warp` 或 `dataset/` 上训练或评估融合方法。
221
+
222
+ ## 图片说明
223
+
224
+ `figs/` 目录中的文件已按本 README 中的首次出现顺序编号:
225
+
226
+ | 文件 | 说明 |
227
+ | --- | --- |
228
+ | [`figs/01_overview.jpg`](figs/01_overview.jpg) | 数据集总览和关键统计信息。 |
229
+ | [`figs/02_sample_pairs.jpg`](figs/02_sample_pairs.jpg) | 代表性 IR/VI/融合帧示例。 |
230
+ | [`figs/03_pipeline.jpg`](figs/03_pipeline.jpg) | 从原始视频到最终片段的完整构建流程。 |
231
+ | [`figs/04_dataset_structure.jpg`](figs/04_dataset_structure.jpg) | 发布文件结构和配对规则。 |
232
+ | [`figs/05_alignment_quality.jpg`](figs/05_alignment_quality.jpg) | 时间与空间对齐质量检查。 |
233
+
234
+ ## 引用
235
+
236
+ VidLLVIP 是基于 LLVIP 原始红外和可见光视频整理得到的非官方处理版本。如果您使用 VidLLVIP 或本仓库中的处理脚本、配准矩阵、配对视频片段,请同时遵守 LLVIP 原始数据许可和引用要求。
237
+
238
+ ### 1. 原始数据集引用
239
+
240
+ VidLLVIP 来源于 LLVIP。使用本数据集时,请首先引用原始 LLVIP 数据集:
241
+
242
+ ```bibtex
243
+ @inproceedings{jia2021llvip,
244
+ title = {LLVIP: A visible-infrared paired dataset for low-light vision},
245
+ author = {Jia, Xinyu and Zhu, Chuang and Li, Minzhen and Tang, Wenqi and Zhou, Wenli},
246
+ booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision},
247
+ pages = {3496--3504},
248
+ year = {2021}
249
+ }
250
+ ```
251
+
252
+ ### 2. VidLLVIP 引用
253
+
254
+ 如果您使用本项目整理得到的 VidLLVIP 处理版数据、配准矩阵或预处理流程,请同时引用 VidLLVIP:
255
+
256
+ ```bibtex
257
+ @dataset{ding2026vidllvip,
258
+ author = {Ding, Jianfeng},
259
+ title = {VidLLVIP: A visible-infrared paired video dataset for low-light vision},
260
+ year = {2026},
261
+ version = {v1.0.0},
262
+ url = {https://github.com/jianfeng0369/VidLLVIP}
263
+ }
264
+ ```
265
+
266
+ ### 3. 相关论文引用
267
+
268
+ CMVF 是一个基于时空一致性和面向未配准的红外与可见光视频融合方法。如果您的研究使用了 CMVF 方法或代码,或者和红外与可见光视频融合任务相关,请同时考虑引用以下论文:
269
+
270
+ ```bibtex
271
+ @article{cmvf2026ding,
272
+ title = {CMVF: Cross-modal unregistered video fusion via spatio-temporal consistency},
273
+ journal = {Information Fusion},
274
+ volume = {132},
275
+ pages = {104212},
276
+ year = {2026},
277
+ issn = {1566-2535},
278
+ author = {Jianfeng Ding and Hao Zhang and Zhongyuan Wang and Jinsheng Xiao and Xin Tian and Zhen Han and Jiayi Ma}
279
+ }
280
+ ```
281
+
282
+ ## 联系方式
283
+
284
+ 如有任何问题,请通过以下邮箱联系:<jianfeng0369@gmail.com>。
datamaker/01_time_align.py ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import subprocess
5
+ from pathlib import Path
6
+ from typing import Optional, Sequence
7
+
8
+ import cv2
9
+ import numpy as np
10
+ import pandas as pd
11
+ from tqdm import tqdm
12
+
13
+
14
+ # =========================
15
+ # Parameters
16
+ # =========================
17
+ DATAMAKER_DIR = Path(__file__).resolve().parent
18
+ PROJECT_ROOT = DATAMAKER_DIR.parent
19
+
20
+ RAW_IR_DIR = PROJECT_ROOT / "raw" / "videos" / "ir"
21
+ RAW_VI_DIR = PROJECT_ROOT / "raw" / "videos" / "vi"
22
+ OUTPUT_DIR = DATAMAKER_DIR / "01_align"
23
+
24
+ VIDEO_IDS = [f"{idx:02d}" for idx in range(1, 15)]
25
+ MAX_GAP_SECONDS = 0.08
26
+ SAVE_EXCEL = True
27
+ FOURCC = "mp4v"
28
+ OVERWRITE = True
29
+ # =========================
30
+
31
+
32
+ def get_frame_timestamps(video_path: Path) -> list[float]:
33
+ cmd = [
34
+ "ffprobe",
35
+ "-v",
36
+ "error",
37
+ "-select_streams",
38
+ "v:0",
39
+ "-show_entries",
40
+ "frame=pkt_pts_time,best_effort_timestamp_time",
41
+ "-of",
42
+ "csv=p=0",
43
+ str(video_path),
44
+ ]
45
+ try:
46
+ result = subprocess.run(
47
+ cmd,
48
+ stdout=subprocess.PIPE,
49
+ stderr=subprocess.PIPE,
50
+ text=True,
51
+ check=True,
52
+ )
53
+ except subprocess.CalledProcessError as exc:
54
+ raise RuntimeError(f"ffprobe failed for {video_path}: {exc.stderr}") from exc
55
+
56
+ timestamps: list[float] = []
57
+ for line in result.stdout.splitlines():
58
+ for value in line.split(","):
59
+ value = value.strip()
60
+ if not value or value == "N/A":
61
+ continue
62
+ try:
63
+ timestamps.append(float(value))
64
+ break
65
+ except ValueError:
66
+ continue
67
+ if not timestamps:
68
+ raise RuntimeError(f"No frame timestamps found in {video_path}")
69
+ return timestamps
70
+
71
+
72
+ def build_monotone_map(
73
+ base_ts: Sequence[float],
74
+ src_ts: Sequence[float],
75
+ max_gap: float,
76
+ ) -> list[int]:
77
+ if not base_ts or not src_ts:
78
+ raise ValueError("Timestamp lists must not be empty.")
79
+
80
+ mapping: list[int] = []
81
+ src_idx = 0
82
+ for timestamp in base_ts:
83
+ while (
84
+ src_idx + 1 < len(src_ts)
85
+ and abs(src_ts[src_idx + 1] - timestamp) < abs(src_ts[src_idx] - timestamp)
86
+ ):
87
+ src_idx += 1
88
+ mapping.append(src_idx if abs(src_ts[src_idx] - timestamp) <= max_gap else -1)
89
+ return mapping
90
+
91
+
92
+ def make_black_frame(cap: cv2.VideoCapture) -> np.ndarray:
93
+ height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
94
+ width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
95
+ return np.zeros((height, width, 3), dtype=np.uint8)
96
+
97
+
98
+ def make_writers(
99
+ cap_base: cv2.VideoCapture,
100
+ cap_src: cv2.VideoCapture,
101
+ out_base: Path,
102
+ out_src: Path,
103
+ ) -> tuple[cv2.VideoWriter, cv2.VideoWriter]:
104
+ fps = cap_base.get(cv2.CAP_PROP_FPS)
105
+ base_size = (
106
+ int(cap_base.get(cv2.CAP_PROP_FRAME_WIDTH)),
107
+ int(cap_base.get(cv2.CAP_PROP_FRAME_HEIGHT)),
108
+ )
109
+ src_size = (
110
+ int(cap_src.get(cv2.CAP_PROP_FRAME_WIDTH)),
111
+ int(cap_src.get(cv2.CAP_PROP_FRAME_HEIGHT)),
112
+ )
113
+ fourcc = cv2.VideoWriter_fourcc(*FOURCC)
114
+ out_base.parent.mkdir(parents=True, exist_ok=True)
115
+ out_src.parent.mkdir(parents=True, exist_ok=True)
116
+
117
+ writer_base = cv2.VideoWriter(str(out_base), fourcc, fps, base_size)
118
+ writer_src = cv2.VideoWriter(str(out_src), fourcc, fps, src_size)
119
+ if not writer_base.isOpened() or not writer_src.isOpened():
120
+ raise IOError(f"Failed to open output writers: {out_base}, {out_src}")
121
+ return writer_base, writer_src
122
+
123
+
124
+ def align_videos(
125
+ ir_path: Path,
126
+ vi_path: Path,
127
+ out_ir: Path,
128
+ out_vi: Path,
129
+ excel_path: Optional[Path],
130
+ ) -> None:
131
+ if not ir_path.exists() or not vi_path.exists():
132
+ raise FileNotFoundError(f"Missing input pair: {ir_path}, {vi_path}")
133
+ if not OVERWRITE and (out_ir.exists() or out_vi.exists()):
134
+ raise FileExistsError(f"Output exists and OVERWRITE=False: {out_ir}, {out_vi}")
135
+
136
+ ir_ts = get_frame_timestamps(ir_path)
137
+ vi_ts = get_frame_timestamps(vi_path)
138
+
139
+ if len(ir_ts) <= len(vi_ts):
140
+ base_ts, src_ts = ir_ts, vi_ts
141
+ base_path, src_path = ir_path, vi_path
142
+ out_base, out_src = out_ir, out_vi
143
+ base_label, src_label = "IR", "VI"
144
+ else:
145
+ base_ts, src_ts = vi_ts, ir_ts
146
+ base_path, src_path = vi_path, ir_path
147
+ out_base, out_src = out_vi, out_ir
148
+ base_label, src_label = "VI", "IR"
149
+
150
+ src_indices = build_monotone_map(base_ts, src_ts, MAX_GAP_SECONDS)
151
+
152
+ cap_base = cv2.VideoCapture(str(base_path))
153
+ cap_src = cv2.VideoCapture(str(src_path))
154
+ if not cap_base.isOpened() or not cap_src.isOpened():
155
+ raise IOError(f"Failed to open videos: {base_path}, {src_path}")
156
+
157
+ writer_base, writer_src = make_writers(cap_base, cap_src, out_base, out_src)
158
+
159
+ ok_src, frame_src = cap_src.read()
160
+ src_idx_prev = 0 if ok_src else -1
161
+ black_src = make_black_frame(cap_src)
162
+
163
+ for base_idx in tqdm(
164
+ range(len(base_ts)),
165
+ desc=f"Align {ir_path.stem}",
166
+ unit="frame",
167
+ position=1,
168
+ leave=False,
169
+ ):
170
+ ok_base, frame_base = cap_base.read()
171
+ if not ok_base:
172
+ break
173
+
174
+ mapped_idx = src_indices[base_idx]
175
+ if mapped_idx < 0:
176
+ frame_to_write = black_src
177
+ else:
178
+ while src_idx_prev < mapped_idx:
179
+ ok_src, frame_src = cap_src.read()
180
+ src_idx_prev += 1
181
+ frame_to_write = frame_src if ok_src and frame_src is not None else black_src
182
+
183
+ writer_base.write(frame_base)
184
+ writer_src.write(frame_to_write)
185
+
186
+ cap_base.release()
187
+ cap_src.release()
188
+ writer_base.release()
189
+ writer_src.release()
190
+
191
+ if SAVE_EXCEL and excel_path is not None:
192
+ excel_path.parent.mkdir(parents=True, exist_ok=True)
193
+ matched_src_ts = [src_ts[idx] if idx >= 0 else None for idx in src_indices]
194
+ diffs = [
195
+ base_time - src_time if src_time is not None else None
196
+ for base_time, src_time in zip(base_ts, matched_src_ts)
197
+ ]
198
+ pd.DataFrame(
199
+ {
200
+ "Base_Idx": range(len(base_ts)),
201
+ f"{base_label}_ts(s)": base_ts,
202
+ f"{src_label}_nearest_ts(s)": matched_src_ts,
203
+ "DeltaT(s)": diffs,
204
+ }
205
+ ).to_excel(excel_path, index=False)
206
+
207
+
208
+ def main() -> None:
209
+ with tqdm(
210
+ total=len(VIDEO_IDS),
211
+ desc="Total align",
212
+ unit="video",
213
+ position=0,
214
+ ) as progress:
215
+ for video_id in VIDEO_IDS:
216
+ progress.set_postfix(video=video_id)
217
+ out_dir = OUTPUT_DIR / video_id
218
+ align_videos(
219
+ ir_path=RAW_IR_DIR / f"{video_id}.mp4",
220
+ vi_path=RAW_VI_DIR / f"{video_id}.mp4",
221
+ out_ir=out_dir / "ir.mp4",
222
+ out_vi=out_dir / "vi.mp4",
223
+ excel_path=out_dir / "timestamp.xlsx" if SAVE_EXCEL else None,
224
+ )
225
+ tqdm.write(f"Aligned {video_id} -> {out_dir}")
226
+ progress.update(1)
227
+
228
+
229
+ if __name__ == "__main__":
230
+ main()
datamaker/02_space_align.py ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ from pathlib import Path
5
+
6
+ import cv2
7
+ import numpy as np
8
+ from tqdm import tqdm
9
+
10
+
11
+ # =========================
12
+ # Parameters
13
+ # =========================
14
+ DATAMAKER_DIR = Path(__file__).resolve().parent
15
+
16
+ INPUT_DIR = DATAMAKER_DIR / "01_align"
17
+ MATRIX_DIR = DATAMAKER_DIR / "matrix"
18
+ OUTPUT_DIR = DATAMAKER_DIR / "02_warp"
19
+
20
+ VIDEO_IDS = [f"{idx:02d}" for idx in range(1, 15)]
21
+ TARGET_WIDTH = 1280
22
+ TARGET_HEIGHT = 1024
23
+ OFFSET_WIDTH = -40
24
+ OFFSET_HEIGHT = 0
25
+ MATRIX_TRANSPOSE = True
26
+ INTERPOLATION = cv2.INTER_CUBIC
27
+ FOURCC = "mp4v"
28
+ OVERWRITE = True
29
+ # =========================
30
+
31
+
32
+ def load_matrix(matrix_path: Path) -> np.ndarray:
33
+ if not matrix_path.exists():
34
+ raise FileNotFoundError(f"Matrix not found: {matrix_path}")
35
+
36
+ matrix = np.genfromtxt(matrix_path, delimiter=",")
37
+ if matrix.shape != (3, 3):
38
+ raise ValueError(f"Matrix must be 3x3: {matrix_path}")
39
+ return matrix.T if MATRIX_TRANSPOSE else matrix
40
+
41
+
42
+ def get_crop_region(frame_shape: tuple[int, ...]) -> tuple[int, int]:
43
+ height, width = frame_shape[:2]
44
+ height_start = int((height - TARGET_HEIGHT) / 2) + OFFSET_HEIGHT
45
+ width_start = int((width - TARGET_WIDTH) / 2) + OFFSET_WIDTH
46
+
47
+ if (
48
+ height_start < 0
49
+ or width_start < 0
50
+ or height_start + TARGET_HEIGHT > height
51
+ or width_start + TARGET_WIDTH > width
52
+ ):
53
+ raise ValueError(
54
+ "Crop region is out of bounds. "
55
+ f"frame=({width}x{height}), crop=({TARGET_WIDTH}x{TARGET_HEIGHT}), "
56
+ f"start=({width_start},{height_start})"
57
+ )
58
+ return height_start, width_start
59
+
60
+
61
+ def warp_pair(
62
+ ir_path: Path,
63
+ vi_path: Path,
64
+ matrix_path: Path,
65
+ out_ir_path: Path,
66
+ out_vi_path: Path,
67
+ ) -> None:
68
+ if not ir_path.exists() or not vi_path.exists():
69
+ raise FileNotFoundError(f"Missing input pair: {ir_path}, {vi_path}")
70
+ if not OVERWRITE and (out_ir_path.exists() or out_vi_path.exists()):
71
+ raise FileExistsError(
72
+ f"Output exists and OVERWRITE=False: {out_ir_path}, {out_vi_path}"
73
+ )
74
+
75
+ matrix = load_matrix(matrix_path)
76
+ cap_ir = cv2.VideoCapture(str(ir_path))
77
+ cap_vi = cv2.VideoCapture(str(vi_path))
78
+ if not cap_ir.isOpened() or not cap_vi.isOpened():
79
+ raise IOError(f"Failed to open videos: {ir_path}, {vi_path}")
80
+
81
+ ok_first_vi, first_vi = cap_vi.read()
82
+ if not ok_first_vi:
83
+ raise IOError(f"Failed to read first VI frame: {vi_path}")
84
+ vi_height, vi_width = first_vi.shape[:2]
85
+ height_start, width_start = get_crop_region(first_vi.shape)
86
+
87
+ out_ir_path.parent.mkdir(parents=True, exist_ok=True)
88
+ out_vi_path.parent.mkdir(parents=True, exist_ok=True)
89
+
90
+ fps = cap_vi.get(cv2.CAP_PROP_FPS)
91
+ fourcc = cv2.VideoWriter_fourcc(*FOURCC)
92
+ out_ir = cv2.VideoWriter(
93
+ str(out_ir_path), fourcc, fps, (TARGET_WIDTH, TARGET_HEIGHT), False
94
+ )
95
+ out_vi = cv2.VideoWriter(
96
+ str(out_vi_path), fourcc, fps, (TARGET_WIDTH, TARGET_HEIGHT), True
97
+ )
98
+ if not out_ir.isOpened() or not out_vi.isOpened():
99
+ raise IOError(f"Failed to open output writers: {out_ir_path}, {out_vi_path}")
100
+
101
+ total_frames = min(
102
+ int(cap_ir.get(cv2.CAP_PROP_FRAME_COUNT)),
103
+ int(cap_vi.get(cv2.CAP_PROP_FRAME_COUNT)),
104
+ )
105
+ cap_vi.set(cv2.CAP_PROP_POS_FRAMES, 0)
106
+
107
+ for _ in tqdm(
108
+ range(total_frames),
109
+ desc=f"Warp {ir_path.parent.name}",
110
+ unit="frame",
111
+ position=1,
112
+ leave=False,
113
+ ):
114
+ ok_ir, frame_ir = cap_ir.read()
115
+ ok_vi, frame_vi = cap_vi.read()
116
+ if not ok_ir or not ok_vi:
117
+ break
118
+
119
+ if len(frame_ir.shape) == 3:
120
+ frame_ir = cv2.cvtColor(frame_ir, cv2.COLOR_BGR2GRAY)
121
+
122
+ ir_warp = cv2.warpPerspective(
123
+ frame_ir,
124
+ matrix,
125
+ (vi_width, vi_height),
126
+ flags=INTERPOLATION,
127
+ )
128
+ ir_output = ir_warp[
129
+ height_start : height_start + TARGET_HEIGHT,
130
+ width_start : width_start + TARGET_WIDTH,
131
+ ]
132
+ vi_output = frame_vi[
133
+ height_start : height_start + TARGET_HEIGHT,
134
+ width_start : width_start + TARGET_WIDTH,
135
+ ]
136
+
137
+ out_ir.write(ir_output)
138
+ out_vi.write(vi_output)
139
+
140
+ cap_ir.release()
141
+ cap_vi.release()
142
+ out_ir.release()
143
+ out_vi.release()
144
+
145
+
146
+ def main() -> None:
147
+ with tqdm(
148
+ total=len(VIDEO_IDS),
149
+ desc="Total warp",
150
+ unit="video",
151
+ position=0,
152
+ ) as progress:
153
+ for video_id in VIDEO_IDS:
154
+ progress.set_postfix(video=video_id)
155
+ out_dir = OUTPUT_DIR / video_id
156
+ warp_pair(
157
+ ir_path=INPUT_DIR / video_id / "ir.mp4",
158
+ vi_path=INPUT_DIR / video_id / "vi.mp4",
159
+ matrix_path=MATRIX_DIR / f"{video_id}.csv",
160
+ out_ir_path=out_dir / "ir.mp4",
161
+ out_vi_path=out_dir / "vi.mp4",
162
+ )
163
+ tqdm.write(f"Warped {video_id} -> {out_dir}")
164
+ progress.update(1)
165
+
166
+
167
+ if __name__ == "__main__":
168
+ main()
datamaker/03_checkerboard.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ from pathlib import Path
5
+
6
+ import cv2
7
+ import numpy as np
8
+ from tqdm import tqdm
9
+
10
+
11
+ # =========================
12
+ # Parameters
13
+ # =========================
14
+ DATAMAKER_DIR = Path(__file__).resolve().parent
15
+
16
+ INPUT_DIR = DATAMAKER_DIR / "02_warp"
17
+ OUTPUT_DIR = DATAMAKER_DIR / "03_ckboard"
18
+
19
+ VIDEO_IDS = [f"{idx:02d}" for idx in range(1, 15)]
20
+ BLOCK_SIZE = 50
21
+ FOURCC = "mp4v"
22
+ OVERWRITE = True
23
+ # =========================
24
+
25
+
26
+ def create_checkerboard_mask(height: int, width: int, block_size: int) -> np.ndarray:
27
+ x = np.arange(width)
28
+ y = np.arange(height)
29
+ x_grid, y_grid = np.meshgrid(x, y)
30
+ mask = np.mod(x_grid // block_size + y_grid // block_size, 2)
31
+ return mask.astype(bool)
32
+
33
+
34
+ def fuse_checkerboard(
35
+ ir_frame: np.ndarray,
36
+ vi_frame: np.ndarray,
37
+ block_size: int,
38
+ ) -> np.ndarray:
39
+ if len(ir_frame.shape) == 2:
40
+ ir_frame = cv2.cvtColor(ir_frame, cv2.COLOR_GRAY2BGR)
41
+ if ir_frame.shape[:2] != vi_frame.shape[:2]:
42
+ raise ValueError(
43
+ f"Frame sizes differ: IR={ir_frame.shape[:2]}, VI={vi_frame.shape[:2]}"
44
+ )
45
+
46
+ height, width = ir_frame.shape[:2]
47
+ mask = create_checkerboard_mask(height, width, block_size)
48
+ mask_3d = np.stack([mask] * 3, axis=2)
49
+ return np.where(mask_3d, ir_frame, vi_frame)
50
+
51
+
52
+ def make_checkerboard(ir_path: Path, vi_path: Path, out_path: Path) -> None:
53
+ if not ir_path.exists() or not vi_path.exists():
54
+ raise FileNotFoundError(f"Missing input pair: {ir_path}, {vi_path}")
55
+ if not OVERWRITE and out_path.exists():
56
+ raise FileExistsError(f"Output exists and OVERWRITE=False: {out_path}")
57
+
58
+ cap_ir = cv2.VideoCapture(str(ir_path))
59
+ cap_vi = cv2.VideoCapture(str(vi_path))
60
+ if not cap_ir.isOpened() or not cap_vi.isOpened():
61
+ raise IOError(f"Failed to open videos: {ir_path}, {vi_path}")
62
+
63
+ width = int(cap_ir.get(cv2.CAP_PROP_FRAME_WIDTH))
64
+ height = int(cap_ir.get(cv2.CAP_PROP_FRAME_HEIGHT))
65
+ fps = cap_ir.get(cv2.CAP_PROP_FPS)
66
+ total_frames = min(
67
+ int(cap_ir.get(cv2.CAP_PROP_FRAME_COUNT)),
68
+ int(cap_vi.get(cv2.CAP_PROP_FRAME_COUNT)),
69
+ )
70
+
71
+ out_path.parent.mkdir(parents=True, exist_ok=True)
72
+ writer = cv2.VideoWriter(
73
+ str(out_path),
74
+ cv2.VideoWriter_fourcc(*FOURCC),
75
+ fps,
76
+ (width, height),
77
+ )
78
+ if not writer.isOpened():
79
+ raise IOError(f"Failed to open output writer: {out_path}")
80
+
81
+ for _ in tqdm(
82
+ range(total_frames),
83
+ desc=f"Checkerboard {ir_path.parent.name}",
84
+ unit="frame",
85
+ position=1,
86
+ leave=False,
87
+ ):
88
+ ok_ir, frame_ir = cap_ir.read()
89
+ ok_vi, frame_vi = cap_vi.read()
90
+ if not ok_ir or not ok_vi:
91
+ break
92
+ writer.write(fuse_checkerboard(frame_ir, frame_vi, BLOCK_SIZE))
93
+
94
+ cap_ir.release()
95
+ cap_vi.release()
96
+ writer.release()
97
+
98
+
99
+ def main() -> None:
100
+ with tqdm(
101
+ total=len(VIDEO_IDS),
102
+ desc="Total checkerboard",
103
+ unit="video",
104
+ position=0,
105
+ ) as progress:
106
+ for video_id in VIDEO_IDS:
107
+ progress.set_postfix(video=video_id)
108
+ out_path = OUTPUT_DIR / f"{video_id}.mp4"
109
+ make_checkerboard(
110
+ ir_path=INPUT_DIR / video_id / "ir.mp4",
111
+ vi_path=INPUT_DIR / video_id / "vi.mp4",
112
+ out_path=out_path,
113
+ )
114
+ tqdm.write(f"Checkerboard {video_id} -> {out_path}")
115
+ progress.update(1)
116
+
117
+
118
+ if __name__ == "__main__":
119
+ main()
datamaker/04_split_5s_videos.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ # -*- coding: utf-8 -*-
3
+
4
+ import json
5
+ import math
6
+ import subprocess
7
+ from pathlib import Path
8
+
9
+ from tqdm import tqdm
10
+
11
+
12
+ # =========================
13
+ # Parameters
14
+ # =========================
15
+ DATAMAKER_DIR = Path(__file__).resolve().parent
16
+ PROJECT_ROOT = DATAMAKER_DIR.parent
17
+
18
+ INPUT_DIR = DATAMAKER_DIR / "02_warp"
19
+ OUTPUT_DIR = PROJECT_ROOT / "dataset"
20
+
21
+ VIDEO_IDS = [f"{idx:02d}" for idx in range(1, 15)]
22
+ WINDOW_LEN_SECONDS = 5
23
+ STRIDE_SECONDS = 5
24
+ KEEP_AUDIO = False
25
+ TOLERANCE_SECONDS = 0.02
26
+ OVERWRITE = True
27
+ # =========================
28
+
29
+
30
+ def probe(video_path: Path) -> tuple[float, int]:
31
+ cmd = [
32
+ "ffprobe",
33
+ "-v",
34
+ "error",
35
+ "-count_frames",
36
+ "-select_streams",
37
+ "v:0",
38
+ "-show_entries",
39
+ "stream=nb_read_frames,nb_frames,duration:format=duration",
40
+ "-print_format",
41
+ "json",
42
+ str(video_path),
43
+ ]
44
+ raw = subprocess.check_output(cmd, stderr=subprocess.DEVNULL, text=True)
45
+ info = json.loads(raw)
46
+ stream = info["streams"][0]
47
+ duration = float(stream.get("duration") or info.get("format", {}).get("duration"))
48
+ frames_raw = stream.get("nb_read_frames") or stream.get("nb_frames")
49
+ if frames_raw is None:
50
+ raise RuntimeError(f"Could not read frame count: {video_path}")
51
+ return duration, int(frames_raw)
52
+
53
+
54
+ def segment_count(duration: float) -> int:
55
+ if duration < WINDOW_LEN_SECONDS:
56
+ return 0
57
+ return math.floor((duration - WINDOW_LEN_SECONDS) / STRIDE_SECONDS) + 1
58
+
59
+
60
+ def pad_seconds(seconds: int) -> str:
61
+ return f"{seconds:04d}"
62
+
63
+
64
+ def clip_video(src: Path, dst: Path, start: int, duration: int) -> None:
65
+ dst.parent.mkdir(parents=True, exist_ok=True)
66
+ cmd = ["ffmpeg", "-hide_banner", "-loglevel", "error", "-nostats"]
67
+ cmd.append("-y" if OVERWRITE else "-n")
68
+ cmd += [
69
+ "-ss",
70
+ str(start),
71
+ "-i",
72
+ str(src),
73
+ "-t",
74
+ str(duration),
75
+ "-c:v",
76
+ "copy",
77
+ ]
78
+ cmd += ["-c:a", "copy"] if KEEP_AUDIO else ["-an"]
79
+ cmd.append(str(dst))
80
+ subprocess.run(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, check=True)
81
+
82
+
83
+ def collect_valid_pairs() -> list[tuple[str, Path, Path, float]]:
84
+ valid_pairs: list[tuple[str, Path, Path, float]] = []
85
+ for video_id in tqdm(VIDEO_IDS, desc="Probe videos", unit="video"):
86
+ ir_path = INPUT_DIR / video_id / "ir.mp4"
87
+ vi_path = INPUT_DIR / video_id / "vi.mp4"
88
+ if not ir_path.exists() or not vi_path.exists():
89
+ raise FileNotFoundError(f"Missing input pair: {ir_path}, {vi_path}")
90
+
91
+ ir_duration, ir_frames = probe(ir_path)
92
+ vi_duration, vi_frames = probe(vi_path)
93
+ if abs(ir_duration - vi_duration) >= TOLERANCE_SECONDS:
94
+ raise ValueError(
95
+ f"{video_id}: duration mismatch "
96
+ f"ir={ir_duration:.3f}s vi={vi_duration:.3f}s"
97
+ )
98
+ if ir_frames != vi_frames:
99
+ raise ValueError(
100
+ f"{video_id}: frame mismatch ir={ir_frames} vi={vi_frames}"
101
+ )
102
+
103
+ valid_pairs.append((video_id, ir_path, vi_path, ir_duration))
104
+ return valid_pairs
105
+
106
+
107
+ def main() -> None:
108
+ valid_pairs = collect_valid_pairs()
109
+ total_clips = sum(2 * segment_count(duration) for _, _, _, duration in valid_pairs)
110
+ if total_clips == 0:
111
+ tqdm.write("No valid 5-second clips found.")
112
+ return
113
+
114
+ (OUTPUT_DIR / "ir").mkdir(parents=True, exist_ok=True)
115
+ (OUTPUT_DIR / "vi").mkdir(parents=True, exist_ok=True)
116
+
117
+ with tqdm(
118
+ total=len(valid_pairs),
119
+ desc="Total split",
120
+ unit="video",
121
+ position=0,
122
+ ) as video_progress, tqdm(
123
+ total=total_clips,
124
+ desc="Split clips",
125
+ unit="clip",
126
+ position=1,
127
+ leave=False,
128
+ ) as clip_progress:
129
+ for video_id, ir_path, vi_path, duration in valid_pairs:
130
+ video_progress.set_postfix(video=video_id)
131
+ start = 0
132
+ while start + WINDOW_LEN_SECONDS <= duration:
133
+ end = start + WINDOW_LEN_SECONDS
134
+ name = f"{video_id}_{pad_seconds(start)}_{pad_seconds(end)}.mp4"
135
+ clip_video(ir_path, OUTPUT_DIR / "ir" / name, start, WINDOW_LEN_SECONDS)
136
+ clip_progress.update(1)
137
+ clip_video(vi_path, OUTPUT_DIR / "vi" / name, start, WINDOW_LEN_SECONDS)
138
+ clip_progress.update(1)
139
+ start += STRIDE_SECONDS
140
+
141
+ if start < duration:
142
+ skipped = duration - start
143
+ tqdm.write(
144
+ f"{video_id}: skipped tail {skipped:.2f}s "
145
+ f"(< {WINDOW_LEN_SECONDS}s)"
146
+ )
147
+ video_progress.update(1)
148
+
149
+ tqdm.write(f"Dataset clips written to {OUTPUT_DIR}")
150
+
151
+
152
+ if __name__ == "__main__":
153
+ main()
datamaker/README.md ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # datamaker
2
+
3
+ This directory stores the VidLLVIP preprocessing scripts, registration matrices, and intermediate processing results. The repository only keeps the scripts by default; large video files and matrix files should be downloaded separately.
4
+
5
+ ## Download
6
+
7
+ - Option 1: Download from [Hugging Face](https://huggingface.co/datasets/jianfeng0369/VidLLVIP)
8
+ - Option 2: Download from [Quark Drive](https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv)
9
+
10
+ After downloading, extract `datamaker.zip` and `matrix.zip` into this directory so that it matches the structure below.
11
+
12
+ ## Expected File Structure
13
+
14
+ ```text
15
+ datamaker/
16
+ README.md
17
+ requirements.txt
18
+ 01_time_align.py
19
+ 02_space_align.py
20
+ 03_checkerboard.py
21
+ 04_split_5s_videos.py
22
+ matrix/
23
+ 01.csv
24
+ 02.csv
25
+ ...
26
+ 14.csv
27
+ 01_align/
28
+ 01/
29
+ ir.mp4
30
+ vi.mp4
31
+ timestamp.xlsx
32
+ ...
33
+ 14/
34
+ ir.mp4
35
+ vi.mp4
36
+ timestamp.xlsx
37
+ 02_warp/
38
+ 01/
39
+ ir.mp4
40
+ vi.mp4
41
+ ...
42
+ 14/
43
+ ir.mp4
44
+ vi.mp4
45
+ 03_ckboard/
46
+ 01.mp4
47
+ 02.mp4
48
+ ...
49
+ 14.mp4
50
+ ```
51
+
52
+ `matrix/` stores the 3x3 perspective transformation matrices for IDs `01` to `14`; `01_align/` stores the temporally aligned full videos; `02_warp/` stores the spatially registered full videos; and `03_ckboard/` stores checkerboard videos for quality inspection.
datamaker/datamaker.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:894ba17eb56b84d97104b717e5b19f2cb2aa408edd1fab407f783df3dafe679a
3
+ size 18571821199
datamaker/matrix.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ff4df8326c19dda203352d5b71bd95607a5d355bdb559589071934a149e0cb1d
3
+ size 4079
datamaker/requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Recommended Python: 3.10.x
2
+ # External tools required on PATH: ffmpeg, ffprobe
3
+
4
+ numpy>=1.26,<2.0
5
+ opencv-python>=4.9,<5.0
6
+ pandas>=2.2,<3.0
7
+ openpyxl>=3.1,<4.0
8
+ tqdm>=4.66,<5.0
dataset/README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # dataset
2
+
3
+ This directory stores the final released VidLLVIP paired infrared-visible video clips. The repository does not include large video files by default, so please download them separately.
4
+
5
+ ## Download
6
+
7
+ - Option 1: Download from [Hugging Face](https://huggingface.co/datasets/jianfeng0369/VidLLVIP)
8
+ - Option 2: Download from [Quark Drive](https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv)
9
+
10
+ After downloading, extract `dataset.zip` into this directory so that it matches the structure below.
11
+
12
+ ## Expected File Structure
13
+
14
+ ```text
15
+ dataset/
16
+ README.md
17
+ ir/
18
+ 01_0000_0005.mp4
19
+ 01_0005_0010.mp4
20
+ ...
21
+ vi/
22
+ 01_0000_0005.mp4
23
+ 01_0005_0010.mp4
24
+ ...
25
+ ```
26
+
27
+ Videos with the same file name under `ir/` and `vi/` form one paired sample. For example, `ir/01_0000_0005.mp4` and `vi/01_0000_0005.mp4` are the infrared and visible videos from the same time interval.
28
+
29
+ The file name format is:
30
+
31
+ ```text
32
+ {source_id}_{start_second}_{end_second}.mp4
33
+ ```
34
+
35
+ The final dataset contains `894` paired 5-second clips. Each clip is `1280 x 1024`, `25 FPS`, `125` frames, and has no audio.
dataset/dataset.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a01effbdd54dd1d368401ffe2408edccf3fef335993fe95ffe66e7ebe1ab480
3
+ size 6631687357
figs/01_overview.jpg ADDED

Git LFS Details

  • SHA256: d5f21b9209cc08f6dc5a44d43594d1c821d2933be04d90fa0c0acb63ea36558b
  • Pointer size: 132 Bytes
  • Size of remote file: 2.17 MB
figs/02_sample_pairs.jpg ADDED

Git LFS Details

  • SHA256: 00f88fbfe4b32efd30b91a9c0d50e3ac2d0088ece6923ae961132ed27f233482
  • Pointer size: 132 Bytes
  • Size of remote file: 6.17 MB
figs/03_pipeline.jpg ADDED

Git LFS Details

  • SHA256: c527ce55a1e3dee927d957d369294fb983f919c77f0093a8953817489914daa3
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB
figs/04_dataset_structure.jpg ADDED

Git LFS Details

  • SHA256: deb2a2786643cba26529d64e0ba2e76951df69063b373d38336839d3358e69cf
  • Pointer size: 132 Bytes
  • Size of remote file: 1.38 MB
figs/05_alignment_quality.jpg ADDED

Git LFS Details

  • SHA256: 98befc37ddbc36863c4c422194d0a2deebee64d7720b5ad37b641e8abb39ba25
  • Pointer size: 132 Bytes
  • Size of remote file: 5.8 MB
figs/vidllvip_title.svg ADDED
raw/README.md ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # raw
2
+
3
+ This directory stores the original LLVIP infrared-visible videos before preprocessing. The repository does not include large raw video files by default, so please download them separately.
4
+
5
+ ## Download
6
+
7
+ - Option 1: Download from [Hugging Face](https://huggingface.co/datasets/jianfeng0369/VidLLVIP)
8
+ - Option 2: Download from [Quark Drive](https://pan.quark.cn/s/e3abe425aa5f?pwd=E5gv)
9
+
10
+ After downloading, extract `raw.zip` into this directory so that it matches the structure below.
11
+
12
+ ## Expected File Structure
13
+
14
+ ```text
15
+ raw/
16
+ README.md
17
+ videos/
18
+ ir/
19
+ 01.mp4
20
+ 02.mp4
21
+ ...
22
+ 14.mp4
23
+ vi/
24
+ 01.mp4
25
+ 02.mp4
26
+ ...
27
+ 14.mp4
28
+ ```
29
+
30
+ Videos with the same ID under `videos/ir/` and `videos/vi/` form one original infrared-visible source pair.
raw/raw.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:468cc00b9b462fbdd0e8ad9a66dc119a331309d92fec1d2f6a30be96378d34cc
3
+ size 3724002696