-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheval_zero_shot_classification.py
More file actions
executable file
·198 lines (189 loc) · 6.17 KB
/
eval_zero_shot_classification.py
File metadata and controls
executable file
·198 lines (189 loc) · 6.17 KB
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
#---------------------------------------
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#---------------------------------------
from uncha.config import LazyCall as L
from uncha.evaluation.classification import ZeroShotClassificationEvaluator
evaluator = L(ZeroShotClassificationEvaluator)(
datasets_and_prompts={
"cifar10": [
"a photo of a {}.",
"a blurry photo of a {}.",
"a black and white photo of a {}.",
"a low contrast photo of a {}.",
"a high contrast photo of a {}.",
"a bad photo of a {}.",
"a good photo of a {}.",
"a photo of a small {}.",
"a photo of a big {}.",
"a photo of the {}.",
"a blurry photo of the {}.",
"a black and white photo of the {}.",
"a low contrast photo of the {}.",
"a high contrast photo of the {}.",
"a bad photo of the {}.",
"a good photo of the {}.",
"a photo of the small {}.",
"a photo of the big {}.",
],
"food101": [
"food : {}.",
"food porn : {}.",
],
"imagenet": [
"i took a picture : itap of a {}.",
"pics : a bad photo of the {}.",
"pics : a origami {}.",
"pics : a photo of the large {}.",
"pics : a {} in a video game.",
"pics : art of the {}.",
"pics : a photo of the small {}.",
],
"cars": [
"a photo of a {}.",
"a photo of the {}.",
"a photo of my {}.",
"i love my {}!",
"a photo of my dirty {}.",
"a photo of my clean {}.",
"a photo of my new {}.",
"a photo of my old {}.",
],
"cifar100": [
"a photo of a {}.",
"a blurry photo of a {}.",
"a black and white photo of a {}.",
"a low contrast photo of a {}.",
"a high contrast photo of a {}.",
"a bad photo of a {}.",
"a good photo of a {}.",
"a photo of a small {}.",
"a photo of a big {}.",
"a photo of the {}.",
"a blurry photo of the {}.",
"a black and white photo of the {}.",
"a low contrast photo of the {}.",
"a high contrast photo of the {}.",
"a bad photo of the {}.",
"a good photo of the {}.",
"a photo of the small {}.",
"a photo of the big {}.",
],
"cub2011": [
"bird pics : {}.",
"birding : {}.",
"birds : {}.",
"bird photography : {}.",
],
"sun397": [
"a photo of a {}.",
"a photo of the {}.",
],
"aircraft": [
"a photo of a {}, a type of aircraft.",
"a photo of the {}, a type of aircraft.",
],
"dtd": [
"pics : {} texture.",
"pics : {} pattern.",
"pics : {} thing.",
"pics : this {} texture.",
"pics : this {} pattern.",
"pics : this {} thing.",
],
"pets": [
"a photo of a {}, a type of pet.",
],
"caltech101": [
"a photo of a {}.",
"a painting of a {}.",
"a plastic {}.",
"a sculpture of a {}.",
"a sketch of a {}.",
"a tattoo of a {}.",
"a toy {}.",
"a rendition of a {}.",
"a embroidered {}.",
"a cartoon {}.",
"a {} in a video game.",
"a plushie {}.",
"a origami {}.",
"art of a {}.",
"graffiti of a {}.",
"a drawing of a {}.",
"a doodle of a {}.",
"a photo of the {}.",
"a painting of the {}.",
"the plastic {}.",
"a sculpture of the {}.",
"a sketch of the {}.",
"a tattoo of the {}.",
"the toy {}.",
"a rendition of the {}.",
"the embroidered {}.",
"the cartoon {}.",
"the {} in a video game.",
"the plushie {}.",
"the origami {}.",
"art of the {}.",
"graffiti of the {}.",
"a drawing of the {}.",
"a doodle of the {}.",
],
"flowers102": [
"flowers : {}.",
],
"stl10": [
"a photo of a {}.",
"a photo of the {}.",
],
"eurosat": [
"a centered satellite photo of {}.",
"a centered satellite photo of a {}.",
"a centered satellite photo of the {}.",
],
"resisc45": [
"satellite imagery of {}.",
"aerial imagery of {}.",
"satellite photo of {}.",
"aerial photo of {}.",
"satellite view of {}.",
"aerial view of {}.",
"satellite imagery of a {}.",
"aerial imagery of a {}.",
"satellite photo of a {}.",
"aerial photo of a {}.",
"satellite view of a {}.",
"aerial view of a {}.",
"satellite imagery of the {}.",
"aerial imagery of the {}.",
"satellite photo of the {}.",
"aerial photo of the {}.",
"satellite view of the {}.",
"aerial view of the {}.",
],
"country211": [
"a photo i took in {}.",
"a photo i took while visiting {}.",
"a photo from my home country of {}.",
"a photo from my visit to {}.",
"a photo showing the country of {}.",
],
"mnist": [
'a photo of the number: "{}".',
],
"clevr": [
"a photo of {} objects.",
],
"pcam": [
"this is a photo of {}.",
],
"sst2": [
"a {} review of a movie.",
],
},
data_dir="/path/to/your/dataset",
image_size=224
)