JiawenXi commited on
Commit
9a638ef
·
verified ·
1 Parent(s): 3ffd7ef

Add files using upload-large-folder tool

Browse files
models/OneRef_L/ONEREF_large_rec_ir_flir_best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53f17b8b3fbc5043d33e2235b9b0f36f09f53ee2e57b633f3d54a4d4fb90bd34
3
+ size 8140897690
models/OneRef_L/ONEREF_large_rec_ir_mfad_best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:759e579ccf9e9bd3014d5b70e42508f78845febb211a2a1720be0ae8f511f5b0
3
+ size 8140897690
models/OneRef_L/ONEREF_large_rec_rgb_flir_best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:782098059f3e49ee09805e9c4c79d86e31f364a89e0d6419cf5b8d14d86becf2
3
+ size 8140897754
models/OneRef_L/ONEREF_large_rec_rgbt_flir_best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c4292e8736c3a4565e0a0b47b92f55d72928b8e525eba5df1fb61d4cd476ddf9
3
+ size 8140897754
models/OneRef_L/ONEREF_large_rec_rgbt_m3fd_best.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c123779080d3b103367db3af1cad165c36abc4a09155cde1e2a00466cc6e6141
3
+ size 8140897754
pretrained_weights/Bert/coreml/fill-mask/float32_model.mlpackage/Manifest.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "fileFormatVersion": "1.0.0",
3
+ "itemInfoEntries": {
4
+ "9D749A46-ADA0-43CA-B5C2-8E722B91F41E": {
5
+ "author": "com.apple.CoreML",
6
+ "description": "CoreML Model Specification",
7
+ "name": "model.mlmodel",
8
+ "path": "com.apple.CoreML/model.mlmodel"
9
+ },
10
+ "D545B13F-2D5E-4CFB-BFF1-C10E9EFD70DA": {
11
+ "author": "com.apple.CoreML",
12
+ "description": "CoreML Model Weights",
13
+ "name": "weights",
14
+ "path": "com.apple.CoreML/weights"
15
+ }
16
+ },
17
+ "rootModelIdentifier": "9D749A46-ADA0-43CA-B5C2-8E722B91F41E"
18
+ }
pretrained_weights/Bert/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
pretrained_weights/Bert/vocab.txt ADDED
The diff for this file is too large to render. See raw diff
 
