wangqinghehe's picture
0515_first_upload
3ab16a9
raw
history blame contribute delete
No virus
47.3 kB
import numpy as np
import torch
from torch.utils.data import Dataset
from torchvision.transforms import transforms
import torch.nn.functional as F
import random
imagenet_templates_small = [
'a photo of {}',
'{} is sitting at a desk, writing in a notebook',
'{} is standing in a kitchen, cooking a meal',
'In a garden, there are flowers and trees. {} is walking around',
'{} is playing a piano in a music room',
'In a garden, {} is watering plants',
'In a gym, there are many machines. {} is lifting weights',
'{} is reading a book in a cozy armchair',
'{} is painting on a canvas in a studio',
'In a museum, there are many paintings. {} is admiring them',
'{} is jogging on a trail in the woods',
'In an office, {} is working on a computer',
'{} is playing with a dog in a backyard',
'{} is taking a photograph in a city street',
'In a concert, there are many people. {} is enjoying the music',
'{} is playing chess in a park',
'In a library, {} is browsing through books',
'{} is riding a bicycle on a city street',
'{} is watching a movie in a living room',
'In a café, {} is drinking coffee and using a laptop',
'{} is hiking in the mountains',
'{} is playing a violin in a concert hall',
'In a gym, a {} is lifting weights',
'{} is gardening in his backyard',
'{} is swimming in a pool',
'{} is shopping in a grocery stor',
'In a museum, {} is admiring a painting',
'In a studio, {} is recording a podcast',
'{} is doing yoga in a peaceful room',
'{} is cooking barbecue in a park',
'In a laboratory, {} is conducting an experiment',
'In an airport, {} is waiting for a flight',
'{} is sitting on a bench, smiling at the camera',
'{} is holding a book in his hands',
'In a room, {}n is sitting on a chair',
'{} is standing in front of a window',
'In a kitchen, {} is cooking food',
'In a living room, {} is watching TV',
'In a bedroom, {} is sleeping',
'{} is holding a cup of coffee',
'In a classroom, {} is writing on a whiteboard',
'In a gym, {} is lifting weights',
'{} is holding a microphone',
'In a restaurant, {} is eating food',
'{} is holding a pen and writing on a paper',
'In a store, {} is shopping for clothes',
'In a museum, {} is looking at an exhibit',
'{} is holding a camera and taking a photo',
'{} is holding a baby in his arms',
'In a laboratory, {} is conducting an experiment',
'{} is holding a guitar',
'In a swimming pool, {} is swimming',
'In a cafe, {} is drinking tea',
'In a garden, {} is watering plants',
'{} is sitting on a bench in a park',
'In a classroom, {} is writing on a whiteboard',
'{} is holding a pen and writing on a paper',
'{} is standing in front of a building',
'In a museum, {} is looking at an exhibit',
'In a theater, {} is watching a movie',
'{} is standing in front of a car',
'{} is standing in front of a tree',
'In a meeting room, {} is giving a presentation',
'In a stadium, {} is watching a game',
'In a garage, {} is fixing a car',
'{} is holding a paintbrush and painting a picture',
'In a classroom, {} is listening to a lecture',
'{} is standing in front of a mountain',
'In a park, {} is flying a kite',
'a rendering of a {}',
'a cropped photo of the {}',
'the photo of a {}',
'a photo of a clean {}',
'a photo of a dirty {}',
'a dark photo of the {}',
'a photo of my {}',
'a photo of the cool {}',
'a close-up photo of a {}',
'a bright photo of the {}',
'a cropped photo of a {}',
'a photo of the {}',
'a good photo of the {}',
'a photo of one {}',
'a close-up photo of the {}',
'a rendition of the {}',
'a photo of the clean {}',
'a rendition of a {}',
'a photo of a nice {}',
'a good photo of a {}',
'a photo of the nice {}',
'a photo of the small {}',
'a photo of the weird {}',
'a photo of the large {}',
'a photo of a cool {}',
'a photo of a small {}',
'an illustration of a {}',
'a rendering of a {}',
'a cropped photo of the {}',
'the photo of a {}',
'an illustration of a clean {}',
'an illustration of a dirty {}',
'a dark photo of the {}',
'an illustration of my {}',
'an illustration of the cool {}',
'a close-up photo of a {}',
'a bright photo of the {}',
'a cropped photo of a {}',
'an illustration of the {}',
'a good photo of the {}',
'an illustration of one {}',
'a close-up photo of the {}',
'a rendition of the {}',
'an illustration of the clean {}',
'a rendition of a {}',
'an illustration of a nice {}',
'a good photo of a {}',
'an illustration of the nice {}',
'an illustration of the small {}',
'an illustration of the weird {}',
'an illustration of the large {}',
'an illustration of a cool {}',
'an illustration of a small {}',
'a depiction of a {}',
'a rendering of a {}',
'a cropped photo of the {}',
'the photo of a {}',
'a depiction of a clean {}',
'a depiction of a dirty {}',
'a dark photo of the {}',
'a depiction of my {}',
'a depiction of the cool {}',
'a close-up photo of a {}',
'a bright photo of the {}',
'a cropped photo of a {}',
'a depiction of the {}',
'a good photo of the {}',
'a depiction of one {}',
'a close-up photo of the {}',
'a rendition of the {}',
'a depiction of the clean {}',
'a rendition of a {}',
'a depiction of a nice {}',
'a good photo of a {}',
'a depiction of the nice {}',
'a depiction of the small {}',
'a depiction of the weird {}',
'a depiction of the large {}',
'a depiction of a cool {}',
'a depiction of a small {}',
'{} reads a newspaper in a cozy coffee shop.',
'{} jogs along a winding trail at sunrise.',
'{} takes a photograph of the bustling cityscape.',
'{} bakes cookies in a warm, inviting kitchen.',
'{} paints a mural on a large outdoor wall.',
'{} plants a tree in a sunny backyard.',
'{} repairs an old bicycle in the garage.',
'{} sketches a portrait with charcoal.',
'{} dances freely at a lively festival.',
'{} sows seeds in a flourishing vegetable garden.',
'{} plays a violin in a quiet room.',
'{} writes a poem under the shade of an oak tree.',
'{} feeds ducks at a peaceful lake.',
'{} practices yoga on a tranquil beach at dawn.',
'{} repairs a watch with skilled hands.',
'{} constructs a model airplane with precision.',
'{} decorates a cake with elaborate icing designs.',
'{} climbs a rock wall with determination.',
'{} meditates in a serene temple garden.',
'{} knits a colorful scarf by the fireside.',
'{} assembles a puzzle on a rainy afternoon.',
'{} examines artifacts at a history museum.',
'{} tends to a beehive in protective gear.',
'{} composes a new song on a keyboard.',
'{} stretches before starting a marathon.',
'{} recites lines for an upcoming play.',
'{} harvests apples in an orchard.',
'{} leads a tour group through ancient ruins.',
'{} creates a scrapbook filled with memories.',
'{} tutors a student in mathematics.',
'{} tries a new recipe from a gourmet cookbook.',
'{} rides a horse through an open field.',
'{} collects samples on a nature walk.',
'{} solves a complex mathematical equation.',
'{} fills the room with the sound of saxophone music.',
'{} arranges flowers in a beautiful bouquet.',
'{} hosts a podcast interview.',
'{} dives into a crystal-clear swimming pool.',
'{} studies a map before an expedition.',
'{} makes ceramic pottery on a spinning wheel.',
'{} trains a puppy to sit and stay.',
'{} rehearses for a ballet performance.',
'{} sails a boat across a calm lake.',
'{} browses through a second-hand bookstore.',
'{} explores a cave with a flashlight.',
'{} restores an old car in their home workshop.',
'{} conducts an orchestra with passion.',
'{} volunteers at a community food bank.',
'{} compiles a report in their office.',
'{} designs a website on their computer.',
'{} teaches a child to ride a bike.',
'{} performs a magic trick at a party.',
'{} packs a suitcase for a journey.',
'{} prunes roses in a sunlit garden.',
'{} crafts handmade jewelry from silver and gems.',
'{} inspects products for quality in a factory.',
'{} sculpts a figure from a block of marble.',
'{} organizes a community cleanup day.',
'{} swings a golf club on a green fairway.',
'{} develops photos in a darkroom.',
'{} directs a small indie film.',
'{} carves a wooden figure with intricate detail.',
'{} birdwatches with binoculars in the forest.',
'{} pilots a hot air balloon at dawn.',
'{} tutors peers in a university library.',
'{} rides a skateboard down a city street.',
'{} decorates a storefront for the holidays.',
'{} mixes cocktails at a busy bar.',
'{} cuts hair in a stylish salon.',
'{} researches genealogy to fill out a family tree.',
'{} writes calligraphy with elegant strokes.',
'{} edits a manuscript for publication.',
'{} lectures on environmental science.',
'{} designs a new board game.',
'{} hosts a charity auction.',
'{} laces up skates for an ice-skating lesson.',
'{} coordinates a wedding at a picturesque venue.',
'{} builds a sandcastle on the beach.',
'{} programs a robot for a competition.',
'{} captures wildlife photography in the jungle.',
'{} sets up a tent under the stars.',
'{} debuts a fashion collection on the runway.',
'{} curates pieces for an art exhibition.',
'{} conducts a science experiment in the laboratory.',
'{} provides a walking tour of a historic city.',
'{} partakes in a coffee cupping session.',
'{} negotiates a deal in a boardroom.',
'{} operates a forklift in a warehouse.',
'{} leads a yoga retreat in a mountain setting.',
'{} analyzes data on multiple computer screens.',
'{} paints a picket fence on a sunny day.',
'{} trains for gymnastics at the gym.',
'{} teaches a pottery class, guiding students.',
'{} cares for animals at a wildlife sanctuary.',
'{} crafts origami creations from colorful paper.',
'{} deejays a lively dance party.',
'{} writes code for a new software application.',
'{} grows an array of herbs in a window garden.',
'{} instructs a spin class with high energy.',
'{} navigates rapids in a whitewater raft.',
'Quietly, {} sets the table for dinner.',
'Suddenly, {} stops to pick up a fallen object.',
'Calmly, {} navigates through the crowd.',
'Gently, {} soothes a crying child.',
'Quickly, {} dashes out in the rain.',
'Joyfully, {} embraces a long-lost friend.',
'Firmly, {} stands their ground in debate.',
'Loudly, {} cheers on their favorite team.',
'Patiently, {} waits for their turn.',
'Anxiously, {} fidgets during an interview.',
'Easily, {} solves a complex puzzle.',
'Sadly, {} waves farewell at the departure gates.',
'Meticulously, {} organizes their collection.',
'Slyly, {} sneaks a cookie from the jar.',
'Defiantly, {} marches for change.',
'Warmly, {} greets newcomers.',
'Hungrily, {} eyes the banquet table.',
'Enthusiastically, {} starts their first day of work.',
'Stealthily, {} moves in the game of hide and seek.',
'Expertly, {} navigates the rapid waters.',
'Seamlessly, {} transitions between tasks.',
'Vigorously, {} cleans the cluttered garage.',
'Devotedly, {} tends to their garden.',
'Silently, {} admires the sunrise.',
'Righteously, {} advocates for justice.',
'Keenly, {} observes the wildlife.',
'Desperately, {} searches for their lost item.',
'Reverently, {} visits a historic monument.',
'Wistfully, {} looks back on fond memories.',
'Ambitiously, {} sets their career goals.',
'Rapidly, {} types up an urgent report.',
'Generously, {} shares their lunch.',
'Skillfully, {} crafts a beautiful piece of pottery.',
'Cautiously, {} approaches the unfamiliar dog.',
'Inquisitively, {} examines the ancient artifact.',
'Effortlessly, {} completes the challenging workout.',
'Frantically, {} looks for the exit.',
'Discreetly, {} passes a note during class.',
'Pensively, {} contemplates their next move.',
'Optimistically, {} plans for the future.',
'Sorrowfully, {} attends a memorial service.',
'Methodically, {} assembles the model airplane.',
'Lazily, {} lounges on the hammock.',
'Unsuccessfully, {} tries to hail a taxi.',
'Faithfully, {} follows the recipe.',
'Dramatically, {} reacts to the plot twist.',
'Adventurously, {} explores the dense forest.',
'Gracefully, {} accepts the award.',
'Theatrically, {} recites lines on stage.',
'Ardently, {} defends their thesis.',
'Abstractedly, {} doodles during the meeting.',
'Vivaciously, {} engages in the lively party.',
'Stoically, {} endures the challenging ordeal.',
'Resolutely, {} decides to change their life.',
'Triumphantly, {} crosses the finish line.',
'Suspiciously, {} glances over their shoulder.',
'Fervently, {} prays for good news.',
'Ruefully, {} acknowledges their mistake.',
'Industriously, {} works on the project till dusk.',
'Compassionately, {} comforts a stranger.',
'Sheepishly, {} admits they forgot the appointment.',
'Irately, {} disputes the incorrect charge.',
'Protectively, {} shields the puppy from the rain.',
'Serenely, {} meditates in the morning light.',
'Comically, {} slips on the banana peel.',
'Impressively, {} juggles multiple objects with ease.',
'Apprehensively, {} approaches the spooky house.',
'Unwaveringly, {} supports their friend.',
'Blissfully, {} soaks in the hot spring.',
'Compulsively, {} checks their notifications.',
'Tactfully, {} navigates the awkward situation.',
'Convincingly, {} sells their innovative idea.',
'Dutifully, {} fulfills their obligations.',
'Ingeniously, {} solves the critical problem.',
'Haphazardly, {} packs their suitcase.',
'Deftly, {} maneuvers the playing pieces.',
'Intriguedly, {} listens to the mysterious tale.',
'Ceremoniously, {} unveils the new sculpture.',
'Sterily, {} organizes the lab equipment.',
'Unintentionally, {} overhears a private conversation.',
'Forever, {} holds dear the cherished memories.',
'Nostalgically, {} revisits their old neighborhood.',
'Predictably, {} always laughs at the same joke.',
'Politely, {} inquires about the meeting agenda.',
'Securely, {} fastens their seatbelt before takeoff.',
'Casually, {} strolls through the park.',
'Spontaneously, {} decides to go on a road trip.',
'Clearly, {} expresses their feelings.',
'Merrily, {} decorates for the festive season.',
'Valiantly, {} stands up against injustice.',
'Diligently, {} studies for the upcoming exam.',
'Nonchalantly, {} brushes off the slight mishap.',
'Intensely, {} focuses on the target.',
'Subtly, {} hints at the surprise party.',
'Mysteriously, {} vanishes into the foggy night.',
'Decisively, {} makes their final choice.',
'Lovingly, {} prepares a home-cooked meal.',
'Immaculately, {} arranges the storefront display.',
'Vibrantly, {} adds color to the canvas.',
'The silhouette of {} casts a long shadow.',
'Through the fog, {} emerges slowly.',
'Over the hill, {} rides a bicycle.',
'After the storm, {} surveys the damage.',
'Around the bend, {} sails a boat.',
'Under the tree, {} reads a book.',
'Beside the fire, {} warms their hands.',
'Below the surface, {} discovers coral reefs.',
'Beyond the fence, {} tends to horses.',
'Above the crowd, {} waves a flag.',
'Among the flowers, {} finds peace.',
'Across the field, {} flies a kite.',
'Near the water, {} sketches the view.',
'By the road, {} waits patiently.',
'With careful precision, {} repairs a clock.',
'In the spotlight, {} performs a solo.',
'To the beat, {} dances joyfully.',
'On the stage, {} delivers a monologue.',
'Underneath the stars, {} makes a wish.',
'Beside the window, {} sips morning tea.',
'At the corner, {} hails a cab.',
'Against the odds, {} triumphs victoriously.',
'Beneath the waves, {} finds tranquility.',
'Before the race, {} stretches carefully.',
'Through the lens, {} captures the moment.',
'From the bridge, {} observes the river.',
'Since the dawn, {} has been fishing.',
'Like a statue, {} stands immovable.',
'Inside the house, {} feels safe.',
'The smile of {} brightens the room.',
'Upon the mountaintop, {} feels awe.',
'Without a doubt, {} commits to the goal.',
'Reflecting on life, {} contemplates deeply.',
'Amidst the chaos, {} remains calm.',
'Throughout the day, {} maintains focus.',
'During the performance, {} takes the stage.',
'Considering all options, {} makes a choice.',
'Alongside the path, {} picks wildflowers.',
'Toward the horizon, {} gazes expectantly.',
'Wrapped in thought, {} ponders life’s mysteries.',
'Accompanied by music, {} feels uplifted.',
'Surrounded by books, {} indulges in knowledge.',
'Guided by intuition, {} chooses a path.',
'Entertaining guests, {} tells a tale.',
'Admiring the artwork, {} gains inspiration.',
'Standing at the crossroads, {} hesitates slightly.',
'Lost in music, {} enjoys the concert.',
'Besieged by deadlines, {} works diligently.',
'Empowered by support, {} achieves greatness.',
'Gazing into space, {} dreams of stars.',
'Facing the challenge, {} exudes confidence.',
'Approaching the podium, {} clears their throat.',
'Enclosed in glass, {} admires the terrarium.',
'The reflection of {} shimmers on water.',
'Clutching the ticket, {} rushes to the gate.',
'Heeding the warning, {} takes precaution.',
'Observing the traditions, {} learns respect.',
'At the museum, {} admires ancient artifacts.',
'Following the recipe, {} bakes a cake.',
'Adjusting the telescope, {} explores the heavens.',
'In the garden, {} relaxes with nature.',
'Clinging to hope, {} perseveres through trials.',
'The laughter of {} fills the room.',
'During the lecture, {} takes diligent notes.',
'Sitting by the piano, {} composes a melody.',
'The hands of {} shape the clay.',
'The courage of {} inspires many others.',
'Laid on the canvas, {} begins to paint.',
'Carried by wind, {}’s kite ascends higher.',
'In the workshop, {} builds a dream.',
'Mingled with others, {} shares a story.',
'Learning the ropes, {} adapts quickly.',
'Fuelled by passion, {} pursues their dreams.',
'In the office, {} meets a deadline.',
'With each stride, {} closes the distance.',
'Mastering the craft, {} excels in their art.',
'The vision of {} leads to success.',
'Striving for wellness, {} embraces a change.',
'Buffeted by wind, {} adjusts their hat.',
'Engulfed in aroma, {} enjoys the spices.',
'Surrounded by laughter, {} feels joy.',
'Avoiding the puddle, {} steps carefully.',
'Reacting quickly, {} catches the falling vase.',
'Marked by time, {}’s diary tells tales.',
'Supported by friends, {} overcomes fear.',
'Puzzled by clues, {} solves the riddle.',
'Driving through night, {} reaches their destination.',
'Splashed by waves, {} laughs heartily.',
'Confronted with choices, {} deliberates wisely.',
'Hidden by shadows, {} watches the scene.',
'Inspired by nature, {} writes poetry.',
'Guarded by mystery, {}’s past intrigues.',
'Detouring the path, {} discovers new sights.',
'Greeted by dawn, {} feels renewed.',
'Warmed by sunlight, {} enjoys the afternoon.',
'Answering the call, {} takes action.',
'Sheltered by canopy, {} escapes the rain.',
'Bound by duty, {} fulfills their role.',
'Pulled by curiosity, {} enters the store.',
'Motivated by change, {} advocates for causes.',
'In silence, {} stares into space.',
'Lost in thought, {} stands still.',
'With excitement, {} opens a gift.',
'Amid laughter, {} shares a joke.',
'Surrounded by nature, {} takes a deep breath.',
'Under the sun, {} stretches out.',
'Against a backdrop of mountains, {} gazes afar.',
'Among friends, {} enjoys a conversation.',
'Before dinner, {} sets the table.',
'Behind the counter, {} makes coffee.',
'Below the surface, {} snorkels in clear water.',
'Beneath the stars, {} lights a campfire.',
'Beside a bicycle, {} takes a break.',
'By the seaside, {} collects seashells.',
'Near the horizon, {} sketches the view.',
'On the bridge, {} watches the water flow.',
'Through the window, {} waves goodbye.',
'To the music, {} taps their feet.',
'With a book, {} finds escape.',
'Without a care, {} listens to music.',
'Around the table, {} shares a story.',
'Outside the house, {} does some gardening.',
'From the stage, {} delivers a speech.',
'After the rain, {} jumps in puddles.',
'During the party, {} blows up balloons.',
'Following the path, {} takes a stroll.',
'Along the river, {} is fishing.',
'Inside the room, {} practices yoga.',
'Throughout the day, {} takes photos.',
'Across the field, {} flies a kite.',
'Between the lines, {} reads quietly.',
'Behind the lens, {} captures the moment.',
'Along the alley, {} walks their dog.',
'Before the sunrise, {} enjoys the calm.',
'Over the fence, {} talks to a neighbor.',
'Under the tree, {} has a picnic.',
'Beyond the gate, {} starts their journey.',
'Around the fire, {} tells ghost stories.',
'Above the clouds, {} skydives.',
'Among the crowd, {} cheers loudly.',
'Near the pond, {} feeds the ducks.',
'On the couch, {} takes a nap.',
'Before the show, {} checks their ticket.',
'Under the sky, {} flies a drone.',
'Behind the wheel, {} sings loudly.',
'Above the waves, {} surfs with skill.',
'Within the walls, {} paints their dream.',
'Beyond the road, {} hikes up the hill.',
'Beneath the quilt, {} reads at night.',
'Against the odds, {} tries a new trick.',
'During the trip, {} savors local cuisine.',
'Amid the shelves, {} finds an old book.',
'Across the room, {} waves to a friend.',
'By the pool, {} basks in the sun.',
'Beneath the lights, {} takes center stage.',
'Above the city, {} marvels at the view.',
'Behind the scenes, {} prepares diligently.',
'Over the moon, {} celebrates good news.',
'Under the arch, {} takes memorable photos.',
'Before the dawn, {} prepares for the day.',
'Throughout the match, {} cheers enthusiastically.',
'Between workouts, {} hydrates and rests.',
'Around the campfire, {} roasts marshmallows.',
'By the window, {} enjoys the morning light.',
'After the lecture, {} asks thoughtful questions.',
'Within the garden, {} admires the flowers.',
'Beneath the blanket, {} watches a movie.',
'Beyond the wall, {} hears echoes of laughter.',
'Behind the book, {} hides a surprise gift.',
'Under the bridge, {} sketches the river scene.',
'During the concert, {} loses themselves in the music.',
'On the terrace, {} sips on iced tea.',
'Before the alarm, {} wakes up naturally.',
'Above the rooftops, {} spots a passing balloon.',
'Across the street, {} helps an elderly neighbor.',
'Beside the lamp, {} finishes their novel.',
'With the crowd, {} dances to the festival music.',
'By the lakeside, {} sets up a fishing rod.',
'Before the exercise, {} stretches thoroughly.',
'Near the finish line, {} sprints with determination.',
'On the balcony, {} tends to potted plants.',
'After the storm, {} clears the fallen branches.',
'Under the covers, {} snoozes the alarm clock.',
'Between the curtains, {} peeks at the sunrise.',
'Around the corner, {} discovers a quaint café.',
'By the artwork, {} contemplates the message of the painter.',
'After the game, {} congratulates the players.',
'Within the studio, {} edits a documentary film.',
'Beneath the hat, {} grins at a private joke.',
'Beyond the dunes, {} takes in the beach view.',
'Behind the microphone, {} records a podcast.',
'Under the eaves, {} shelters from the rain.',
'During the hike, {} spots a rare bird.',
'On the platform, {} awaits the next train.',
'Before the meal, {} gives thanks.',
'Above the fray, {} keeps a level head.',
'Across the canvas, {} strokes colors with a brush.',
'Beside the hearth, {} warms their hands.',
'With affection, {} pets their sleepy cat.',
'By the harbor, {} watches boats come and go.',
'In a room, {} reads quietly.',
'Near the shore, {} fishes calmly.',
'Behind the counter, {} smiles warmly.',
'Among the trees, {} jogs daily.',
'On the bench, {} sits silently.',
'With a pen, {} writes diligently.',
'At dawn, {} stretches readily.',
'Under the stars, {} dreams peacefully.',
'With the dog, {} walks leisurely.',
'Against the backdrop, {} stands proudly.',
'On stage, {} speaks clearly.',
'In the garden, {} works happily.',
'At the table, {} eats slowly.',
'Beside the window, {} gazes thoughtfully.',
'Within the crowd, {} laughs loudly.',
'By the painting, {} ponders intently.',
'On the bridge, {} pauses reflectively.',
'Under the umbrella, {} waits patiently.',
'Before the game, {} practices routinely.',
'Behind the lens, {} captures moments.',
'In the cafe, {} sips coffee.',
'With a map, {} explores curiously.',
'On the couch, {} naps briefly.',
'At the wheel, {} drives safely.',
'Beside the fire, {} warms up.',
'During the concert, {} claps excitedly.',
'By the bookshelf, {} selects a novel.',
'On the path, {} bikes steadily.',
'Under the quilt, {} snoozes comfortably.',
'Before the screen, {} types consistently.',
'Within the room, {} dances joyfully.',
'At the market, {} shops carefully.',
'Beside the pool, {} sunbathes lazily.',
'On the road, {} hitches northward.',
'Against the clock, {} races swiftly.',
'By the door, {} knocks promptly.',
'In the silence, {} meditates profoundly.',
'With a brush, {} paints a canvas.',
'On a horse, {} rides boldly.',
'At the concert, {} listens attentively.',
'Beside the lamp, {} reads a letter.',
'On the field, {} throws a ball.',
'Under the sun, {} basks leisurely.',
'Before the microphone, {} sings softly.',
'Within the frame, {} looks stern.',
'In the studio, {} records a podcast.',
'By the seaside, {} collects shells.',
'On the mattress, {} lies awake.',
'Behind the bar, {} mixes drinks.',
'During the meeting, {} takes notes.',
'At the podium, {} delivers a speech.',
'Beside the pond, {} feeds ducks.',
'On the swing, {} rocks gently.',
'Under the sky, {} dreams freely.',
'Before the class, {} sets up.',
'Within the pages, {} finds adventure.',
'At the corner, {} waves hello.',
'By the stove, {} cooks breakfast.',
'On the terrace, {} breathes deeply.',
'Against the wall, {} rests momentarily.',
'In the lineup, {} waits calmly.',
'With a joystick, {} plays a game.',
'On the floor, {} stretches out.',
'At the crossroads, {} chooses a path.',
'Beside the bag, {} finds keys.',
'On the track, {} runs laps.',
'Under the tree, {} enjoys shade.',
'Before the journey, {} packs essentials.',
'Within the box, {} discovers treasures.',
'In the mirror, {} sees reflection.',
'By the lake, {} skips stones.',
'On the steps, {} sits waiting.',
'Against the flow, {} stands firm.',
'Before the event, {} feels nervous.',
'Within the heart, {} holds love.',
'At the keyboard, {} composes music.',
'By the fence, {} watches sunset.',
'On the ledge, {} takes in views.',
'Under the moon, {} makes wishes.',
'Before the crowd, {} shows courage.',
'Within the house, {} calls family.',
'At the desk, {} solves puzzles.',
'Beside the car, {} checks tires.',
'On the peak, {} celebrates triumph.',
'Against the odds, {} perseveres always.',
'In the foyer, {} welcomes guests.',
'With the team, {} collaborates effectively.',
'On the grass, {} rolls playfully.',
'At the junction, {} signals left.',
'Beside the easel, {} studies the painting.',
'On the quilt, {} patches holes.',
'Under the coat, {} hides a gift.',
'Before the dawn, {} dreams of success.',
'Within the shadows, {} moves silently.',
'At the beach, {} builds castles.',
'By the gate, {} waits anxiously.',
'On the island, {} finds peace.',
'Against the breeze, {} flies a kite.',
'Before the altar, {} takes a vow.',
'Within the orchestra, {} tunes their instrument.',
'An exciting magic trick is being performed by {}.',
'A quiet library is being enjoyed by {}.',
'A delicious meal is being cooked in the kitchen by {}.',
'A challenging rock wall is being climbed by {}.',
'A fast-paced basketball game is being played by {}.',
'A beautiful melody is being played on a violin by {}.',
'A serene lake is being fished by {}.',
'An intense workout is being completed in the gym by {}.',
'A mysterious book is being read under the tree by {}.',
'A spirited dance is being performed on stage by {}.',
'A serene afternoon picnic is being enjoyed by {}.',
'A thrilling skateboarding trick is being attempted by {}.',
'An intricate jigsaw puzzle is being solved by {}.',
'A high note is being sung in a rehearsal room by {}.',
'A new recipe is being tried out in the kitchen by {}.',
'A bookshelf is being organized in the study by {}.',
'A large canvas is being painted with bold colors by {}.',
'An ancient ruin is being carefully explored by {}.',
'A lengthy novel is being written at the desk by {}.',
'A pottery wheel is being used to shape clay by {}.',
'A soft melody is being played on a guitar by {}.',
'A new language is being learned with enthusiasm by {}.',
'An early morning jog is being taken along the beach by {}.',
'A handmade quilt is being stitched with care by {}.',
'A tropical fruit stand is being set up at the market by {}.',
'A hot beverage is being brewed in a cozy cafe by {}.',
'A winter bonfire is being lit to warm up the night by {}.',
'A peaceful kayak trip is being embarked upon by {}.',
'Bold graffiti is being sprayed on an urban wall by {}.',
'A lively story is being told around the campfire by {}.',
'A crafty sculpture is being created from recycled materials by {}.',
'A vibrant mural is being painted on a downtown alley by {}.',
'A dusty trail is being hiked at dawn by {}.',
'A tricky crossword puzzle is being filled out by {}.',
'A homemade pie is being baked for a special occasion by {}.',
'An elaborate garden is being tended to by {}.',
'A suspenseful movie is being watched with excitement by {}.',
'A difficult yoga pose is being mastered in the studio by {}.',
'A new skateboard is being ridden down a hill by {}.',
'A savory soup is being stirred in a pot by {}.',
'Cheerful holiday decorations are being hung around the house by {}.',
'A thrilling novel is being devoured on a rainy afternoon by {}.',
'A chess game is being thoughtfully played in the park by {}.',
'A burst of laughter is being shared with friends by {}.',
'Bright city lights are being admired from a rooftop by {}.',
'An old family recipe is being followed in the kitchen by {}.',
'A marshmallow is being roasted over a campfire by {}.',
'Careful brush strokes are being applied to a model figurine by {}.',
'A challenging video game is being played with focus by {}.',
'An evening class is being attended with interest by {}.',
'A delicate pastry is being decorated with icing by {}.',
'An excited puppy is being trained in the backyard by {}.',
'A basketball is being shot into a hoop by {}.',
'A lively drumbeat is being played at a concert by {}.',
'Colorful fall leaves are being photographed in the woods by {}.',
'A new song is being composed on the piano by {}.',
'A long-lost friend is being hugged in a warm embrace by {}.',
'Bright fireworks are being watched in awe by {}.',
'A favorite TV show is being binge-watched by {}.',
'A new trail is being biked through the forest by {}.',
'Freshly baked cookies are being taken out of the oven by {}.',
'A difficult problem is being solved with satisfaction by {}.',
'Colorful balloons are being blown up for a party by {}.',
'A joyful tune is being whistled while walking by {}.',
'An old film camera is being loaded with film by {}.',
'An empty canvas is being gazed upon before painting by {}.',
'An exciting soccer match is being watched with friends by {}.',
'A warm cup of tea is being sipped quietly by {}.',
'A good book is being enjoyed in a comfy armchair by {}.',
'A gentle horse is being groomed in the stable by {}.',
'A tense board game is being strategized over by {}.',
'Fresh laundry is being folded neatly by {}.',
'A thrilling roller coaster ride is being braved by {}.',
'A favorite song is being sung in the shower by {}.',
'A rainy day is being spent baking cookies by {}.',
'Classic tunes are being listened to on vinyl by {}.',
'An interesting documentary is being watched intently by {}.',
'A busy day is being relaxed from with a bubble bath by {}.',
'A sunflower field is being walked through by {}.',
'A new plant is being potted with care by {}.',
'A sunny terrace is being enjoyed with a cold drink by {}.',
'Morning birds are being listened to at dawn by {}.',
'A quiet museum hall is being wandered through by {}.',
'An experimental recipe is being tested in the kitchen by {}.',
'A homemade kite is being flown on a breezy day by {}.',
'A colorful aquarium is being cleaned by {}.',
'A new blog post is being composed on a laptop by {}.',
'A wild trail is being trekked with enthusiasm by {}.',
'An ice cream cone is being savored on a warm day by {}.',
'A peaceful sunrise is being watched from a hilltop by {}.',
'Freshly ground coffee is being brewed in the morning by {}.',
'A comfortable hammock is being swayed in gently by {}.',
'A nostalgic video game is being revisited with joy by {}.',
'A challenging Sudoku puzzle is being completed by {}.',
'A dusty attic is being explored for treasures by {}.',
'A hefty stack of pancakes is being devoured for breakfast by {}.',
'Delicate origami is being folded by {}.',
'A peaceful moment is being cherished on a quiet porch by {}.',
'On a quiet street, {} is jogging.',
'With a gentle smile, {} offers help.',
'Behind the old bookstore, {} reads quietly.',
'Near a calm lake, {} sketches the scenery.',
'By the bright window, {} sips coffee.',
'Under the warm sun, {} relaxes.',
'Around the bustling square, {} dances.',
'Beside the campfire, {} tells stories.',
'Above the city noise, {} daydreams.',
'Through the crowded fair, {} navigates.',
'Against the evening sky, {} takes photos.',
'Among the tall trees, {} hikes.',
'Before the morning rush, {} stretches.',
'Amid the garden blooms, {} seeks peace.',
'Across the open field, {} runs freely.',
'During the lively party, {} laughs.',
'Following the winding path, {} explores.',
'Outside the cozy cottage, {} gazes at stars.',
'Within the silent walls, {} contemplates.',
'Beneath the ancient arch, {} pauses reflectively.',
'Along the riverbank, {} fishes.',
'Beside a bubbling brook, {} writes poetry.',
'Underneath the vibrant mural, {} admires art.',
'Beyond the bustling streets, {} finds quiet.',
'Behind the heavy curtain, {} rehearses lines.',
'Upon the windswept hill, {} flies a kite.',
'Throughout the sunny day, {} tends the shop.',
'Despite the hectic pace, {} stays calm.',
'Behind the lens of a camera, {} captures moments.',
'Inside the warm bakery, {} savors aromas.',
'Beneath the star-filled sky, {} makes a wish.',
'Beyond the garden gate, {} enters serenity.',
'Between the bookshelves, {} finds adventure.',
'Across the dance floor, {} moves gracefully.',
'Around the festive decorations, {} feels joy.',
'Amidst the quiet sanctuary, {} prays.',
'Near the bustling café, {} watches the world.',
'Under the shade of a tree, {} enjoys a picnic.',
'By the glow of the fireplace, {} reads.',
'After the long journey, {} rests.',
'Outside the lively market, {} samples flavors.',
'Upon the old wooden bench, {} sits.',
'Around the warm campfire, {} sings.',
'Through the busy terminal, {} travels.',
'Within the walls of home, {} feels safe.',
'Beside the flowing river, {} reflects.',
'Against the cool breeze, {} wraps up warm.',
'Across the silent library, {} seeks knowledge.',
'Beneath the towering cliff, {} gazes up.',
'Beyond the colorful horizon, {} dreams.',
'Between the office cubicles, {} takes a breath.',
'Behind the vibrant easel, {} paints.',
'Upon the peaceful shore, {} collects shells.',
'Throughout the old village, {} discovers history.',
'Despite the falling rain, {} smiles.',
'Inside the bustling diner, {} enjoys breakfast.',
'By the edge of the fountain, {} tosses a coin.',
'Outside the charming bookstore, {} chooses a novel.',
'Upon the rooftop terrace, {} views the skyline.',
'Through the frosty window, {} longs for spring.',
'Within the hushed auditorium, {} listens intently.',
'Beside the crackling bonfire, {} cozies up.',
'Against the morning chill, {} jogs.',
'Across the golden meadow, {} strolls.',
'Amidst the echo of laughter, {} joins in.',
'Beyond the realm of the city, {} seeks nature.',
'Between the lush vines, {} harvests grapes.',
'Behind the frosted glass, {} sips tea.',
'Upon the creaky floorboards, {} tip-toes.',
'Throughout the silent movie, {} is mesmerized.',
'Despite the room’s clutter, {} finds order.',
'Beneath the bright marquee, {} awaits the opening.',
'By the light of the lanterns, {} feels warmth.',
'After the rain has passed, {} splashes in puddles.',
'Outside the local theater, {} buys a ticket.',
'Upon the green expanse, {} practices yoga.',
'Through the historic district, {} admires architecture.',
'Within the quiet of dawn, {} takes a moment.',
'Beside the ice-covered pond, {} feeds the ducks.',
'Against the setting sun, {} cherishes the moment.',
'Across the crowded room, {} finds a friend.',
'Amidst the morning calm, {} sows seeds.',
'Beneath the overcast sky, {} contemplates change.',
'Beyond the busy crosswalk, {} finds solitude.',
'Between two towering pines, {} hangs a hammock.',
'Behind the cool shade, {} enjoys an ice cream.',
'Upon the deserted path, {} embraces stillness.',
'Throughout the lively tune, {} taps their foot.',
'Despite the distance apart, {} feels connected.',
'Inside the crowded bus, {} daydreams.',
'Beneath the vast universe, {} feels wonder.',
'By the vibrant mural, {} appreciates art.',
'After the final curtain call, {} feels inspired.',
'Outside the quaint café, {} inhales the fresh morning air.',
'Sitting calmly with a book in their lap is {}.',
'Holding the reins of a horse stands {}.',
'Laughing at a joke just heard is {}.',
'Taking a deep breath of fresh air on a hike is {}.',
'Reaching for an apple on a tree is {}.',
'Playing a violin with focused attention is {}.',
'Taking a photo of the sunset is {}.',
'Lying on the grass and looking at the clouds is {}.',
'Standing with an umbrella in the rain is {}.',
'Throwing a frisbee in the park is {}.',
'Riding a skateboard down the sidewalk is {}.',
'Juggling three balls skillfully is {}.',
'Swinging on a swing with a smile is {}.',
'Pulling a suitcase in an airport is {}.',
'Dipping a paintbrush into paint before a canvas is {}.',
'Stretching before a run along the track is {}.',
'Pouring a cup of coffee in the morning is {}.',
'Bouncing a basketball on the court is {}.',
'Holding an ice cream cone upside down is {}.',
'Standing at the podium about to speak is {}.',
'Waiting for a train at the station is {}.',
'Typing rapidly on a keyboard is {}.',
'Riding a bicycle along the river path is {}.',
'Blowing out candles on a birthday cake is {}.',
'Feeding ducks by the pond is {}.',
'Hiking with a backpack up a mountain trail is {}.',
'Lifting weights in the gym is {}.',
'Contemplating a piece of art in a gallery is {}.',
'Sipping a milkshake through a straw is {}.',
'Planting seedlings in a garden bed is {}.',
'Wading through a stream with a fishing pole is {}.',
'Assembling a model airplane with focus is {}.',
'Whipping up a smoothie in a blender is {}.',
'Rolling out dough for a pie is {}.',
'Peering through a telescope at night is {}.',
'Flying a kite in the open field is {}.',
'Playing chess and contemplating the next move is {}.',
'Brushing a horse in the stable is {}.',
'Sitting on the pier with feet dangling over water is {}.',
'Tuning a guitar before a performance is {}.',
'Practicing yoga in a peaceful room is {}.',
'Sculpting clay on a pottery wheel is {}.',
'Skimming a stone across a lake is {}.',
'Building a sandcastle at the beach is {}.',
'Fishing at the crack of dawn on a boat is {}.',
'Roasting marshmallows over a campfire is {}.',
'Watching the horizon from the deck of a ship is {}.',
'Admiring the view from the top of a ferris wheel is {}.',
'Reading a map under the streetlight is {}.',
'Twirling a pen thoughtfully while studying is {}.',
'Writing in a journal quietly is {}.',
'Inspecting a gadget with curiosity is {}.',
'Balancing on a slackline between two trees is {}.',
'Mixing ingredients for a recipe is {}.',
'Waiting patiently for the crosswalk signal is {}.',
'Riding an escalator up to the next floor is {}.',
'Sitting on a bench feeding pigeons is {}.',
'Standing at the edge of the diving board is {}.',
'Looking at merchandise in a shop window is {}.',
'Sitting on the floor wrapping gifts is {}.',
'Climbing up a ladder to reach a high shelf is {}.',
'Waiting for the bus at the bus stop is {}.',
'Sipping tea while gazing out the window is {}.',
'Swinging a tennis racquet on the court is {}.',
'Watching a movie with 3D glasses on is {}.',
'Carving a piece of wood into a sculpture is {}.',
'Hula hooping in the backyard is {}.',
'Rowing a boat down the river is {}.',
'Bending down to tie a shoelace is {}.',
'Playing the drums with enthusiasm is {}.',
'Waiting in line at the grocery store checkout is {}.',
'Blowing bubbles with gum is {}.',
'Sketching a landscape on a notepad is {}.',
'Jumping into a pile of autumn leaves is {}.',
'Standing with hands on hips after a workout is {}.',
'Conducting an orchestra with intensity is {}.',
'Leaning against a fence watching the sunrise is {}.',
'Tossing a salad in a bowl for dinner is {}.',
'Crossing a footbridge over a stream is {}.',
'Bobbing their head to music on headphones is {}.',
'Attaching a lock to a bridge railing as a symbol of love is {}.',
'Pumping air into a bicycle tire is {}.',
'Repairing a computer with various tools is {}.',
'Doodling in a notebook during a lecture is {}.',
'Lining up a shot with a camera is {}.',
'Kneading dough on a floured surface is {}.',
'Waving goodbye at the train station is {}.',
'Lying on the beach soaking up the sun is {}.',
'Reading street signs in an unfamiliar city is {}.',
'Casting a fishing line from the shore is {}.',
'Blowing on a dandelion with seeds dispersing is {}.',
'Dancing alone in the living room is {}.',
'Watching the stars with a blanket wrapped around is {}.',
'Peeling an orange in one long spiral is {}.',
'Picking flowers from a field is {}.',
'Studying a museum exhibit with interest is {}.',
'Hanging laundry out to dry on a sunny day is {}.',
'Cuddling a pet cat on the couch is {}.',
'Arranging books on a shelf by color is {}.',
'Standing silent in a moment of gratitude is {}.'
]
random.shuffle(imagenet_templates_small)
per_img_token_list = ['*']
class FaceIdDataset(Dataset):
def __init__(self, experiment_name, **kwargs):
super(FaceIdDataset, self).__init__()
self.experiment_name = experiment_name
if self.experiment_name == "normal_GAN":
name_path = "datasets_face/good_names.txt"
elif self.experiment_name == "man_GAN":
name_path = "datasets_face/good_names_man.txt"
elif self.experiment_name == "woman_GAN":
name_path = "datasets_face/good_names_woman.txt"
else:
print("Hello, please notice this ^_^")
assert 0
print("now experiment_name:", self.experiment_name)
with open(name_path, "r") as f:
self.names = f.read().splitlines()
if self.experiment_name == "normal_GAN":
with open("datasets_face/good_names_man.txt", "r") as f_man, open("datasets_face/good_names_woman.txt", "r") as f_woman:
self.man_names = f_man.read().splitlines()
self.woman_names = f_woman.read().splitlines()
self._length = len(self.names)
def __len__(self):
return self._length
def __getitem__(self, i):
example = {}
name = self.names[i]
# if normal_GAN, this trick will be used for gender balance.
if self.experiment_name == "normal_GAN":
if random.random() < 0.5:
name = random.choice(self.man_names)
else:
name = random.choice(self.woman_names)
''' text '''
placeholder_string = per_img_token_list[0]
text = random.choice(imagenet_templates_small).format('%s person' % placeholder_string)
example["caption"] = text
example["name"] = name
return example