Zero-Shot Classification
jjjjh commited on
Commit
349937a
·
verified ·
1 Parent(s): 915e287

init update

Browse files
Files changed (1) hide show
  1. README.md +64 -3
README.md CHANGED
@@ -1,3 +1,64 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Unmasked Token Alignment (UTA) for Efficient Visual-Language Representation Learning
2
+
3
+ This repository provides the inference code for our TMLR paper "Enhancing Vision-Language Model with Unmasked Token Alignment".
4
+
5
+ **Abstract:**
6
+
7
+ Contrastive pre-training on image-text pairs, exemplified by CLIP, becomes a standard technique for learning multi-modal visual-language representations. Although CLIP has demonstrated remarkable performance, training it from scratch on noisy web-scale datasets is computationally demanding. On the other hand, mask-then-predict pre-training approaches, like Masked Image Modeling (MIM), offer efficient self-supervised learning for single-modal representations. This paper introduces Unmasked Token Alignment (UTA), a method that leverages existing CLIP models to further enhance its vision-language representations. UTA trains a Vision Transformer (ViT) by aligning unmasked visual tokens to the corresponding image tokens from a frozen CLIP vision encoder, which automatically aligns the ViT model with the CLIP text encoder. The pre-trained ViT can be directly applied for zero-shot evaluation even without training on image-text pairs. Compared to MIM approaches, UTA does not suffer from training-finetuning inconsistency and is much more training-efficient by avoiding using the extra [MASK] tokens. Extensive experimental results demonstrate that UTA can enhance CLIP models and outperform existing MIM methods on various uni- and multi-modal benchmarks.
8
+
9
+ **Models:**
10
+
11
+ We release three pre-trained models:
12
+
13
+ | Model | Zero-shot Accuracy (ImageNet-1K) | Link |
14
+ |----|----|----|
15
+ | UTA-B | 77.0% | [weights](https://huggingface.co/jjjjh/UTA) |
16
+ | UTA-L-pix336 | 81.4% | [weights](https://huggingface.co/jjjjh/UTA) |
17
+ | UTA-g-pix336 | 83.9% | [weights](https://huggingface.co/jjjjh/UTA) |
18
+
19
+ **Getting Started:**
20
+
21
+ 1. **Clone this repository:**
22
+ ```bash
23
+ git clone https://github.com/jihaonew/UTA.git
24
+ cd UTA
25
+ ```
26
+
27
+ 2. **Install dependencies:**
28
+ ```bash
29
+ pip install -r requirements.txt
30
+ ```
31
+
32
+ 3. **Download the pre-trained models:**
33
+ You can download the pre-trained models from [weights](https://huggingface.co/jjjjh/UTA).
34
+
35
+ 4. **Run inference:**
36
+ The inference code is provided in `imagenet_zeroshot_eval.py`. You can use the following command to run ImageNet zeroshot eval:
37
+ ```bash
38
+ python imagenet_zeroshot_eval.py --imagenet-path [path to imagenet] --model [model name] --ckpt-path [path to checkpoint]
39
+ ```
40
+
41
+ **Citation:**
42
+
43
+ If you find this work helpful, please cite our paper:
44
+
45
+ ```
46
+ @article{
47
+ liu2024enhancing,
48
+ title={Enhancing Vision-Language Model with Unmasked Token Alignment},
49
+ author={Jihao Liu and Jinliang Zheng and Boxiao Liu and Yu Liu and Hongsheng Li},
50
+ journal={Transactions on Machine Learning Research},
51
+ issn={2835-8856},
52
+ year={2024},
53
+ url={https://openreview.net/forum?id=JkFEVbW6wE},
54
+ note={}
55
+ }
56
+ ```
57
+
58
+ **Contributing:**
59
+
60
+ Contributions to this repository are welcome. Please feel free to open an issue or submit a pull request.
61
+
62
+ **Contact:**
63
+
64
+ If you have any questions or suggestions, please feel free to contact [Jihao Liu](https://jihaonew.github.io/) ([email](mailto:jihaoliu@link.cuhk.edu.hk)).