File size: 9,599 Bytes
45d0854 | 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 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 | import os
from PIL import Image
from transformers import CLIPProcessor
import os
text_input_calibration_samples = [
# People descriptions
"man with black backpack",
"woman with red hair",
"person wearing hoodie",
"tall man in suit",
"woman with blonde hair",
"person in wheelchair",
"man with beard",
"woman carrying purse",
"person wearing cap",
"elderly man with cane",
"young woman jogging",
"man in uniform",
"person with sunglasses",
"woman in dress",
"man carrying briefcase",
"person on bicycle",
"woman with shopping bags",
"man in casual clothes",
"person wearing mask",
"woman with ponytail",
# Clothing descriptions
"person in red shirt",
"man wearing blue jeans",
"woman in black coat",
"person in white sneakers",
"man with yellow jacket",
"woman wearing scarf",
"person in green hoodie",
"man in brown boots",
"woman with pink top",
"person wearing hat",
"man in dark clothing",
"woman in light colored dress",
"person with striped shirt",
"man wearing tie",
"woman in high heels",
"person with leather jacket",
"man in work clothes",
"woman carrying umbrella",
"person in sports uniform",
"man with reflective vest",
# Activities and behaviors
"person running",
"man walking quickly",
"woman looking around",
"person standing still",
"man sitting on bench",
"woman using phone",
"person entering building",
"man leaving premises",
"woman walking dog",
"person climbing fence",
"man opening door",
"woman waiting outside",
"person pacing back and forth",
"man looking over shoulder",
"woman checking watch",
"person hiding behind object",
"man crouching down",
"woman pointing at something",
"person waving hands",
"man shaking head",
# Multiple people
"two people talking",
"group of three men",
"couple walking together",
"family with children",
"two women arguing",
"group of teenagers",
"men in conversation",
"people shaking hands",
"crowd gathering",
"two people embracing",
"group walking together",
"people standing in line",
"multiple people running",
"group of workers",
"people sitting together",
"two men fighting",
"women laughing together",
"group carrying items",
"people looking up",
"multiple suspicious individuals",
# Vehicle related
"person getting out of car",
"man approaching vehicle",
"woman walking to car",
"person by motorcycle",
"man loading truck",
"woman on scooter",
"person near van",
"man washing car",
"woman in parking lot",
"person crossing street",
"man directing traffic",
"woman hailing taxi",
"person with bicycle",
"man fixing car",
"woman in driver seat",
"person walking between cars",
"man checking vehicle",
"woman backing out car",
"person on skateboard",
"man with car keys",
# Suspicious activities
"person looking through window",
"man trying door handle",
"woman peering around corner",
"person with crowbar",
"man in restricted area",
"woman acting nervously",
"person avoiding cameras",
"man covering face",
"woman dropping something",
"person moving stealthily",
"man with suspicious package",
"woman looking over fence",
"person tampering with lock",
"man hiding object",
"woman checking surroundings",
"person in dark alley",
"man wearing all black",
"woman with large bag",
"person acting erratically",
"man breaking window",
# Time-based descriptions
"person at night",
"man during daylight",
"woman in early morning",
"person at dusk",
"man in bright sunlight",
"woman in shadows",
"person during storm",
"man in fog",
"woman in rain",
"person at dawn",
"man during lunch hour",
"woman after hours",
"person on weekend",
"man during business hours",
"woman late at night",
"person in darkness",
"man under streetlight",
"woman in well-lit area",
"person during sunset",
"man in twilight",
# Location-based
"person near entrance",
"man by back door",
"woman at front gate",
"person in parking garage",
"man on rooftop",
"woman in stairwell",
"person near fence",
"man in courtyard",
"woman by dumpster",
"person on sidewalk",
"man in lobby",
"woman near elevator",
"person in hallway",
"man by loading dock",
"woman near mailbox",
"person at bus stop",
"man in garden area",
"woman by playground",
"person near storage unit",
"man at security booth",
# Physical characteristics
"short person walking",
"tall man standing",
"heavy set woman",
"thin person running",
"muscular man lifting",
"petite woman entering",
"bald man approaching",
"person with long hair",
"man with tattoos",
"woman with glasses",
"person limping",
"man with mustache",
"woman in heels",
"person using crutches",
"man with gray hair",
"young person skateboarding",
"middle-aged woman",
"elderly person sitting",
"child with adult",
"teenager alone",
# Carrying objects
"person with laptop bag",
"man carrying box",
"woman with suitcase",
"person holding tools",
"man with shopping cart",
"woman carrying flowers",
"person with sports equipment",
"man holding papers",
"woman with coffee cup",
"person carrying ladder",
"man with toolbox",
"woman holding keys",
"person with camera",
"man carrying rope",
"woman with baby stroller",
"person holding flashlight",
"man with garbage bag",
"woman carrying groceries",
"person with musical instrument",
"man holding phone",
# Emergency situations
"person calling for help",
"man running from scene",
"woman appearing distressed",
"person on ground",
"man assisting someone",
"woman fleeing area",
"person waving for attention",
"man performing CPR",
"woman directing emergency responders",
"person administering first aid",
"man evacuating building",
"woman in medical emergency",
"person calling police",
"man reporting incident",
"woman seeking shelter",
"person in accident",
"man helping injured person",
"woman escaping danger",
"person signaling distress",
"man during emergency",
# Delivery and service
"delivery person at door",
"man in uniform with package",
"woman signing clipboard",
"postal worker walking",
"repair technician working",
"cleaning person entering",
"security guard patrolling",
"maintenance worker outside",
"food delivery person",
"man reading meter",
"woman inspecting property",
"service vehicle driver",
"contractor with equipment",
"landscaper working",
"painter carrying supplies",
"electrician with tools",
"plumber at entrance",
"pest control worker",
"cable technician arriving",
"utility worker climbing",
# Facial expressions and gestures
"person smiling",
"man frowning",
"woman gesturing angrily",
"person nodding head",
"man shrugging shoulders",
"woman covering mouth",
"person pointing direction",
"man wiping forehead",
"woman clapping hands",
"person scratching head",
"man thumbs up gesture",
"woman waving goodbye",
"person looking confused",
"man appearing angry",
"woman seeming worried",
"person showing surprise",
"man looking tired",
"woman appearing happy",
"person checking time",
"man stretching arms",
# Weather conditions
"person in heavy coat",
"man without jacket in cold",
"woman with snow boots",
"person holding umbrella open",
"man squinting in sun",
"woman bundled up warmly",
"person running from rain",
"man in summer clothes",
"woman wearing raincoat",
"person slipping on ice",
"man sweating heavily",
"woman shivering outside",
"person in winter hat",
"man in shorts and sandals",
"woman with wet hair",
"person seeking shade",
"man wiping rain off",
"woman in light summer dress",
"person with frost breath",
"man removing wet clothes",
# Technology interaction
"person using ATM",
"man scanning keycard",
"woman typing on keypad",
"person talking on phone",
"man taking photo",
"woman checking smartphone",
"person using tablet",
"man operating machine",
"woman at computer terminal",
"person with headphones",
"man charging device",
"woman using GPS",
"person with smart watch",
"man installing equipment",
"woman troubleshooting device",
"person with bluetooth earpiece",
"man using remote control",
"woman at self-checkout",
"person scanning QR code",
"man with virtual reality headset"
]
def get_text_calibration_data():
processor = CLIPProcessor.from_pretrained("openai/clip-vit-base-patch32")
calibration_data = []
for text in text_input_calibration_samples:
inputs = processor(text=[text], return_tensors="pt", padding="max_length", truncation=True)
calibration_data.append((inputs.data["input_ids"], inputs.data["attention_mask"]))
return calibration_data
|