File size: 9,742 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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# import os
#
# import pandas as pd
#
# OPENAI_IMAGENET_TEMPLATES = (
#     lambda c: f'a bad thermal infrared photo of a {c}.',
#     lambda c: f'a thermal infrared photo of many {c}.',
#     lambda c: f'a sculpture of a {c}.',
#     lambda c: f'a thermal infrared photo of the hard to see {c}.',
#     lambda c: f'a low resolution thermal infrared photo of the {c}.',
#     lambda c: f'a rendering of a {c}.',
#     lambda c: f'graffiti of a {c}.',
#     lambda c: f'a bad thermal infrared photo of the {c}.',
#     lambda c: f'a cropped thermal infrared photo of the {c}.',
#     lambda c: f'a tattoo of a {c}.',
#     lambda c: f'the embroidered {c}.',
#     lambda c: f'a thermal infrared photo of a hard to see {c}.',
#     lambda c: f'a bright thermal infrared photo of a {c}.',
#     lambda c: f'a thermal infrared photo of a clean {c}.',
#     lambda c: f'a thermal infrared photo of a dirty {c}.',
#     lambda c: f'a dark thermal infrared photo of the {c}.',
#     lambda c: f'a drawing of a {c}.',
#     lambda c: f'a thermal infrared photo of my {c}.',
#     lambda c: f'the plastic {c}.',
#     lambda c: f'a thermal infrared photo of the cool {c}.',
#     lambda c: f'a close-up thermal infrared photo of a {c}.',
#     lambda c: f'a black and white thermal infrared photo of the {c}.',
#     lambda c: f'a painting of the {c}.',
#     lambda c: f'a painting of a {c}.',
#     lambda c: f'a pixelated thermal infrared photo of the {c}.',
#     lambda c: f'a sculpture of the {c}.',
#     lambda c: f'a bright thermal infrared photo of the {c}.',
#     lambda c: f'a cropped thermal infrared photo of a {c}.',
#     lambda c: f'a plastic {c}.',
#     lambda c: f'a thermal infrared photo of the dirty {c}.',
#     lambda c: f'a jpeg corrupted thermal infrared photo of a {c}.',
#     lambda c: f'a blurry thermal infrared photo of the {c}.',
#     lambda c: f'a thermal infrared photo of the {c}.',
#     lambda c: f'a good thermal infrared photo of the {c}.',
#     lambda c: f'a rendering of the {c}.',
#     lambda c: f'a {c} in a video game.',
#     lambda c: f'a thermal infrared photo of one {c}.',
#     lambda c: f'a doodle of a {c}.',
#     lambda c: f'a close-up thermal infrared photo of the {c}.',
#     lambda c: f'a thermal infrared photo of a {c}.',
#     lambda c: f'the origami {c}.',
#     lambda c: f'the {c} in a video game.',
#     lambda c: f'a sketch of a {c}.',
#     lambda c: f'a doodle of the {c}.',
#     lambda c: f'a origami {c}.',
#     lambda c: f'a low resolution thermal infrared photo of a {c}.',
#     lambda c: f'the toy {c}.',
#     lambda c: f'a rendition of the {c}.',
#     lambda c: f'a thermal infrared photo of the clean {c}.',
#     lambda c: f'a thermal infrared photo of a large {c}.',
#     lambda c: f'a rendition of a {c}.',
#     lambda c: f'a thermal infrared photo of a nice {c}.',
#     lambda c: f'a thermal infrared photo of a weird {c}.',
#     lambda c: f'a blurry thermal infrared photo of a {c}.',
#     lambda c: f'a cartoon {c}.',
#     lambda c: f'art of a {c}.',
#     lambda c: f'a sketch of the {c}.',
#     lambda c: f'a embroidered {c}.',
#     lambda c: f'a pixelated thermal infrared photo of a {c}.',
#     lambda c: f'itap of the {c}.',
#     lambda c: f'a jpeg corrupted thermal infrared photo of the {c}.',
#     lambda c: f'a good thermal infrared photo of a {c}.',
#     lambda c: f'a plushie {c}.',
#     lambda c: f'a thermal infrared photo of the nice {c}.',
#     lambda c: f'a thermal infrared photo of the small {c}.',
#     lambda c: f'a thermal infrared photo of the weird {c}.',
#     lambda c: f'the cartoon {c}.',
#     lambda c: f'art of the {c}.',
#     lambda c: f'a drawing of the {c}.',
#     lambda c: f'a thermal infrared photo of the large {c}.',
#     lambda c: f'a black and white thermal infrared photo of a {c}.',
#     lambda c: f'the plushie {c}.',
#     lambda c: f'a dark thermal infrared photo of a {c}.',
#     lambda c: f'itap of a {c}.',
#     lambda c: f'graffiti of the {c}.',
#     lambda c: f'a toy {c}.',
#     lambda c: f'itap of my {c}.',
#     lambda c: f'a thermal infrared photo of a cool {c}.',
#     lambda c: f'a thermal infrared photo of a small {c}.',
#     lambda c: f'a tattoo of the {c}.',
# )
#
# # a much smaller subset of above prompts
# # from https://github.com/openai/CLIP/blob/main/notebooks/Prompt_Engineering_for_ImageNet.ipynb
# SIMPLE_IMAGENET_TEMPLATES = (
#     lambda c: f'itap of a {c}.',
#     lambda c: f'a bad thermal infrared photo of the {c}.',
#     lambda c: f'a origami {c}.',
#     lambda c: f'a thermal infrared photo of the large {c}.',
#     lambda c: f'a {c} in a video game.',
#     lambda c: f'art of the {c}.',
#     lambda c: f'a thermal infrared photo of the small {c}.',
# )
#
# CLASSNAMES = {
#     'LLVIP': (
#         "background", "people"
#     ),
#     'FLIRV1': (
#         "bicycle", "car", "dog", "person"
#     ),
#     'FLIRV2': (
#         "bike", "bus", "car or pick-up trucks or vans", "hydrant", "traffic light", "motor", "construction equipment or trailers",
#         "person", "sign", "skateboard", "stroller or pram", "semi truck or freight truck"
#     ),
#     'LSOTB': (
#         "airplane", "badger", "bat", "bird", "boat", "bus", "car", "cat", "cow", "coyote", "deer", "dog",
#         "drone", "fox", "helicopter", "hog", "leopard", "motobike", "person", "truck"
#     )
# }