pretrained_weights/CLIP/clip-vit-base-patch16/README.md ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - vision
4
+ widget:
5
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/cat-dog-music.png
6
+ candidate_labels: playing music, playing sports
7
+ example_title: Cat & Dog
8
+ ---
9
+ # Model Card: CLIP
10
+ Disclaimer: The model card is taken and modified from the official CLIP repository, it can be found [here](https://github.com/openai/CLIP/blob/main/model-card.md).
11
+
12
+
13
+ ## Model Details
14
+ The CLIP model was developed by researchers at OpenAI to learn about what contributes to robustness in computer vision tasks. The model was also developed to test the ability of models to generalize to arbitrary image classification tasks in a zero-shot manner. It was not developed for general model deployment - to deploy models like CLIP, researchers will first need to carefully study their capabilities in relation to the specific context they’re being deployed within.
15
+
16
+
17
+ ### Model Date
18
+ January 2021
19
+
20
+
21
+ ### Model Type
22
+ The base model uses a ViT-B/16 Transformer architecture as an image encoder and uses a masked self-attention Transformer as a text encoder. These encoders are trained to maximize the similarity of (image, text) pairs via a contrastive loss.
23
+
24
+ The original implementation had two variants: one using a ResNet image encoder and the other using a Vision Transformer. This repository has the variant with the Vision Transformer.
25
+
26
+
27
+ ### Documents
28
+ - [Blog Post](https://openai.com/blog/clip/)
29
+ - [CLIP Paper](https://arxiv.org/abs/2103.00020)
30
+
31
+
32
+ ### Use with Transformers
33
+ ```python3
34
+ from PIL import Image
35
+ import requests
36
+ from transformers import CLIPProcessor, CLIPModel
37
+ model = CLIPModel.from_pretrained("openai/clip-vit-base-patch16")
38
+ processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch16")
39
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
40
+ image = Image.open(requests.get(url, stream=True).raw)
41
+ inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
42
+ outputs = model(**inputs)
43
+ logits_per_image = outputs.logits_per_image # this is the image-text similarity score
44
+ probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
45
+ ```
46
+
47
+
48
+ ## Model Use
49
+
50
+ ### Intended Use
51
+ The model is intended as a research output for research communities. We hope that this model will enable researchers to better understand and explore zero-shot, arbitrary image classification. We also hope it can be used for interdisciplinary studies of the potential impact of such models - the CLIP paper includes a discussion of potential downstream impacts to provide an example for this sort of analysis.
52
+
53
+
54
+ #### Primary intended uses
55
+ The primary intended users of these models are AI researchers.
56
+ We primarily imagine the model will be used by researchers to better understand robustness, generalization, and other capabilities, biases, and constraints of computer vision models.
57
+
58
+
59
+ ### Out-of-Scope Use Cases
60
+ **Any** deployed use case of the model - whether commercial or not - is currently out of scope. Non-deployed use cases such as image search in a constrained environment, are also not recommended unless there is thorough in-domain testing of the model with a specific, fixed class taxonomy. This is because our safety assessment demonstrated a high need for task specific testing especially given the variability of CLIP’s performance with different class taxonomies. This makes untested and unconstrained deployment of the model in any use case currently potentially harmful.
61
+ Certain use cases which would fall under the domain of surveillance and facial recognition are always out-of-scope regardless of performance of the model. This is because the use of artificial intelligence for tasks such as these can be premature currently given the lack of testing norms and checks to ensure its fair use.
62
+ Since the model has not been purposefully trained in or evaluated on any languages other than English, its use should be limited to English language use cases.
63
+
64
+
65
+ ## Data
66
+ The model was trained on publicly available image-caption data. This was done through a combination of crawling a handful of websites and using commonly-used pre-existing image datasets such as [YFCC100M](http://projects.dfki.uni-kl.de/yfcc100m/). A large portion of the data comes from our crawling of the internet. This means that the data is more representative of people and societies most connected to the internet which tend to skew towards more developed nations, and younger, male users.
67
+
68
+
69
+ ### Data Mission Statement
70
+ Our goal with building this dataset was to test out robustness and generalizability in computer vision tasks. As a result, the focus was on gathering large quantities of data from different publicly-available internet data sources. The data was gathered in a mostly non-interventionist manner. However, we only crawled websites that had policies against excessively violent and adult images and allowed us to filter out such content. We do not intend for this dataset to be used as the basis for any commercial or deployed model and will not be releasing the dataset.
71
+
72
+
73
+ ## Performance and Limitations
74
+
75
+
76
+ ### Performance
77
+ We have evaluated the performance of CLIP on a wide range of benchmarks across a variety of computer vision datasets such as OCR to texture recognition to fine-grained classification. The paper describes model performance on the following datasets:
78
+ - Food101
79
+ - CIFAR10
80
+ - CIFAR100
81
+ - Birdsnap
82
+ - SUN397
83
+ - Stanford Cars
84
+ - FGVC Aircraft
85
+ - VOC2007
86
+ - DTD
87
+ - Oxford-IIIT Pet dataset
88
+ - Caltech101
89
+ - Flowers102
90
+ - MNIST
91
+ - SVHN
92
+ - IIIT5K
93
+ - Hateful Memes
94
+ - SST-2
95
+ - UCF101
96
+ - Kinetics700
97
+ - Country211
98
+ - CLEVR Counting
99
+ - KITTI Distance
100
+ - STL-10
101
+ - RareAct
102
+ - Flickr30
103
+ - MSCOCO
104
+ - ImageNet
105
+ - ImageNet-A
106
+ - ImageNet-R
107
+ - ImageNet Sketch
108
+ - ObjectNet (ImageNet Overlap)
109
+ - Youtube-BB
110
+ - ImageNet-Vid
111
+
112
+
113
+ ## Limitations
114
+ CLIP and our analysis of it have a number of limitations. CLIP currently struggles with respect to certain tasks such as fine grained classification and counting objects. CLIP also poses issues with regards to fairness and bias which we discuss in the paper and briefly in the next section. Additionally, our approach to testing CLIP also has an important limitation- in many cases we have used linear probes to evaluate the performance of CLIP and there is evidence suggesting that linear probes can underestimate model performance.
115
+
116
+
117
+ ### Bias and Fairness
118
+ We find that the performance of CLIP - and the specific biases it exhibits - can depend significantly on class design and the choices one makes for categories to include and exclude. We tested the risk of certain kinds of denigration with CLIP by classifying images of people from [Fairface](https://arxiv.org/abs/1908.04913) into crime-related and non-human animal categories. We found significant disparities with respect to race and gender. Additionally, we found that these disparities could shift based on how the classes were constructed. (Details captured in the Broader Impacts Section in the paper).
119
+ We also tested the performance of CLIP on gender, race and age classification using the Fairface dataset (We default to using race categories as they are constructed in the Fairface dataset.) in order to assess quality of performance across different demographics. We found accuracy >96% across all races for gender classification with ‘Middle Eastern’ having the highest accuracy (98.4%) and ‘White’ having the lowest (96.5%). Additionally, CLIP averaged ~93% for racial classification and ~63% for age classification. Our use of evaluations to test for gender, race and age classification as well as denigration harms is simply to evaluate performance of the model across people and surface potential risks and not to demonstrate an endorsement/enthusiasm for such tasks.
120
+
121
+
122
+ ## Feedback
123
+
124
+
125
+ ### Where to send questions or comments about the model
126
+ Please use [this Google Form](https://forms.gle/Uv7afRH5dvY34ZEs9)
pretrained_weights/CLIP/clip-vit-base-patch16/config.json ADDED
@@ -0,0 +1,157 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "CLIPModel"
4
+ ],
5
+ "initializer_factor": 1.0,
6
+ "logit_scale_init_value": 2.6592,
7
+ "model_type": "clip",
8
+ "projection_dim": 512,
9
+ "text_config": {
10
+ "_name_or_path": "",
11
+ "add_cross_attention": false,
12
+ "architectures": null,
13
+ "attention_dropout": 0.0,
14
+ "bad_words_ids": null,
15
+ "bos_token_id": 0,
16
+ "chunk_size_feed_forward": 0,
17
+ "decoder_start_token_id": null,
18
+ "diversity_penalty": 0.0,
19
+ "do_sample": false,
20
+ "dropout": 0.0,
21
+ "early_stopping": false,
22
+ "encoder_no_repeat_ngram_size": 0,
23
+ "eos_token_id": 2,
24
+ "finetuning_task": null,
25
+ "forced_bos_token_id": null,
26
+ "forced_eos_token_id": null,
27
+ "hidden_act": "quick_gelu",
28
+ "hidden_size": 512,
29
+ "id2label": {
30
+ "0": "LABEL_0",
31
+ "1": "LABEL_1"
32
+ },
33
+ "initializer_factor": 1.0,
34
+ "initializer_range": 0.02,
35
+ "intermediate_size": 2048,
36
+ "is_decoder": false,
37
+ "is_encoder_decoder": false,
38
+ "label2id": {
39
+ "LABEL_0": 0,
40
+ "LABEL_1": 1
41
+ },
42
+ "layer_norm_eps": 1e-05,
43
+ "length_penalty": 1.0,
44
+ "max_length": 20,
45
+ "max_position_embeddings": 77,
46
+ "min_length": 0,
47
+ "model_type": "clip_text_model",
48
+ "no_repeat_ngram_size": 0,
49
+ "num_attention_heads": 8,
50
+ "num_beam_groups": 1,
51
+ "num_beams": 1,
52
+ "num_hidden_layers": 12,
53
+ "num_return_sequences": 1,
54
+ "output_attentions": false,
55
+ "output_hidden_states": false,
56
+ "output_scores": false,
57
+ "pad_token_id": 1,
58
+ "prefix": null,
59
+ "problem_type": null,
60
+ "projection_dim" : 512,
61
+ "pruned_heads": {},
62
+ "remove_invalid_values": false,
63
+ "repetition_penalty": 1.0,
64
+ "return_dict": true,
65
+ "return_dict_in_generate": false,
66
+ "sep_token_id": null,
67
+ "task_specific_params": null,
68
+ "temperature": 1.0,
69
+ "tie_encoder_decoder": false,
70
+ "tie_word_embeddings": true,
71
+ "tokenizer_class": null,
72
+ "top_k": 50,
73
+ "top_p": 1.0,
74
+ "torch_dtype": null,
75
+ "torchscript": false,
76
+ "transformers_version": "4.12.0.dev0",
77
+ "use_bfloat16": false,
78
+ "vocab_size": 49408
79
+ },
80
+ "text_config_dict": null,
81
+ "torch_dtype": "float32",
82
+ "transformers_version": null,
83
+ "vision_config": {
84
+ "_name_or_path": "",
85
+ "add_cross_attention": false,
86
+ "architectures": null,
87
+ "attention_dropout": 0.0,
88
+ "bad_words_ids": null,
89
+ "bos_token_id": null,
90
+ "chunk_size_feed_forward": 0,
91
+ "decoder_start_token_id": null,
92
+ "diversity_penalty": 0.0,
93
+ "do_sample": false,
94
+ "dropout": 0.0,
95
+ "early_stopping": false,
96
+ "encoder_no_repeat_ngram_size": 0,
97
+ "eos_token_id": null,
98
+ "finetuning_task": null,
99
+ "forced_bos_token_id": null,
100
+ "forced_eos_token_id": null,
101
+ "hidden_act": "quick_gelu",
102
+ "hidden_size": 768,
103
+ "id2label": {
104
+ "0": "LABEL_0",
105
+ "1": "LABEL_1"
106
+ },
107
+ "image_size": 224,
108
+ "initializer_factor": 1.0,
109
+ "initializer_range": 0.02,
110
+ "intermediate_size": 3072,
111
+ "is_decoder": false,
112
+ "is_encoder_decoder": false,
113
+ "label2id": {
114
+ "LABEL_0": 0,
115
+ "LABEL_1": 1
116
+ },
117
+ "layer_norm_eps": 1e-05,
118
+ "length_penalty": 1.0,
119
+ "max_length": 20,
120
+ "min_length": 0,
121
+ "model_type": "clip_vision_model",
122
+ "no_repeat_ngram_size": 0,
123
+ "num_attention_heads": 12,
124
+ "num_beam_groups": 1,
125
+ "num_beams": 1,
126
+ "num_hidden_layers": 12,
127
+ "num_return_sequences": 1,
128
+ "output_attentions": false,
129
+ "output_hidden_states": false,
130
+ "output_scores": false,
131
+ "pad_token_id": null,
132
+ "patch_size": 16,
133
+ "prefix": null,
134
+ "problem_type": null,
135
+ "projection_dim" : 512,
136
+ "pruned_heads": {},
137
+ "remove_invalid_values": false,
138
+ "repetition_penalty": 1.0,
139
+ "return_dict": true,
140
+ "return_dict_in_generate": false,
141
+ "sep_token_id": null,
142
+ "task_specific_params": null,
143
+ "temperature": 1.0,
144
+ "tie_encoder_decoder": false,
145
+ "tie_word_embeddings": true,
146
+ "tokenizer_class": null,
147
+ "top_k": 50,
148
+ "top_p": 1.0,
149
+ "torch_dtype": null,
150
+ "torchscript": false,
151
+ "transformers_version": "4.12.0.dev0",
152
+ "use_bfloat16": false
153
+ },
154
+ "vision_config_dict": {
155
+ "patch_size": 16
156
+ }
157
+ }
pretrained_weights/CLIP/clip-vit-base-patch16/gitattributes.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
pretrained_weights/CLIP/clip-vit-base-patch16/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
pretrained_weights/CLIP/clip-vit-base-patch16/preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": 224,
3
+ "do_center_crop": true,
4
+ "do_normalize": true,
5
+ "do_resize": true,
6
+ "feature_extractor_type": "CLIPFeatureExtractor",
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "resample": 3,
18
+ "size": 224
19
+ }
pretrained_weights/CLIP/clip-vit-base-patch16/special_tokens_map.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"bos_token": {"content": "<|startoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<|endoftext|>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": "<|endoftext|>"}
pretrained_weights/CLIP/clip-vit-base-patch16/tokenizer_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "unk_token": {
3
+ "content": "<|endoftext|>",
4
+ "single_word": false,
5
+ "lstrip": false,
6
+ "rstrip": false,
7
+ "normalized": true,
8
+ "__type": "AddedToken"
9
+ },
10
+ "bos_token": {
11
+ "content": "<|startoftext|>",
12
+ "single_word": false,
13
+ "lstrip": false,
14
+ "rstrip": false,
15
+ "normalized": true,
16
+ "__type": "AddedToken"
17
+ },
18
+ "eos_token": {
19
+ "content": "<|endoftext|>",
20
+ "single_word": false,
21
+ "lstrip": false,
22
+ "rstrip": false,
23
+ "normalized": true,
24
+ "__type": "AddedToken"
25
+ },
26
+ "pad_token": "<|endoftext|>",
27
+ "errors": "replace",
28
+ "add_prefix_space": false,
29
+ "do_lower_case": true,
30
+ "name_or_path": "openai/clip-vit-base-patch16",
31
+ "model_max_length": 77,
32
+ "special_tokens_map_file": "./special_tokens_map.json",
33
+ "tokenizer_class": "CLIPTokenizer"
34
+ }
pretrained_weights/CLIP/clip-vit-large-patch14/README.md ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - vision
4
+ widget:
5
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/cat-dog-music.png
6
+ candidate_labels: playing music, playing sports
7
+ example_title: Cat & Dog
8
+ ---
9
+
10
+ # Model Card: CLIP
11
+
12
+ Disclaimer: The model card is taken and modified from the official CLIP repository, it can be found [here](https://github.com/openai/CLIP/blob/main/model-card.md).
13
+
14
+ ## Model Details
15
+
16
+ The CLIP model was developed by researchers at OpenAI to learn about what contributes to robustness in computer vision tasks. The model was also developed to test the ability of models to generalize to arbitrary image classification tasks in a zero-shot manner. It was not developed for general model deployment - to deploy models like CLIP, researchers will first need to carefully study their capabilities in relation to the specific context they’re being deployed within.
17
+
18
+ ### Model Date
19
+
20
+ January 2021
21
+
22
+ ### Model Type
23
+
24
+ The base model uses a ViT-L/14 Transformer architecture as an image encoder and uses a masked self-attention Transformer as a text encoder. These encoders are trained to maximize the similarity of (image, text) pairs via a contrastive loss.
25
+
26
+ The original implementation had two variants: one using a ResNet image encoder and the other using a Vision Transformer. This repository has the variant with the Vision Transformer.
27
+
28
+
29
+ ### Documents
30
+
31
+ - [Blog Post](https://openai.com/blog/clip/)
32
+ - [CLIP Paper](https://arxiv.org/abs/2103.00020)
33
+
34
+
35
+ ### Use with Transformers
36
+
37
+ ```python
38
+ from PIL import Image
39
+ import requests
40
+
41
+ from transformers import CLIPProcessor, CLIPModel
42
+
43
+ model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14")
44
+ processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
45
+
46
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
47
+ image = Image.open(requests.get(url, stream=True).raw)
48
+
49
+ inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
50
+
51
+ outputs = model(**inputs)
52
+ logits_per_image = outputs.logits_per_image # this is the image-text similarity score
53
+ probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
54
+ ```
55
+
56
+
57
+ ## Model Use
58
+
59
+ ### Intended Use
60
+
61
+ The model is intended as a research output for research communities. We hope that this model will enable researchers to better understand and explore zero-shot, arbitrary image classification. We also hope it can be used for interdisciplinary studies of the potential impact of such models - the CLIP paper includes a discussion of potential downstream impacts to provide an example for this sort of analysis.
62
+
63
+ #### Primary intended uses
64
+
65
+ The primary intended users of these models are AI researchers.
66
+
67
+ We primarily imagine the model will be used by researchers to better understand robustness, generalization, and other capabilities, biases, and constraints of computer vision models.
68
+
69
+ ### Out-of-Scope Use Cases
70
+
71
+ **Any** deployed use case of the model - whether commercial or not - is currently out of scope. Non-deployed use cases such as image search in a constrained environment, are also not recommended unless there is thorough in-domain testing of the model with a specific, fixed class taxonomy. This is because our safety assessment demonstrated a high need for task specific testing especially given the variability of CLIP’s performance with different class taxonomies. This makes untested and unconstrained deployment of the model in any use case currently potentially harmful.
72
+
73
+ Certain use cases which would fall under the domain of surveillance and facial recognition are always out-of-scope regardless of performance of the model. This is because the use of artificial intelligence for tasks such as these can be premature currently given the lack of testing norms and checks to ensure its fair use.
74
+
75
+ Since the model has not been purposefully trained in or evaluated on any languages other than English, its use should be limited to English language use cases.
76
+
77
+
78
+
79
+ ## Data
80
+
81
+ The model was trained on publicly available image-caption data. This was done through a combination of crawling a handful of websites and using commonly-used pre-existing image datasets such as [YFCC100M](http://projects.dfki.uni-kl.de/yfcc100m/). A large portion of the data comes from our crawling of the internet. This means that the data is more representative of people and societies most connected to the internet which tend to skew towards more developed nations, and younger, male users.
82
+
83
+ ### Data Mission Statement
84
+
85
+ Our goal with building this dataset was to test out robustness and generalizability in computer vision tasks. As a result, the focus was on gathering large quantities of data from different publicly-available internet data sources. The data was gathered in a mostly non-interventionist manner. However, we only crawled websites that had policies against excessively violent and adult images and allowed us to filter out such content. We do not intend for this dataset to be used as the basis for any commercial or deployed model and will not be releasing the dataset.
86
+
87
+
88
+
89
+ ## Performance and Limitations
90
+
91
+ ### Performance
92
+
93
+ We have evaluated the performance of CLIP on a wide range of benchmarks across a variety of computer vision datasets such as OCR to texture recognition to fine-grained classification. The paper describes model performance on the following datasets:
94
+
95
+ - Food101
96
+ - CIFAR10
97
+ - CIFAR100
98
+ - Birdsnap
99
+ - SUN397
100
+ - Stanford Cars
101
+ - FGVC Aircraft
102
+ - VOC2007
103
+ - DTD
104
+ - Oxford-IIIT Pet dataset
105
+ - Caltech101
106
+ - Flowers102
107
+ - MNIST
108
+ - SVHN
109
+ - IIIT5K
110
+ - Hateful Memes
111
+ - SST-2
112
+ - UCF101
113
+ - Kinetics700
114
+ - Country211
115
+ - CLEVR Counting
116
+ - KITTI Distance
117
+ - STL-10
118
+ - RareAct
119
+ - Flickr30
120
+ - MSCOCO
121
+ - ImageNet
122
+ - ImageNet-A
123
+ - ImageNet-R
124
+ - ImageNet Sketch
125
+ - ObjectNet (ImageNet Overlap)
126
+ - Youtube-BB
127
+ - ImageNet-Vid
128
+
129
+ ## Limitations
130
+
131
+ CLIP and our analysis of it have a number of limitations. CLIP currently struggles with respect to certain tasks such as fine grained classification and counting objects. CLIP also poses issues with regards to fairness and bias which we discuss in the paper and briefly in the next section. Additionally, our approach to testing CLIP also has an important limitation- in many cases we have used linear probes to evaluate the performance of CLIP and there is evidence suggesting that linear probes can underestimate model performance.
132
+
133
+ ### Bias and Fairness
134
+
135
+ We find that the performance of CLIP - and the specific biases it exhibits - can depend significantly on class design and the choices one makes for categories to include and exclude. We tested the risk of certain kinds of denigration with CLIP by classifying images of people from [Fairface](https://arxiv.org/abs/1908.04913) into crime-related and non-human animal categories. We found significant disparities with respect to race and gender. Additionally, we found that these disparities could shift based on how the classes were constructed. (Details captured in the Broader Impacts Section in the paper).
136
+
137
+ We also tested the performance of CLIP on gender, race and age classification using the Fairface dataset (We default to using race categories as they are constructed in the Fairface dataset.) in order to assess quality of performance across different demographics. We found accuracy >96% across all races for gender classification with ‘Middle Eastern’ having the highest accuracy (98.4%) and ‘White’ having the lowest (96.5%). Additionally, CLIP averaged ~93% for racial classification and ~63% for age classification. Our use of evaluations to test for gender, race and age classification as well as denigration harms is simply to evaluate performance of the model across people and surface potential risks and not to demonstrate an endorsement/enthusiasm for such tasks.
138
+
139
+
140
+
141
+ ## Feedback
142
+
143
+ ### Where to send questions or comments about the model
144
+
145
+ Please use [this Google Form](https://forms.gle/Uv7afRH5dvY34ZEs9)
pretrained_weights/CLIP/clip-vit-large-patch14/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
pretrained_weights/CLIP/clip-vit-large-patch14/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
pretrained_weights/CLIP/download.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from huggingface_hub import snapshot_download
2
+ import os
3
+
4
+ # 保存目录
5
+ local_dir = "./clip-vit-large-patch14"
6
+ os.makedirs(local_dir, exist_ok=True)
7
+
8
+ # 设置镜像源
9
+ # 国内可用 Hugging Face 镜像: https://huggingface.co 通过代理或镜像
10
+ # 下面用官方示例 HF_ENDPOINT 替换成国内镜像即可
11
+ os.environ["HF_HOME"] = local_dir # 缓存目录
12
+ os.environ["HF_HUB_OFFLINE"] = "0"
13
+ os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
14
+ os.environ["HF_ENDPOINT"] = "https://mirror-hf.tuna.tsinghua.edu.cn"
15
+
16
+
17
+ # 下载模型
18
+ snapshot_download(
19
+ repo_id="openai/clip-vit-large-patch14",
20
+ local_dir=local_dir,
21
+ resume_download=True, # 支持断点续传
22
+ )
pretrained_weights/oneref/l_rec_224.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7e63123843c4a1c85c0a8b8271c4601295e13bf6da320e8088d6daef689a14ad
3
+ size 8143942666