Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: en
|
3 |
+
license: mit
|
4 |
+
tags:
|
5 |
+
- vision
|
6 |
+
model_name: microsoft/git-large-textcaps
|
7 |
+
pipeline_tag: image-to-text
|
8 |
+
---
|
9 |
+
|
10 |
+
# GIT (GenerativeImage2Text), large-sized, fine-tuned on TextCaps, R*
|
11 |
+
|
12 |
+
R = re-trained by removing some offensive captions in cc12m dataset
|
13 |
+
|
14 |
+
GIT (short for GenerativeImage2Text) model, large-sized version, fine-tuned on TextCaps. It was introduced in the paper [GIT: A Generative Image-to-text Transformer for Vision and Language](https://arxiv.org/abs/2205.14100) by Wang et al. and first released in [this repository](https://github.com/microsoft/GenerativeImage2Text).
|
15 |
+
|
16 |
+
Disclaimer: The team releasing GIT did not write a model card for this model so this model card has been written by the Hugging Face team.
|
17 |
+
|
18 |
+
## Model description
|
19 |
+
|
20 |
+
GIT is a Transformer decoder conditioned on both CLIP image tokens and text tokens. The model is trained using "teacher forcing" on a lot of (image, text) pairs.
|
21 |
+
|
22 |
+
The goal for the model is simply to predict the next text token, giving the image tokens and previous text tokens.
|
23 |
+
|
24 |
+
The model has full access to (i.e. a bidirectional attention mask is used for) the image patch tokens, but only has access to the previous text tokens (i.e. a causal attention mask is used for the text tokens) when predicting the next text token.
|
25 |
+
|
26 |
+
![GIT architecture](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/git_architecture.jpg)
|
27 |
+
|
28 |
+
This allows the model to be used for tasks like:
|
29 |
+
|
30 |
+
- image and video captioning
|
31 |
+
- visual question answering (VQA) on images and videos
|
32 |
+
- even image classification (by simply conditioning the model on the image and asking it to generate a class for it in text).
|
33 |
+
|
34 |
+
## Intended uses & limitations
|
35 |
+
|
36 |
+
You can use the raw model for image captioning. See the [model hub](https://huggingface.co/models?search=microsoft/git) to look for
|
37 |
+
fine-tuned versions on a task that interests you.
|
38 |
+
|
39 |
+
### How to use
|
40 |
+
|
41 |
+
For code examples, we refer to the [documentation](https://huggingface.co/transformers/main/model_doc/git.html).
|
42 |
+
|
43 |
+
## Training data
|
44 |
+
|
45 |
+
From the paper:
|
46 |
+
|
47 |
+
> We collect 0.8B image-text pairs for pre-training, which include COCO (Lin et al., 2014), Conceptual Captions
|
48 |
+
(CC3M) (Sharma et al., 2018), SBU (Ordonez et al., 2011), Visual Genome (VG) (Krishna et al., 2016),
|
49 |
+
Conceptual Captions (CC12M) (Changpinyo et al., 2021), ALT200M (Hu et al., 2021a), and an extra 0.6B
|
50 |
+
data following a similar collection procedure in Hu et al. (2021a).
|
51 |
+
|
52 |
+
=> however this is for the model referred to as "GIT" in the paper, which is not open-sourced.
|
53 |
+
|
54 |
+
This checkpoint is "GIT-large", which is a smaller variant of GIT trained on 20 million image-text pairs.
|
55 |
+
|
56 |
+
Next, the model was fine-tuned on TextCaps.
|
57 |
+
|
58 |
+
See table 11 in the [paper](https://arxiv.org/abs/2205.14100) for more details.
|
59 |
+
|
60 |
+
### Preprocessing
|
61 |
+
|
62 |
+
We refer to the original repo regarding details for preprocessing during training.
|
63 |
+
|
64 |
+
During validation, one resizes the shorter edge of each image, after which center cropping is performed to a fixed-size resolution. Next, frames are normalized across the RGB channels with the ImageNet mean and standard deviation.
|
65 |
+
|
66 |
+
## Evaluation results
|
67 |
+
|
68 |
+
For evaluation results, we refer readers to the [paper](https://arxiv.org/abs/2205.14100).
|