import os

import pandas as pd

OPENAI_IMAGENET_TEMPLATES = (
    lambda c: f'a bad photo of a {c}.',
    lambda c: f'a photo of many {c}.',
    lambda c: f'a sculpture of a {c}.',
    lambda c: f'a photo of the hard to see {c}.',
    lambda c: f'a low resolution photo of the {c}.',
    lambda c: f'a rendering of a {c}.',
    lambda c: f'graffiti of a {c}.',
    lambda c: f'a bad photo of the {c}.',
    lambda c: f'a cropped photo of the {c}.',
    lambda c: f'a tattoo of a {c}.',
    lambda c: f'the embroidered {c}.',
    lambda c: f'a photo of a hard to see {c}.',
    lambda c: f'a bright photo of a {c}.',
    lambda c: f'a photo of a clean {c}.',
    lambda c: f'a photo of a dirty {c}.',
    lambda c: f'a dark photo of the {c}.',
    lambda c: f'a drawing of a {c}.',
    lambda c: f'a photo of my {c}.',
    lambda c: f'the plastic {c}.',
    lambda c: f'a photo of the cool {c}.',
    lambda c: f'a close-up photo of a {c}.',
    lambda c: f'a black and white photo of the {c}.',
    lambda c: f'a painting of the {c}.',
    lambda c: f'a painting of a {c}.',
    lambda c: f'a pixelated photo of the {c}.',
    lambda c: f'a sculpture of the {c}.',
    lambda c: f'a bright photo of the {c}.',
    lambda c: f'a cropped photo of a {c}.',
    lambda c: f'a plastic {c}.',
    lambda c: f'a photo of the dirty {c}.',
    lambda c: f'a jpeg corrupted photo of a {c}.',
    lambda c: f'a blurry photo of the {c}.',
    lambda c: f'a photo of the {c}.',
    lambda c: f'a good photo of the {c}.',
    lambda c: f'a rendering of the {c}.',
    lambda c: f'a {c} in a video game.',
    lambda c: f'a photo of one {c}.',
    lambda c: f'a doodle of a {c}.',
    lambda c: f'a close-up photo of the {c}.',
    lambda c: f'a photo of a {c}.',
    lambda c: f'the origami {c}.',
    lambda c: f'the {c} in a video game.',
    lambda c: f'a sketch of a {c}.',
    lambda c: f'a doodle of the {c}.',
    lambda c: f'a origami {c}.',
    lambda c: f'a low resolution photo of a {c}.',
    lambda c: f'the toy {c}.',
    lambda c: f'a rendition of the {c}.',
    lambda c: f'a photo of the clean {c}.',
    lambda c: f'a photo of a large {c}.',
    lambda c: f'a rendition of a {c}.',
    lambda c: f'a photo of a nice {c}.',
    lambda c: f'a photo of a weird {c}.',
    lambda c: f'a blurry photo of a {c}.',
    lambda c: f'a cartoon {c}.',
    lambda c: f'art of a {c}.',
    lambda c: f'a sketch of the {c}.',
    lambda c: f'a embroidered {c}.',
    lambda c: f'a pixelated photo of a {c}.',
    lambda c: f'itap of the {c}.',
    lambda c: f'a jpeg corrupted photo of the {c}.',
    lambda c: f'a good photo of a {c}.',
    lambda c: f'a plushie {c}.',
    lambda c: f'a photo of the nice {c}.',
    lambda c: f'a photo of the small {c}.',
    lambda c: f'a photo of the weird {c}.',
    lambda c: f'the cartoon {c}.',
    lambda c: f'art of the {c}.',
    lambda c: f'a drawing of the {c}.',
    lambda c: f'a photo of the large {c}.',
    lambda c: f'a black and white photo of a {c}.',
    lambda c: f'the plushie {c}.',
    lambda c: f'a dark photo of a {c}.',
    lambda c: f'itap of a {c}.',
    lambda c: f'graffiti of the {c}.',
    lambda c: f'a toy {c}.',
    lambda c: f'itap of my {c}.',
    lambda c: f'a photo of a cool {c}.',
    lambda c: f'a photo of a small {c}.',
    lambda c: f'a tattoo of the {c}.',
)

# a much smaller subset of above prompts
# from https://github.com/openai/CLIP/blob/main/notebooks/Prompt_Engineering_for_ImageNet.ipynb
SIMPLE_IMAGENET_TEMPLATES = (
    lambda c: f'itap of a {c}.',
    lambda c: f'a bad photo of the {c}.',
    lambda c: f'a origami {c}.',
    lambda c: f'a photo of the large {c}.',
    lambda c: f'a {c} in a video game.',
    lambda c: f'art of the {c}.',
    lambda c: f'a photo of the small {c}.',
)

CLASSNAMES = {
    'LLVIP': (
        "background", "people"
    ),
    'FLIRV1': (
        "bicycle", "car", "dog", "person"
    ),
    'FLIRV2': (
        "bike", "bus", "car or pick-up trucks or vans", "hydrant", "traffic light", "motor", "construction equipment or trailers",
        "person", "sign", "skateboard", "stroller or pram", "semi truck or freight truck"
    ),
    'LSOTB': (
        "airplane", "badger", "bat", "bird", "boat", "bus", "car", "cat", "cow", "coyote", "deer", "dog",
        "drone", "fox", "helicopter", "hog", "leopard", "motobike", "person", "truck"
    )
}