File size: 10,045 Bytes
e857f97 | 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 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | We provide the **off-the-shelf** scripts in the [scripts folder](scripts).
## Training LanguageBind
<div align="center">
<table border="1" width="100%">
<tr align="center">
<th>Cache of pretrained weight</th><th>Baidu Yun</th><th>Google Cloud</th><th>Peking University Yun</th>
</tr>
<tr align="center">
<td>Large</td><td><a href="https://pan.baidu.com/s/1co46bkuUJXr8ePPKp1WWgA?pwd=ofm6">Link</a></td><td><a href="https://drive.google.com/drive/folders/1VQYZlqfKmCMuHffypf5F96odyMCEI87H?usp=drive_link">Link</a></td><td><a href="https://disk.pku.edu.cn:443/link/9CA764E6307790B01D2D4F7E314E8E43">Link</a></td>
</tr>
<tr align="center">
<td>Huge</td><td><a href="https://pan.baidu.com/s/1QLpyXEYunoXS-oqGsvzKKA?pwd=vgo2">Link</a></td><td>-</td><td><a href="https://disk.pku.edu.cn:443/link/720A77A7DB9EFD167C5AC8E3FC4B6068">Link</a></td>
</tr>
</table>
</div>
For example, to **train** LanguageBind on **Depth-Language** with 8 GPUs (1 nodes x 8 GPUs).
* First download the cache of pretrained weight above. and specify `CACHE_DIR=path/to/LanguageBind`.
* The second step is to develop a path to `ANNOTATION` and `DATA` [here](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/data/base_datasets.py#L37) according to the [dataset preparation](https://github.com/PKU-YuanGroup/LanguageBind#-vidal-10m).
* Then you can run
```bash
CACHE_DIR="/path/to/LanguageBind"
ANNOTATION="path/to/data"
cd /path/to/LanguageBind
TORCH_DISTRIBUTED_DEBUG=DETAIL HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 torchrun --nnodes=1 --nproc_per_node 8 \
-m main \
--train-data ${ANNOTATION} \
--train-num-samples 3020000 \
--clip-type "dl" --max-depth 10 \
--do_train \
--lock-text --lock-image --text-type "polish_mplug" \
--init-temp 0.07 --learn-temp \
--model "ViT-L-14" --cache-dir ${CACHE_DIR} \
--convert_to_lora --lora_r 2 \
--lr 5e-4 --coef-lr 1e-3 \
--beta1 0.9 --beta2 0.98 --wd 0.2 --eps 1e-6 \
--num-frames 1 --force-patch-dropout 0.5 \
--epochs 1 --batch-size 128 --accum-freq 1 --warmup 200 \
--precision "amp" --workers 10 --video-decode-backend "imgs" \
--save-frequency 1 --log-every-n-steps 20 --report-to "tensorboard" --resume "latest" \
--do_eval \
--val_d_cls_data "NYUV2"
```
## Validating LanguageBind
For example, to **validate** LanguageBind on **Depth-Language** with 1 GPUs.
* First specify ```RESUME```.
* The second step is to prepare the [downstream dataset](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/TRAIN_AND_VALIDATE.md#downstream-datasets).
* Then you can run
```bash
CACHE_DIR="/path/to/LanguageBind"
RESUME="thermal_language.pt"
ANNOTATION="path/to/data"
cd /path/to/LanguageBind
TORCH_DISTRIBUTED_DEBUG=DETAIL HF_DATASETS_OFFLINE=1 TRANSFORMERS_OFFLINE=1 torchrun --nproc_per_node 1 \
-m main \
--train-data ${ANNOTATION} \
--train-num-samples 3020000 \
--clip-type "dl" --max-depth 10 \
--lock-text --lock-image --text-type "polish_mplug" \
--init-temp 0.07 --learn-temp \
--model "ViT-L-14" --cache-dir ${CACHE_DIR} \
--convert_to_lora --lora_r 2 \
--lr 5e-4 --coef-lr 1e-3 \
--beta1 0.9 --beta2 0.98 --wd 0.2 --eps 1e-6 \
--num-frames 1 --force-patch-dropout 0.5 \
--epochs 1 --batch-size 128 --accum-freq 1 --warmup 200 \
--precision "amp" --workers 10 --video-decode-backend "imgs" \
--save-frequency 1 --log-every-n-steps 20 --report-to "tensorboard" --resume ${RESUME} \
--do_eval \
--val_d_cls_data "NYUV2"
```
## Downstream datasets
### Depth
NYU V2 dataset is downloaded from [this repo](https://github.com/TUI-NICR/nicr-scene-analysis-datasets/tree/main/nicr_scene_analysis_datasets/datasets/nyuv2) and we reformat them to conform to the standard ImageNet format. We also provide data as follows. Change the ```data_root``` [here](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/data/build_datasets.py#L221).
<div align="center">
<table border="1" width="100%">
<tr align="center">
<th>Datasets</th><th>Baidu Yun</th><th>Google Cloud</th><th>Peking University Yun</th>
</tr>
<tr align="center">
<td>NYU</td><td><a href="https://pan.baidu.com/s/1AGOG8U3F7W8AvJiEmuzs-A?pwd=1dsg">Link</a></td><td><a href="https://drive.google.com/file/d/1CltzrTBLFqLxJzpztSIN-5ZosZpXQQ6u/view?usp=sharing">Link</a></td><td><a href="https://disk.pku.edu.cn:443/link/7D7B164DEA64059793D3C3E3A65C0F64">Link</a></td>
</tr>
</table>
</div>
### Video
Video datasets are downloaded from [this repo](https://github.com/jpthu17/HBI) and we show the folder structure. Change the ```data_root``` [here](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/data/build_datasets.py#L74).
### Audio
Audio datasets are downloaded from [this repo](https://github.com/OFA-Sys/ONE-PEACE/blob/main/datasets.md#audio) and Audioset from [here](https://github.com/qiuqiangkong/audioset_tagging_cnn#1-download-dataset).We reformat them to conform to the standard ImageNet format. Change the ```data_root``` [here1](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/data/build_datasets.py#L144) and [here2](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/data/build_datasets.py#L159).
### Infrared (Thermal)
We download LLVIP from [official website](https://bupt-ai-cz.github.io/LLVIP/), and FLIR from [here](https://www.flir.com/oem/adas/adas-dataset-form/). We reformat them to conform to the standard ImageNet format. Change the ```data_root``` [here](https://github.com/PKU-YuanGroup/LanguageBind/blob/main/data/build_datasets.py#L233). We also provide the processed data as follows.
<div align="center">
<table border="1" width="100%">
<tr align="center">
<th>Datasets</th><th>Baidu Yun</th><th>Google Cloud</th><th>Peking University Yun</th>
</tr>
<tr align="center">
<td>LLVIP</td><td><a href="https://pan.baidu.com/s/15HPVr016F7eO9005NDRJTg?pwd=46fh">Link</a></td><td><a href="https://drive.google.com/file/d/1RfKNR8q6dHiAHB4OlYecnkUSx-ghLuEO/view?usp=drive_link">Link</a></td><td><a href="https://disk.pku.edu.cn:443/link/30D592EA37AC7C411264801A74994376">Link</a></td>
</tr>
<tr align="center">
<td>FLIR V1</td><td><a href="https://pan.baidu.com/s/1ZDSo5VPxJ4SA7wS_rNk0uQ?pwd=l491">Link</a></td><td><a href="https://drive.google.com/file/d/1CezCLJ4GUfPMFimitPfK40OV2j2Kr8t8/view?usp=drive_link">Link</a></td><td><a href="https://disk.pku.edu.cn:443/link/AD89D6ADE2CAC2407B00650870CBBDEC">Link</a></td>
</tr>
<tr align="center">
<td>FLIR V2</td><td><a href="https://pan.baidu.com/s/16xdr2aQkHo3zJ4KbaTmO3Q?pwd=tj9f">Link</a></td><td><a href="https://drive.google.com/file/d/1Z2ThG5QH-9biFI2-Z8k2fBKSA6Nrees6/view?usp=drive_link">Link</a></td><td><a href="https://disk.pku.edu.cn:443/link/E06C010970B0ED51926700D2F7A21EA8">Link</a></td>
</tr>
</table>
</div>
### Folder structure
```bash
downstream_datasets
βββ Audio
βΒ Β βββ audiocaps
βΒ Β β βββ audio
βΒ Β β βββ test
βΒ Β β βββ train
βΒ Β β βββ val
β βββ audioset
βΒ Β β βββ balanced_train_segments
βΒ Β β βββ eval_segments
βΒ Β β βββ unbalanced_train_segments
βΒ Β β βββ unbalanced_train_segments_part00
βΒ Β β βββ unbalanced_train_segments_part01
βΒ Β β βββ ...
βΒ Β β βββ unbalanced_train_segments_part40
β βββ clotho
βΒ Β β βββ CLOTHO_retrieval_dataset
βΒ Β β βββ evaluation
β βββ esc50
βΒ Β β βββ test
βΒ Β β βββ airplane
βΒ Β β βββ breathing
βΒ Β β βββ ...
βΒ Β β βββ wind
βββ laionaudio
βΒ Β β βββ audios
βΒ Β β βββ freesound_no_overlap
βΒ Β β βββ jsons
βββ vggsound
β βββ test
β βββ air\ conditioning\ noise
β βββ air\ horn
β βββ ...
β βββ zebra\ braying
βββ Depth
βΒ Β βββ nyuv2
βΒ Β βΒ Β βββ data
βΒ Β βΒ Β βΒ Β βββ val
βΒ Β βΒ Β βΒ Β βββ bathroom
βΒ Β βΒ Β βΒ Β βββ bedroom
βΒ Β βΒ Β βΒ Β βββ bookstore
βΒ Β βΒ Β βΒ Β βββ classroom
βΒ Β βΒ Β βΒ Β βββ dining_room
βΒ Β βΒ Β βΒ Β βββ home_office
βΒ Β βΒ Β βΒ Β βββ kitchen
βΒ Β βΒ Β βΒ Β βββ living_room
βΒ Β βΒ Β βΒ Β βββ office
βΒ Β βΒ Β βΒ Β βββ others
βββ Thermal
βΒ Β βββ flirv1
βΒ Β βΒ Β βββ val
βΒ Β βΒ Β βββ bicycle
βΒ Β βΒ Β βββ car
βΒ Β βΒ Β βββ dog
βΒ Β βΒ Β βββ person
βΒ Β βββ flirv2
βΒ Β βΒ Β βββ val
βΒ Β βΒ Β βββ bike
βΒ Β βΒ Β βββ bus
βΒ Β βΒ Β βββ car
βΒ Β βΒ Β βββ hydrant
βΒ Β βΒ Β βββ light
βΒ Β βΒ Β βββ motor
βΒ Β βΒ Β βββ other\ vehicle
βΒ Β βΒ Β βββ person
βΒ Β βΒ Β βββ sign
βΒ Β βΒ Β βββ skateboard
βΒ Β βΒ Β βββ stroller
βΒ Β βΒ Β βββ truck
βΒ Β βββ llvip
βΒ Β βΒ Β βββ train
βΒ Β βΒ Β βΒ Β βββ background
βΒ Β βΒ Β βΒ Β βββ person
βΒ Β βΒ Β βββ val
βΒ Β βΒ Β βββ background
βΒ Β βΒ Β βββ person
βββ VideoTextRetrieval
βββ vtRetdata
βΒ Β βββ ActivityNet
βΒ Β βΒ Β βββ Videos
βΒ Β βΒ Β βββ Activity_Videos
βΒ Β βββ Didemo
βΒ Β βΒ Β βββ videos
βΒ Β βββ MSRVTT
βΒ Β βΒ Β βββ MSRVTT_Videos
βΒ Β βββ MSVD
βΒ Β βββ MSVD_Videos
```
|