lvis.py 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. # Copyright (c) OpenMMLab. All rights reserved.
  2. import copy
  3. import warnings
  4. from typing import List
  5. from mmengine.fileio import get_local_path
  6. from mmdet.registry import DATASETS
  7. from .coco import CocoDataset
  8. @DATASETS.register_module()
  9. class LVISV05Dataset(CocoDataset):
  10. """LVIS v0.5 dataset for detection."""
  11. METAINFO = {
  12. 'classes':
  13. ('acorn', 'aerosol_can', 'air_conditioner', 'airplane', 'alarm_clock',
  14. 'alcohol', 'alligator', 'almond', 'ambulance', 'amplifier', 'anklet',
  15. 'antenna', 'apple', 'apple_juice', 'applesauce', 'apricot', 'apron',
  16. 'aquarium', 'armband', 'armchair', 'armoire', 'armor', 'artichoke',
  17. 'trash_can', 'ashtray', 'asparagus', 'atomizer', 'avocado', 'award',
  18. 'awning', 'ax', 'baby_buggy', 'basketball_backboard', 'backpack',
  19. 'handbag', 'suitcase', 'bagel', 'bagpipe', 'baguet', 'bait', 'ball',
  20. 'ballet_skirt', 'balloon', 'bamboo', 'banana', 'Band_Aid', 'bandage',
  21. 'bandanna', 'banjo', 'banner', 'barbell', 'barge', 'barrel',
  22. 'barrette', 'barrow', 'baseball_base', 'baseball', 'baseball_bat',
  23. 'baseball_cap', 'baseball_glove', 'basket', 'basketball_hoop',
  24. 'basketball', 'bass_horn', 'bat_(animal)', 'bath_mat', 'bath_towel',
  25. 'bathrobe', 'bathtub', 'batter_(food)', 'battery', 'beachball',
  26. 'bead', 'beaker', 'bean_curd', 'beanbag', 'beanie', 'bear', 'bed',
  27. 'bedspread', 'cow', 'beef_(food)', 'beeper', 'beer_bottle',
  28. 'beer_can', 'beetle', 'bell', 'bell_pepper', 'belt', 'belt_buckle',
  29. 'bench', 'beret', 'bib', 'Bible', 'bicycle', 'visor', 'binder',
  30. 'binoculars', 'bird', 'birdfeeder', 'birdbath', 'birdcage',
  31. 'birdhouse', 'birthday_cake', 'birthday_card', 'biscuit_(bread)',
  32. 'pirate_flag', 'black_sheep', 'blackboard', 'blanket', 'blazer',
  33. 'blender', 'blimp', 'blinker', 'blueberry', 'boar', 'gameboard',
  34. 'boat', 'bobbin', 'bobby_pin', 'boiled_egg', 'bolo_tie', 'deadbolt',
  35. 'bolt', 'bonnet', 'book', 'book_bag', 'bookcase', 'booklet',
  36. 'bookmark', 'boom_microphone', 'boot', 'bottle', 'bottle_opener',
  37. 'bouquet', 'bow_(weapon)', 'bow_(decorative_ribbons)', 'bow-tie',
  38. 'bowl', 'pipe_bowl', 'bowler_hat', 'bowling_ball', 'bowling_pin',
  39. 'boxing_glove', 'suspenders', 'bracelet', 'brass_plaque', 'brassiere',
  40. 'bread-bin', 'breechcloth', 'bridal_gown', 'briefcase',
  41. 'bristle_brush', 'broccoli', 'broach', 'broom', 'brownie',
  42. 'brussels_sprouts', 'bubble_gum', 'bucket', 'horse_buggy', 'bull',
  43. 'bulldog', 'bulldozer', 'bullet_train', 'bulletin_board',
  44. 'bulletproof_vest', 'bullhorn', 'corned_beef', 'bun', 'bunk_bed',
  45. 'buoy', 'burrito', 'bus_(vehicle)', 'business_card', 'butcher_knife',
  46. 'butter', 'butterfly', 'button', 'cab_(taxi)', 'cabana', 'cabin_car',
  47. 'cabinet', 'locker', 'cake', 'calculator', 'calendar', 'calf',
  48. 'camcorder', 'camel', 'camera', 'camera_lens', 'camper_(vehicle)',
  49. 'can', 'can_opener', 'candelabrum', 'candle', 'candle_holder',
  50. 'candy_bar', 'candy_cane', 'walking_cane', 'canister', 'cannon',
  51. 'canoe', 'cantaloup', 'canteen', 'cap_(headwear)', 'bottle_cap',
  52. 'cape', 'cappuccino', 'car_(automobile)', 'railcar_(part_of_a_train)',
  53. 'elevator_car', 'car_battery', 'identity_card', 'card', 'cardigan',
  54. 'cargo_ship', 'carnation', 'horse_carriage', 'carrot', 'tote_bag',
  55. 'cart', 'carton', 'cash_register', 'casserole', 'cassette', 'cast',
  56. 'cat', 'cauliflower', 'caviar', 'cayenne_(spice)', 'CD_player',
  57. 'celery', 'cellular_telephone', 'chain_mail', 'chair',
  58. 'chaise_longue', 'champagne', 'chandelier', 'chap', 'checkbook',
  59. 'checkerboard', 'cherry', 'chessboard',
  60. 'chest_of_drawers_(furniture)', 'chicken_(animal)', 'chicken_wire',
  61. 'chickpea', 'Chihuahua', 'chili_(vegetable)', 'chime', 'chinaware',
  62. 'crisp_(potato_chip)', 'poker_chip', 'chocolate_bar',
  63. 'chocolate_cake', 'chocolate_milk', 'chocolate_mousse', 'choker',
  64. 'chopping_board', 'chopstick', 'Christmas_tree', 'slide', 'cider',
  65. 'cigar_box', 'cigarette', 'cigarette_case', 'cistern', 'clarinet',
  66. 'clasp', 'cleansing_agent', 'clementine', 'clip', 'clipboard',
  67. 'clock', 'clock_tower', 'clothes_hamper', 'clothespin', 'clutch_bag',
  68. 'coaster', 'coat', 'coat_hanger', 'coatrack', 'cock', 'coconut',
  69. 'coffee_filter', 'coffee_maker', 'coffee_table', 'coffeepot', 'coil',
  70. 'coin', 'colander', 'coleslaw', 'coloring_material',
  71. 'combination_lock', 'pacifier', 'comic_book', 'computer_keyboard',
  72. 'concrete_mixer', 'cone', 'control', 'convertible_(automobile)',
  73. 'sofa_bed', 'cookie', 'cookie_jar', 'cooking_utensil',
  74. 'cooler_(for_food)', 'cork_(bottle_plug)', 'corkboard', 'corkscrew',
  75. 'edible_corn', 'cornbread', 'cornet', 'cornice', 'cornmeal', 'corset',
  76. 'romaine_lettuce', 'costume', 'cougar', 'coverall', 'cowbell',
  77. 'cowboy_hat', 'crab_(animal)', 'cracker', 'crape', 'crate', 'crayon',
  78. 'cream_pitcher', 'credit_card', 'crescent_roll', 'crib', 'crock_pot',
  79. 'crossbar', 'crouton', 'crow', 'crown', 'crucifix', 'cruise_ship',
  80. 'police_cruiser', 'crumb', 'crutch', 'cub_(animal)', 'cube',
  81. 'cucumber', 'cufflink', 'cup', 'trophy_cup', 'cupcake', 'hair_curler',
  82. 'curling_iron', 'curtain', 'cushion', 'custard', 'cutting_tool',
  83. 'cylinder', 'cymbal', 'dachshund', 'dagger', 'dartboard',
  84. 'date_(fruit)', 'deck_chair', 'deer', 'dental_floss', 'desk',
  85. 'detergent', 'diaper', 'diary', 'die', 'dinghy', 'dining_table',
  86. 'tux', 'dish', 'dish_antenna', 'dishrag', 'dishtowel', 'dishwasher',
  87. 'dishwasher_detergent', 'diskette', 'dispenser', 'Dixie_cup', 'dog',
  88. 'dog_collar', 'doll', 'dollar', 'dolphin', 'domestic_ass', 'eye_mask',
  89. 'doorbell', 'doorknob', 'doormat', 'doughnut', 'dove', 'dragonfly',
  90. 'drawer', 'underdrawers', 'dress', 'dress_hat', 'dress_suit',
  91. 'dresser', 'drill', 'drinking_fountain', 'drone', 'dropper',
  92. 'drum_(musical_instrument)', 'drumstick', 'duck', 'duckling',
  93. 'duct_tape', 'duffel_bag', 'dumbbell', 'dumpster', 'dustpan',
  94. 'Dutch_oven', 'eagle', 'earphone', 'earplug', 'earring', 'easel',
  95. 'eclair', 'eel', 'egg', 'egg_roll', 'egg_yolk', 'eggbeater',
  96. 'eggplant', 'electric_chair', 'refrigerator', 'elephant', 'elk',
  97. 'envelope', 'eraser', 'escargot', 'eyepatch', 'falcon', 'fan',
  98. 'faucet', 'fedora', 'ferret', 'Ferris_wheel', 'ferry', 'fig_(fruit)',
  99. 'fighter_jet', 'figurine', 'file_cabinet', 'file_(tool)',
  100. 'fire_alarm', 'fire_engine', 'fire_extinguisher', 'fire_hose',
  101. 'fireplace', 'fireplug', 'fish', 'fish_(food)', 'fishbowl',
  102. 'fishing_boat', 'fishing_rod', 'flag', 'flagpole', 'flamingo',
  103. 'flannel', 'flash', 'flashlight', 'fleece', 'flip-flop_(sandal)',
  104. 'flipper_(footwear)', 'flower_arrangement', 'flute_glass', 'foal',
  105. 'folding_chair', 'food_processor', 'football_(American)',
  106. 'football_helmet', 'footstool', 'fork', 'forklift', 'freight_car',
  107. 'French_toast', 'freshener', 'frisbee', 'frog', 'fruit_juice',
  108. 'fruit_salad', 'frying_pan', 'fudge', 'funnel', 'futon', 'gag',
  109. 'garbage', 'garbage_truck', 'garden_hose', 'gargle', 'gargoyle',
  110. 'garlic', 'gasmask', 'gazelle', 'gelatin', 'gemstone', 'giant_panda',
  111. 'gift_wrap', 'ginger', 'giraffe', 'cincture',
  112. 'glass_(drink_container)', 'globe', 'glove', 'goat', 'goggles',
  113. 'goldfish', 'golf_club', 'golfcart', 'gondola_(boat)', 'goose',
  114. 'gorilla', 'gourd', 'surgical_gown', 'grape', 'grasshopper', 'grater',
  115. 'gravestone', 'gravy_boat', 'green_bean', 'green_onion', 'griddle',
  116. 'grillroom', 'grinder_(tool)', 'grits', 'grizzly', 'grocery_bag',
  117. 'guacamole', 'guitar', 'gull', 'gun', 'hair_spray', 'hairbrush',
  118. 'hairnet', 'hairpin', 'ham', 'hamburger', 'hammer', 'hammock',
  119. 'hamper', 'hamster', 'hair_dryer', 'hand_glass', 'hand_towel',
  120. 'handcart', 'handcuff', 'handkerchief', 'handle', 'handsaw',
  121. 'hardback_book', 'harmonium', 'hat', 'hatbox', 'hatch', 'veil',
  122. 'headband', 'headboard', 'headlight', 'headscarf', 'headset',
  123. 'headstall_(for_horses)', 'hearing_aid', 'heart', 'heater',
  124. 'helicopter', 'helmet', 'heron', 'highchair', 'hinge', 'hippopotamus',
  125. 'hockey_stick', 'hog', 'home_plate_(baseball)', 'honey', 'fume_hood',
  126. 'hook', 'horse', 'hose', 'hot-air_balloon', 'hotplate', 'hot_sauce',
  127. 'hourglass', 'houseboat', 'hummingbird', 'hummus', 'polar_bear',
  128. 'icecream', 'popsicle', 'ice_maker', 'ice_pack', 'ice_skate',
  129. 'ice_tea', 'igniter', 'incense', 'inhaler', 'iPod',
  130. 'iron_(for_clothing)', 'ironing_board', 'jacket', 'jam', 'jean',
  131. 'jeep', 'jelly_bean', 'jersey', 'jet_plane', 'jewelry', 'joystick',
  132. 'jumpsuit', 'kayak', 'keg', 'kennel', 'kettle', 'key', 'keycard',
  133. 'kilt', 'kimono', 'kitchen_sink', 'kitchen_table', 'kite', 'kitten',
  134. 'kiwi_fruit', 'knee_pad', 'knife', 'knight_(chess_piece)',
  135. 'knitting_needle', 'knob', 'knocker_(on_a_door)', 'koala', 'lab_coat',
  136. 'ladder', 'ladle', 'ladybug', 'lamb_(animal)', 'lamb-chop', 'lamp',
  137. 'lamppost', 'lampshade', 'lantern', 'lanyard', 'laptop_computer',
  138. 'lasagna', 'latch', 'lawn_mower', 'leather', 'legging_(clothing)',
  139. 'Lego', 'lemon', 'lemonade', 'lettuce', 'license_plate', 'life_buoy',
  140. 'life_jacket', 'lightbulb', 'lightning_rod', 'lime', 'limousine',
  141. 'linen_paper', 'lion', 'lip_balm', 'lipstick', 'liquor', 'lizard',
  142. 'Loafer_(type_of_shoe)', 'log', 'lollipop', 'lotion',
  143. 'speaker_(stereo_equipment)', 'loveseat', 'machine_gun', 'magazine',
  144. 'magnet', 'mail_slot', 'mailbox_(at_home)', 'mallet', 'mammoth',
  145. 'mandarin_orange', 'manger', 'manhole', 'map', 'marker', 'martini',
  146. 'mascot', 'mashed_potato', 'masher', 'mask', 'mast',
  147. 'mat_(gym_equipment)', 'matchbox', 'mattress', 'measuring_cup',
  148. 'measuring_stick', 'meatball', 'medicine', 'melon', 'microphone',
  149. 'microscope', 'microwave_oven', 'milestone', 'milk', 'minivan',
  150. 'mint_candy', 'mirror', 'mitten', 'mixer_(kitchen_tool)', 'money',
  151. 'monitor_(computer_equipment) computer_monitor', 'monkey', 'motor',
  152. 'motor_scooter', 'motor_vehicle', 'motorboat', 'motorcycle',
  153. 'mound_(baseball)', 'mouse_(animal_rodent)',
  154. 'mouse_(computer_equipment)', 'mousepad', 'muffin', 'mug', 'mushroom',
  155. 'music_stool', 'musical_instrument', 'nailfile', 'nameplate',
  156. 'napkin', 'neckerchief', 'necklace', 'necktie', 'needle', 'nest',
  157. 'newsstand', 'nightshirt', 'nosebag_(for_animals)',
  158. 'noseband_(for_animals)', 'notebook', 'notepad', 'nut', 'nutcracker',
  159. 'oar', 'octopus_(food)', 'octopus_(animal)', 'oil_lamp', 'olive_oil',
  160. 'omelet', 'onion', 'orange_(fruit)', 'orange_juice', 'oregano',
  161. 'ostrich', 'ottoman', 'overalls_(clothing)', 'owl', 'packet',
  162. 'inkpad', 'pad', 'paddle', 'padlock', 'paintbox', 'paintbrush',
  163. 'painting', 'pajamas', 'palette', 'pan_(for_cooking)',
  164. 'pan_(metal_container)', 'pancake', 'pantyhose', 'papaya',
  165. 'paperclip', 'paper_plate', 'paper_towel', 'paperback_book',
  166. 'paperweight', 'parachute', 'parakeet', 'parasail_(sports)',
  167. 'parchment', 'parka', 'parking_meter', 'parrot',
  168. 'passenger_car_(part_of_a_train)', 'passenger_ship', 'passport',
  169. 'pastry', 'patty_(food)', 'pea_(food)', 'peach', 'peanut_butter',
  170. 'pear', 'peeler_(tool_for_fruit_and_vegetables)', 'pegboard',
  171. 'pelican', 'pen', 'pencil', 'pencil_box', 'pencil_sharpener',
  172. 'pendulum', 'penguin', 'pennant', 'penny_(coin)', 'pepper',
  173. 'pepper_mill', 'perfume', 'persimmon', 'baby', 'pet', 'petfood',
  174. 'pew_(church_bench)', 'phonebook', 'phonograph_record', 'piano',
  175. 'pickle', 'pickup_truck', 'pie', 'pigeon', 'piggy_bank', 'pillow',
  176. 'pin_(non_jewelry)', 'pineapple', 'pinecone', 'ping-pong_ball',
  177. 'pinwheel', 'tobacco_pipe', 'pipe', 'pistol', 'pita_(bread)',
  178. 'pitcher_(vessel_for_liquid)', 'pitchfork', 'pizza', 'place_mat',
  179. 'plate', 'platter', 'playing_card', 'playpen', 'pliers',
  180. 'plow_(farm_equipment)', 'pocket_watch', 'pocketknife',
  181. 'poker_(fire_stirring_tool)', 'pole', 'police_van', 'polo_shirt',
  182. 'poncho', 'pony', 'pool_table', 'pop_(soda)', 'portrait',
  183. 'postbox_(public)', 'postcard', 'poster', 'pot', 'flowerpot',
  184. 'potato', 'potholder', 'pottery', 'pouch', 'power_shovel', 'prawn',
  185. 'printer', 'projectile_(weapon)', 'projector', 'propeller', 'prune',
  186. 'pudding', 'puffer_(fish)', 'puffin', 'pug-dog', 'pumpkin', 'puncher',
  187. 'puppet', 'puppy', 'quesadilla', 'quiche', 'quilt', 'rabbit',
  188. 'race_car', 'racket', 'radar', 'radiator', 'radio_receiver', 'radish',
  189. 'raft', 'rag_doll', 'raincoat', 'ram_(animal)', 'raspberry', 'rat',
  190. 'razorblade', 'reamer_(juicer)', 'rearview_mirror', 'receipt',
  191. 'recliner', 'record_player', 'red_cabbage', 'reflector',
  192. 'remote_control', 'rhinoceros', 'rib_(food)', 'rifle', 'ring',
  193. 'river_boat', 'road_map', 'robe', 'rocking_chair', 'roller_skate',
  194. 'Rollerblade', 'rolling_pin', 'root_beer',
  195. 'router_(computer_equipment)', 'rubber_band', 'runner_(carpet)',
  196. 'plastic_bag', 'saddle_(on_an_animal)', 'saddle_blanket', 'saddlebag',
  197. 'safety_pin', 'sail', 'salad', 'salad_plate', 'salami',
  198. 'salmon_(fish)', 'salmon_(food)', 'salsa', 'saltshaker',
  199. 'sandal_(type_of_shoe)', 'sandwich', 'satchel', 'saucepan', 'saucer',
  200. 'sausage', 'sawhorse', 'saxophone', 'scale_(measuring_instrument)',
  201. 'scarecrow', 'scarf', 'school_bus', 'scissors', 'scoreboard',
  202. 'scrambled_eggs', 'scraper', 'scratcher', 'screwdriver',
  203. 'scrubbing_brush', 'sculpture', 'seabird', 'seahorse', 'seaplane',
  204. 'seashell', 'seedling', 'serving_dish', 'sewing_machine', 'shaker',
  205. 'shampoo', 'shark', 'sharpener', 'Sharpie', 'shaver_(electric)',
  206. 'shaving_cream', 'shawl', 'shears', 'sheep', 'shepherd_dog',
  207. 'sherbert', 'shield', 'shirt', 'shoe', 'shopping_bag',
  208. 'shopping_cart', 'short_pants', 'shot_glass', 'shoulder_bag',
  209. 'shovel', 'shower_head', 'shower_curtain', 'shredder_(for_paper)',
  210. 'sieve', 'signboard', 'silo', 'sink', 'skateboard', 'skewer', 'ski',
  211. 'ski_boot', 'ski_parka', 'ski_pole', 'skirt', 'sled', 'sleeping_bag',
  212. 'sling_(bandage)', 'slipper_(footwear)', 'smoothie', 'snake',
  213. 'snowboard', 'snowman', 'snowmobile', 'soap', 'soccer_ball', 'sock',
  214. 'soda_fountain', 'carbonated_water', 'sofa', 'softball',
  215. 'solar_array', 'sombrero', 'soup', 'soup_bowl', 'soupspoon',
  216. 'sour_cream', 'soya_milk', 'space_shuttle', 'sparkler_(fireworks)',
  217. 'spatula', 'spear', 'spectacles', 'spice_rack', 'spider', 'sponge',
  218. 'spoon', 'sportswear', 'spotlight', 'squirrel',
  219. 'stapler_(stapling_machine)', 'starfish', 'statue_(sculpture)',
  220. 'steak_(food)', 'steak_knife', 'steamer_(kitchen_appliance)',
  221. 'steering_wheel', 'stencil', 'stepladder', 'step_stool',
  222. 'stereo_(sound_system)', 'stew', 'stirrer', 'stirrup',
  223. 'stockings_(leg_wear)', 'stool', 'stop_sign', 'brake_light', 'stove',
  224. 'strainer', 'strap', 'straw_(for_drinking)', 'strawberry',
  225. 'street_sign', 'streetlight', 'string_cheese', 'stylus', 'subwoofer',
  226. 'sugar_bowl', 'sugarcane_(plant)', 'suit_(clothing)', 'sunflower',
  227. 'sunglasses', 'sunhat', 'sunscreen', 'surfboard', 'sushi', 'mop',
  228. 'sweat_pants', 'sweatband', 'sweater', 'sweatshirt', 'sweet_potato',
  229. 'swimsuit', 'sword', 'syringe', 'Tabasco_sauce', 'table-tennis_table',
  230. 'table', 'table_lamp', 'tablecloth', 'tachometer', 'taco', 'tag',
  231. 'taillight', 'tambourine', 'army_tank', 'tank_(storage_vessel)',
  232. 'tank_top_(clothing)', 'tape_(sticky_cloth_or_paper)', 'tape_measure',
  233. 'tapestry', 'tarp', 'tartan', 'tassel', 'tea_bag', 'teacup',
  234. 'teakettle', 'teapot', 'teddy_bear', 'telephone', 'telephone_booth',
  235. 'telephone_pole', 'telephoto_lens', 'television_camera',
  236. 'television_set', 'tennis_ball', 'tennis_racket', 'tequila',
  237. 'thermometer', 'thermos_bottle', 'thermostat', 'thimble', 'thread',
  238. 'thumbtack', 'tiara', 'tiger', 'tights_(clothing)', 'timer',
  239. 'tinfoil', 'tinsel', 'tissue_paper', 'toast_(food)', 'toaster',
  240. 'toaster_oven', 'toilet', 'toilet_tissue', 'tomato', 'tongs',
  241. 'toolbox', 'toothbrush', 'toothpaste', 'toothpick', 'cover',
  242. 'tortilla', 'tow_truck', 'towel', 'towel_rack', 'toy',
  243. 'tractor_(farm_equipment)', 'traffic_light', 'dirt_bike',
  244. 'trailer_truck', 'train_(railroad_vehicle)', 'trampoline', 'tray',
  245. 'tree_house', 'trench_coat', 'triangle_(musical_instrument)',
  246. 'tricycle', 'tripod', 'trousers', 'truck', 'truffle_(chocolate)',
  247. 'trunk', 'vat', 'turban', 'turkey_(bird)', 'turkey_(food)', 'turnip',
  248. 'turtle', 'turtleneck_(clothing)', 'typewriter', 'umbrella',
  249. 'underwear', 'unicycle', 'urinal', 'urn', 'vacuum_cleaner', 'valve',
  250. 'vase', 'vending_machine', 'vent', 'videotape', 'vinegar', 'violin',
  251. 'vodka', 'volleyball', 'vulture', 'waffle', 'waffle_iron', 'wagon',
  252. 'wagon_wheel', 'walking_stick', 'wall_clock', 'wall_socket', 'wallet',
  253. 'walrus', 'wardrobe', 'wasabi', 'automatic_washer', 'watch',
  254. 'water_bottle', 'water_cooler', 'water_faucet', 'water_filter',
  255. 'water_heater', 'water_jug', 'water_gun', 'water_scooter',
  256. 'water_ski', 'water_tower', 'watering_can', 'watermelon',
  257. 'weathervane', 'webcam', 'wedding_cake', 'wedding_ring', 'wet_suit',
  258. 'wheel', 'wheelchair', 'whipped_cream', 'whiskey', 'whistle', 'wick',
  259. 'wig', 'wind_chime', 'windmill', 'window_box_(for_plants)',
  260. 'windshield_wiper', 'windsock', 'wine_bottle', 'wine_bucket',
  261. 'wineglass', 'wing_chair', 'blinder_(for_horses)', 'wok', 'wolf',
  262. 'wooden_spoon', 'wreath', 'wrench', 'wristband', 'wristlet', 'yacht',
  263. 'yak', 'yogurt', 'yoke_(animal_equipment)', 'zebra', 'zucchini'),
  264. 'palette':
  265. None
  266. }
  267. def load_data_list(self) -> List[dict]:
  268. """Load annotations from an annotation file named as ``self.ann_file``
  269. Returns:
  270. List[dict]: A list of annotation.
  271. """ # noqa: E501
  272. try:
  273. import lvis
  274. if getattr(lvis, '__version__', '0') >= '10.5.3':
  275. warnings.warn(
  276. 'mmlvis is deprecated, please install official lvis-api by "pip install git+https://github.com/lvis-dataset/lvis-api.git"', # noqa: E501
  277. UserWarning)
  278. from lvis import LVIS
  279. except ImportError:
  280. raise ImportError(
  281. 'Package lvis is not installed. Please run "pip install git+https://github.com/lvis-dataset/lvis-api.git".' # noqa: E501
  282. )
  283. with get_local_path(
  284. self.ann_file, backend_args=self.backend_args) as local_path:
  285. self.lvis = LVIS(local_path)
  286. self.cat_ids = self.lvis.get_cat_ids()
  287. self.cat2label = {cat_id: i for i, cat_id in enumerate(self.cat_ids)}
  288. self.cat_img_map = copy.deepcopy(self.lvis.cat_img_map)
  289. img_ids = self.lvis.get_img_ids()
  290. data_list = []
  291. total_ann_ids = []
  292. for img_id in img_ids:
  293. raw_img_info = self.lvis.load_imgs([img_id])[0]
  294. raw_img_info['img_id'] = img_id
  295. if raw_img_info['file_name'].startswith('COCO'):
  296. # Convert form the COCO 2014 file naming convention of
  297. # COCO_[train/val/test]2014_000000000000.jpg to the 2017
  298. # naming convention of 000000000000.jpg
  299. # (LVIS v1 will fix this naming issue)
  300. raw_img_info['file_name'] = raw_img_info['file_name'][-16:]
  301. ann_ids = self.lvis.get_ann_ids(img_ids=[img_id])
  302. raw_ann_info = self.lvis.load_anns(ann_ids)
  303. total_ann_ids.extend(ann_ids)
  304. parsed_data_info = self.parse_data_info({
  305. 'raw_ann_info':
  306. raw_ann_info,
  307. 'raw_img_info':
  308. raw_img_info
  309. })
  310. data_list.append(parsed_data_info)
  311. if self.ANN_ID_UNIQUE:
  312. assert len(set(total_ann_ids)) == len(
  313. total_ann_ids
  314. ), f"Annotation ids in '{self.ann_file}' are not unique!"
  315. del self.lvis
  316. return data_list
  317. LVISDataset = LVISV05Dataset
  318. DATASETS.register_module(name='LVISDataset', module=LVISDataset)
  319. @DATASETS.register_module()
  320. class LVISV1Dataset(LVISDataset):
  321. """LVIS v1 dataset for detection."""
  322. METAINFO = {
  323. 'classes':
  324. ('aerosol_can', 'air_conditioner', 'airplane', 'alarm_clock',
  325. 'alcohol', 'alligator', 'almond', 'ambulance', 'amplifier', 'anklet',
  326. 'antenna', 'apple', 'applesauce', 'apricot', 'apron', 'aquarium',
  327. 'arctic_(type_of_shoe)', 'armband', 'armchair', 'armoire', 'armor',
  328. 'artichoke', 'trash_can', 'ashtray', 'asparagus', 'atomizer',
  329. 'avocado', 'award', 'awning', 'ax', 'baboon', 'baby_buggy',
  330. 'basketball_backboard', 'backpack', 'handbag', 'suitcase', 'bagel',
  331. 'bagpipe', 'baguet', 'bait', 'ball', 'ballet_skirt', 'balloon',
  332. 'bamboo', 'banana', 'Band_Aid', 'bandage', 'bandanna', 'banjo',
  333. 'banner', 'barbell', 'barge', 'barrel', 'barrette', 'barrow',
  334. 'baseball_base', 'baseball', 'baseball_bat', 'baseball_cap',
  335. 'baseball_glove', 'basket', 'basketball', 'bass_horn', 'bat_(animal)',
  336. 'bath_mat', 'bath_towel', 'bathrobe', 'bathtub', 'batter_(food)',
  337. 'battery', 'beachball', 'bead', 'bean_curd', 'beanbag', 'beanie',
  338. 'bear', 'bed', 'bedpan', 'bedspread', 'cow', 'beef_(food)', 'beeper',
  339. 'beer_bottle', 'beer_can', 'beetle', 'bell', 'bell_pepper', 'belt',
  340. 'belt_buckle', 'bench', 'beret', 'bib', 'Bible', 'bicycle', 'visor',
  341. 'billboard', 'binder', 'binoculars', 'bird', 'birdfeeder', 'birdbath',
  342. 'birdcage', 'birdhouse', 'birthday_cake', 'birthday_card',
  343. 'pirate_flag', 'black_sheep', 'blackberry', 'blackboard', 'blanket',
  344. 'blazer', 'blender', 'blimp', 'blinker', 'blouse', 'blueberry',
  345. 'gameboard', 'boat', 'bob', 'bobbin', 'bobby_pin', 'boiled_egg',
  346. 'bolo_tie', 'deadbolt', 'bolt', 'bonnet', 'book', 'bookcase',
  347. 'booklet', 'bookmark', 'boom_microphone', 'boot', 'bottle',
  348. 'bottle_opener', 'bouquet', 'bow_(weapon)',
  349. 'bow_(decorative_ribbons)', 'bow-tie', 'bowl', 'pipe_bowl',
  350. 'bowler_hat', 'bowling_ball', 'box', 'boxing_glove', 'suspenders',
  351. 'bracelet', 'brass_plaque', 'brassiere', 'bread-bin', 'bread',
  352. 'breechcloth', 'bridal_gown', 'briefcase', 'broccoli', 'broach',
  353. 'broom', 'brownie', 'brussels_sprouts', 'bubble_gum', 'bucket',
  354. 'horse_buggy', 'bull', 'bulldog', 'bulldozer', 'bullet_train',
  355. 'bulletin_board', 'bulletproof_vest', 'bullhorn', 'bun', 'bunk_bed',
  356. 'buoy', 'burrito', 'bus_(vehicle)', 'business_card', 'butter',
  357. 'butterfly', 'button', 'cab_(taxi)', 'cabana', 'cabin_car', 'cabinet',
  358. 'locker', 'cake', 'calculator', 'calendar', 'calf', 'camcorder',
  359. 'camel', 'camera', 'camera_lens', 'camper_(vehicle)', 'can',
  360. 'can_opener', 'candle', 'candle_holder', 'candy_bar', 'candy_cane',
  361. 'walking_cane', 'canister', 'canoe', 'cantaloup', 'canteen',
  362. 'cap_(headwear)', 'bottle_cap', 'cape', 'cappuccino',
  363. 'car_(automobile)', 'railcar_(part_of_a_train)', 'elevator_car',
  364. 'car_battery', 'identity_card', 'card', 'cardigan', 'cargo_ship',
  365. 'carnation', 'horse_carriage', 'carrot', 'tote_bag', 'cart', 'carton',
  366. 'cash_register', 'casserole', 'cassette', 'cast', 'cat',
  367. 'cauliflower', 'cayenne_(spice)', 'CD_player', 'celery',
  368. 'cellular_telephone', 'chain_mail', 'chair', 'chaise_longue',
  369. 'chalice', 'chandelier', 'chap', 'checkbook', 'checkerboard',
  370. 'cherry', 'chessboard', 'chicken_(animal)', 'chickpea',
  371. 'chili_(vegetable)', 'chime', 'chinaware', 'crisp_(potato_chip)',
  372. 'poker_chip', 'chocolate_bar', 'chocolate_cake', 'chocolate_milk',
  373. 'chocolate_mousse', 'choker', 'chopping_board', 'chopstick',
  374. 'Christmas_tree', 'slide', 'cider', 'cigar_box', 'cigarette',
  375. 'cigarette_case', 'cistern', 'clarinet', 'clasp', 'cleansing_agent',
  376. 'cleat_(for_securing_rope)', 'clementine', 'clip', 'clipboard',
  377. 'clippers_(for_plants)', 'cloak', 'clock', 'clock_tower',
  378. 'clothes_hamper', 'clothespin', 'clutch_bag', 'coaster', 'coat',
  379. 'coat_hanger', 'coatrack', 'cock', 'cockroach', 'cocoa_(beverage)',
  380. 'coconut', 'coffee_maker', 'coffee_table', 'coffeepot', 'coil',
  381. 'coin', 'colander', 'coleslaw', 'coloring_material',
  382. 'combination_lock', 'pacifier', 'comic_book', 'compass',
  383. 'computer_keyboard', 'condiment', 'cone', 'control',
  384. 'convertible_(automobile)', 'sofa_bed', 'cooker', 'cookie',
  385. 'cooking_utensil', 'cooler_(for_food)', 'cork_(bottle_plug)',
  386. 'corkboard', 'corkscrew', 'edible_corn', 'cornbread', 'cornet',
  387. 'cornice', 'cornmeal', 'corset', 'costume', 'cougar', 'coverall',
  388. 'cowbell', 'cowboy_hat', 'crab_(animal)', 'crabmeat', 'cracker',
  389. 'crape', 'crate', 'crayon', 'cream_pitcher', 'crescent_roll', 'crib',
  390. 'crock_pot', 'crossbar', 'crouton', 'crow', 'crowbar', 'crown',
  391. 'crucifix', 'cruise_ship', 'police_cruiser', 'crumb', 'crutch',
  392. 'cub_(animal)', 'cube', 'cucumber', 'cufflink', 'cup', 'trophy_cup',
  393. 'cupboard', 'cupcake', 'hair_curler', 'curling_iron', 'curtain',
  394. 'cushion', 'cylinder', 'cymbal', 'dagger', 'dalmatian', 'dartboard',
  395. 'date_(fruit)', 'deck_chair', 'deer', 'dental_floss', 'desk',
  396. 'detergent', 'diaper', 'diary', 'die', 'dinghy', 'dining_table',
  397. 'tux', 'dish', 'dish_antenna', 'dishrag', 'dishtowel', 'dishwasher',
  398. 'dishwasher_detergent', 'dispenser', 'diving_board', 'Dixie_cup',
  399. 'dog', 'dog_collar', 'doll', 'dollar', 'dollhouse', 'dolphin',
  400. 'domestic_ass', 'doorknob', 'doormat', 'doughnut', 'dove',
  401. 'dragonfly', 'drawer', 'underdrawers', 'dress', 'dress_hat',
  402. 'dress_suit', 'dresser', 'drill', 'drone', 'dropper',
  403. 'drum_(musical_instrument)', 'drumstick', 'duck', 'duckling',
  404. 'duct_tape', 'duffel_bag', 'dumbbell', 'dumpster', 'dustpan', 'eagle',
  405. 'earphone', 'earplug', 'earring', 'easel', 'eclair', 'eel', 'egg',
  406. 'egg_roll', 'egg_yolk', 'eggbeater', 'eggplant', 'electric_chair',
  407. 'refrigerator', 'elephant', 'elk', 'envelope', 'eraser', 'escargot',
  408. 'eyepatch', 'falcon', 'fan', 'faucet', 'fedora', 'ferret',
  409. 'Ferris_wheel', 'ferry', 'fig_(fruit)', 'fighter_jet', 'figurine',
  410. 'file_cabinet', 'file_(tool)', 'fire_alarm', 'fire_engine',
  411. 'fire_extinguisher', 'fire_hose', 'fireplace', 'fireplug',
  412. 'first-aid_kit', 'fish', 'fish_(food)', 'fishbowl', 'fishing_rod',
  413. 'flag', 'flagpole', 'flamingo', 'flannel', 'flap', 'flash',
  414. 'flashlight', 'fleece', 'flip-flop_(sandal)', 'flipper_(footwear)',
  415. 'flower_arrangement', 'flute_glass', 'foal', 'folding_chair',
  416. 'food_processor', 'football_(American)', 'football_helmet',
  417. 'footstool', 'fork', 'forklift', 'freight_car', 'French_toast',
  418. 'freshener', 'frisbee', 'frog', 'fruit_juice', 'frying_pan', 'fudge',
  419. 'funnel', 'futon', 'gag', 'garbage', 'garbage_truck', 'garden_hose',
  420. 'gargle', 'gargoyle', 'garlic', 'gasmask', 'gazelle', 'gelatin',
  421. 'gemstone', 'generator', 'giant_panda', 'gift_wrap', 'ginger',
  422. 'giraffe', 'cincture', 'glass_(drink_container)', 'globe', 'glove',
  423. 'goat', 'goggles', 'goldfish', 'golf_club', 'golfcart',
  424. 'gondola_(boat)', 'goose', 'gorilla', 'gourd', 'grape', 'grater',
  425. 'gravestone', 'gravy_boat', 'green_bean', 'green_onion', 'griddle',
  426. 'grill', 'grits', 'grizzly', 'grocery_bag', 'guitar', 'gull', 'gun',
  427. 'hairbrush', 'hairnet', 'hairpin', 'halter_top', 'ham', 'hamburger',
  428. 'hammer', 'hammock', 'hamper', 'hamster', 'hair_dryer', 'hand_glass',
  429. 'hand_towel', 'handcart', 'handcuff', 'handkerchief', 'handle',
  430. 'handsaw', 'hardback_book', 'harmonium', 'hat', 'hatbox', 'veil',
  431. 'headband', 'headboard', 'headlight', 'headscarf', 'headset',
  432. 'headstall_(for_horses)', 'heart', 'heater', 'helicopter', 'helmet',
  433. 'heron', 'highchair', 'hinge', 'hippopotamus', 'hockey_stick', 'hog',
  434. 'home_plate_(baseball)', 'honey', 'fume_hood', 'hook', 'hookah',
  435. 'hornet', 'horse', 'hose', 'hot-air_balloon', 'hotplate', 'hot_sauce',
  436. 'hourglass', 'houseboat', 'hummingbird', 'hummus', 'polar_bear',
  437. 'icecream', 'popsicle', 'ice_maker', 'ice_pack', 'ice_skate',
  438. 'igniter', 'inhaler', 'iPod', 'iron_(for_clothing)', 'ironing_board',
  439. 'jacket', 'jam', 'jar', 'jean', 'jeep', 'jelly_bean', 'jersey',
  440. 'jet_plane', 'jewel', 'jewelry', 'joystick', 'jumpsuit', 'kayak',
  441. 'keg', 'kennel', 'kettle', 'key', 'keycard', 'kilt', 'kimono',
  442. 'kitchen_sink', 'kitchen_table', 'kite', 'kitten', 'kiwi_fruit',
  443. 'knee_pad', 'knife', 'knitting_needle', 'knob', 'knocker_(on_a_door)',
  444. 'koala', 'lab_coat', 'ladder', 'ladle', 'ladybug', 'lamb_(animal)',
  445. 'lamb-chop', 'lamp', 'lamppost', 'lampshade', 'lantern', 'lanyard',
  446. 'laptop_computer', 'lasagna', 'latch', 'lawn_mower', 'leather',
  447. 'legging_(clothing)', 'Lego', 'legume', 'lemon', 'lemonade',
  448. 'lettuce', 'license_plate', 'life_buoy', 'life_jacket', 'lightbulb',
  449. 'lightning_rod', 'lime', 'limousine', 'lion', 'lip_balm', 'liquor',
  450. 'lizard', 'log', 'lollipop', 'speaker_(stereo_equipment)', 'loveseat',
  451. 'machine_gun', 'magazine', 'magnet', 'mail_slot', 'mailbox_(at_home)',
  452. 'mallard', 'mallet', 'mammoth', 'manatee', 'mandarin_orange',
  453. 'manger', 'manhole', 'map', 'marker', 'martini', 'mascot',
  454. 'mashed_potato', 'masher', 'mask', 'mast', 'mat_(gym_equipment)',
  455. 'matchbox', 'mattress', 'measuring_cup', 'measuring_stick',
  456. 'meatball', 'medicine', 'melon', 'microphone', 'microscope',
  457. 'microwave_oven', 'milestone', 'milk', 'milk_can', 'milkshake',
  458. 'minivan', 'mint_candy', 'mirror', 'mitten', 'mixer_(kitchen_tool)',
  459. 'money', 'monitor_(computer_equipment) computer_monitor', 'monkey',
  460. 'motor', 'motor_scooter', 'motor_vehicle', 'motorcycle',
  461. 'mound_(baseball)', 'mouse_(computer_equipment)', 'mousepad',
  462. 'muffin', 'mug', 'mushroom', 'music_stool', 'musical_instrument',
  463. 'nailfile', 'napkin', 'neckerchief', 'necklace', 'necktie', 'needle',
  464. 'nest', 'newspaper', 'newsstand', 'nightshirt',
  465. 'nosebag_(for_animals)', 'noseband_(for_animals)', 'notebook',
  466. 'notepad', 'nut', 'nutcracker', 'oar', 'octopus_(food)',
  467. 'octopus_(animal)', 'oil_lamp', 'olive_oil', 'omelet', 'onion',
  468. 'orange_(fruit)', 'orange_juice', 'ostrich', 'ottoman', 'oven',
  469. 'overalls_(clothing)', 'owl', 'packet', 'inkpad', 'pad', 'paddle',
  470. 'padlock', 'paintbrush', 'painting', 'pajamas', 'palette',
  471. 'pan_(for_cooking)', 'pan_(metal_container)', 'pancake', 'pantyhose',
  472. 'papaya', 'paper_plate', 'paper_towel', 'paperback_book',
  473. 'paperweight', 'parachute', 'parakeet', 'parasail_(sports)',
  474. 'parasol', 'parchment', 'parka', 'parking_meter', 'parrot',
  475. 'passenger_car_(part_of_a_train)', 'passenger_ship', 'passport',
  476. 'pastry', 'patty_(food)', 'pea_(food)', 'peach', 'peanut_butter',
  477. 'pear', 'peeler_(tool_for_fruit_and_vegetables)', 'wooden_leg',
  478. 'pegboard', 'pelican', 'pen', 'pencil', 'pencil_box',
  479. 'pencil_sharpener', 'pendulum', 'penguin', 'pennant', 'penny_(coin)',
  480. 'pepper', 'pepper_mill', 'perfume', 'persimmon', 'person', 'pet',
  481. 'pew_(church_bench)', 'phonebook', 'phonograph_record', 'piano',
  482. 'pickle', 'pickup_truck', 'pie', 'pigeon', 'piggy_bank', 'pillow',
  483. 'pin_(non_jewelry)', 'pineapple', 'pinecone', 'ping-pong_ball',
  484. 'pinwheel', 'tobacco_pipe', 'pipe', 'pistol', 'pita_(bread)',
  485. 'pitcher_(vessel_for_liquid)', 'pitchfork', 'pizza', 'place_mat',
  486. 'plate', 'platter', 'playpen', 'pliers', 'plow_(farm_equipment)',
  487. 'plume', 'pocket_watch', 'pocketknife', 'poker_(fire_stirring_tool)',
  488. 'pole', 'polo_shirt', 'poncho', 'pony', 'pool_table', 'pop_(soda)',
  489. 'postbox_(public)', 'postcard', 'poster', 'pot', 'flowerpot',
  490. 'potato', 'potholder', 'pottery', 'pouch', 'power_shovel', 'prawn',
  491. 'pretzel', 'printer', 'projectile_(weapon)', 'projector', 'propeller',
  492. 'prune', 'pudding', 'puffer_(fish)', 'puffin', 'pug-dog', 'pumpkin',
  493. 'puncher', 'puppet', 'puppy', 'quesadilla', 'quiche', 'quilt',
  494. 'rabbit', 'race_car', 'racket', 'radar', 'radiator', 'radio_receiver',
  495. 'radish', 'raft', 'rag_doll', 'raincoat', 'ram_(animal)', 'raspberry',
  496. 'rat', 'razorblade', 'reamer_(juicer)', 'rearview_mirror', 'receipt',
  497. 'recliner', 'record_player', 'reflector', 'remote_control',
  498. 'rhinoceros', 'rib_(food)', 'rifle', 'ring', 'river_boat', 'road_map',
  499. 'robe', 'rocking_chair', 'rodent', 'roller_skate', 'Rollerblade',
  500. 'rolling_pin', 'root_beer', 'router_(computer_equipment)',
  501. 'rubber_band', 'runner_(carpet)', 'plastic_bag',
  502. 'saddle_(on_an_animal)', 'saddle_blanket', 'saddlebag', 'safety_pin',
  503. 'sail', 'salad', 'salad_plate', 'salami', 'salmon_(fish)',
  504. 'salmon_(food)', 'salsa', 'saltshaker', 'sandal_(type_of_shoe)',
  505. 'sandwich', 'satchel', 'saucepan', 'saucer', 'sausage', 'sawhorse',
  506. 'saxophone', 'scale_(measuring_instrument)', 'scarecrow', 'scarf',
  507. 'school_bus', 'scissors', 'scoreboard', 'scraper', 'screwdriver',
  508. 'scrubbing_brush', 'sculpture', 'seabird', 'seahorse', 'seaplane',
  509. 'seashell', 'sewing_machine', 'shaker', 'shampoo', 'shark',
  510. 'sharpener', 'Sharpie', 'shaver_(electric)', 'shaving_cream', 'shawl',
  511. 'shears', 'sheep', 'shepherd_dog', 'sherbert', 'shield', 'shirt',
  512. 'shoe', 'shopping_bag', 'shopping_cart', 'short_pants', 'shot_glass',
  513. 'shoulder_bag', 'shovel', 'shower_head', 'shower_cap',
  514. 'shower_curtain', 'shredder_(for_paper)', 'signboard', 'silo', 'sink',
  515. 'skateboard', 'skewer', 'ski', 'ski_boot', 'ski_parka', 'ski_pole',
  516. 'skirt', 'skullcap', 'sled', 'sleeping_bag', 'sling_(bandage)',
  517. 'slipper_(footwear)', 'smoothie', 'snake', 'snowboard', 'snowman',
  518. 'snowmobile', 'soap', 'soccer_ball', 'sock', 'sofa', 'softball',
  519. 'solar_array', 'sombrero', 'soup', 'soup_bowl', 'soupspoon',
  520. 'sour_cream', 'soya_milk', 'space_shuttle', 'sparkler_(fireworks)',
  521. 'spatula', 'spear', 'spectacles', 'spice_rack', 'spider', 'crawfish',
  522. 'sponge', 'spoon', 'sportswear', 'spotlight', 'squid_(food)',
  523. 'squirrel', 'stagecoach', 'stapler_(stapling_machine)', 'starfish',
  524. 'statue_(sculpture)', 'steak_(food)', 'steak_knife', 'steering_wheel',
  525. 'stepladder', 'step_stool', 'stereo_(sound_system)', 'stew',
  526. 'stirrer', 'stirrup', 'stool', 'stop_sign', 'brake_light', 'stove',
  527. 'strainer', 'strap', 'straw_(for_drinking)', 'strawberry',
  528. 'street_sign', 'streetlight', 'string_cheese', 'stylus', 'subwoofer',
  529. 'sugar_bowl', 'sugarcane_(plant)', 'suit_(clothing)', 'sunflower',
  530. 'sunglasses', 'sunhat', 'surfboard', 'sushi', 'mop', 'sweat_pants',
  531. 'sweatband', 'sweater', 'sweatshirt', 'sweet_potato', 'swimsuit',
  532. 'sword', 'syringe', 'Tabasco_sauce', 'table-tennis_table', 'table',
  533. 'table_lamp', 'tablecloth', 'tachometer', 'taco', 'tag', 'taillight',
  534. 'tambourine', 'army_tank', 'tank_(storage_vessel)',
  535. 'tank_top_(clothing)', 'tape_(sticky_cloth_or_paper)', 'tape_measure',
  536. 'tapestry', 'tarp', 'tartan', 'tassel', 'tea_bag', 'teacup',
  537. 'teakettle', 'teapot', 'teddy_bear', 'telephone', 'telephone_booth',
  538. 'telephone_pole', 'telephoto_lens', 'television_camera',
  539. 'television_set', 'tennis_ball', 'tennis_racket', 'tequila',
  540. 'thermometer', 'thermos_bottle', 'thermostat', 'thimble', 'thread',
  541. 'thumbtack', 'tiara', 'tiger', 'tights_(clothing)', 'timer',
  542. 'tinfoil', 'tinsel', 'tissue_paper', 'toast_(food)', 'toaster',
  543. 'toaster_oven', 'toilet', 'toilet_tissue', 'tomato', 'tongs',
  544. 'toolbox', 'toothbrush', 'toothpaste', 'toothpick', 'cover',
  545. 'tortilla', 'tow_truck', 'towel', 'towel_rack', 'toy',
  546. 'tractor_(farm_equipment)', 'traffic_light', 'dirt_bike',
  547. 'trailer_truck', 'train_(railroad_vehicle)', 'trampoline', 'tray',
  548. 'trench_coat', 'triangle_(musical_instrument)', 'tricycle', 'tripod',
  549. 'trousers', 'truck', 'truffle_(chocolate)', 'trunk', 'vat', 'turban',
  550. 'turkey_(food)', 'turnip', 'turtle', 'turtleneck_(clothing)',
  551. 'typewriter', 'umbrella', 'underwear', 'unicycle', 'urinal', 'urn',
  552. 'vacuum_cleaner', 'vase', 'vending_machine', 'vent', 'vest',
  553. 'videotape', 'vinegar', 'violin', 'vodka', 'volleyball', 'vulture',
  554. 'waffle', 'waffle_iron', 'wagon', 'wagon_wheel', 'walking_stick',
  555. 'wall_clock', 'wall_socket', 'wallet', 'walrus', 'wardrobe',
  556. 'washbasin', 'automatic_washer', 'watch', 'water_bottle',
  557. 'water_cooler', 'water_faucet', 'water_heater', 'water_jug',
  558. 'water_gun', 'water_scooter', 'water_ski', 'water_tower',
  559. 'watering_can', 'watermelon', 'weathervane', 'webcam', 'wedding_cake',
  560. 'wedding_ring', 'wet_suit', 'wheel', 'wheelchair', 'whipped_cream',
  561. 'whistle', 'wig', 'wind_chime', 'windmill', 'window_box_(for_plants)',
  562. 'windshield_wiper', 'windsock', 'wine_bottle', 'wine_bucket',
  563. 'wineglass', 'blinder_(for_horses)', 'wok', 'wolf', 'wooden_spoon',
  564. 'wreath', 'wrench', 'wristband', 'wristlet', 'yacht', 'yogurt',
  565. 'yoke_(animal_equipment)', 'zebra', 'zucchini'),
  566. 'palette':
  567. None
  568. }
  569. def load_data_list(self) -> List[dict]:
  570. """Load annotations from an annotation file named as ``self.ann_file``
  571. Returns:
  572. List[dict]: A list of annotation.
  573. """ # noqa: E501
  574. try:
  575. import lvis
  576. if getattr(lvis, '__version__', '0') >= '10.5.3':
  577. warnings.warn(
  578. 'mmlvis is deprecated, please install official lvis-api by "pip install git+https://github.com/lvis-dataset/lvis-api.git"', # noqa: E501
  579. UserWarning)
  580. from lvis import LVIS
  581. except ImportError:
  582. raise ImportError(
  583. 'Package lvis is not installed. Please run "pip install git+https://github.com/lvis-dataset/lvis-api.git".' # noqa: E501
  584. )
  585. with get_local_path(
  586. self.ann_file, backend_args=self.backend_args) as local_path:
  587. self.lvis = LVIS(local_path)
  588. self.cat_ids = self.lvis.get_cat_ids()
  589. self.cat2label = {cat_id: i for i, cat_id in enumerate(self.cat_ids)}
  590. self.cat_img_map = copy.deepcopy(self.lvis.cat_img_map)
  591. img_ids = self.lvis.get_img_ids()
  592. data_list = []
  593. total_ann_ids = []
  594. for img_id in img_ids:
  595. raw_img_info = self.lvis.load_imgs([img_id])[0]
  596. raw_img_info['img_id'] = img_id
  597. # coco_url is used in LVISv1 instead of file_name
  598. # e.g. http://images.cocodataset.org/train2017/000000391895.jpg
  599. # train/val split in specified in url
  600. raw_img_info['file_name'] = raw_img_info['coco_url'].replace(
  601. 'http://images.cocodataset.org/', '')
  602. ann_ids = self.lvis.get_ann_ids(img_ids=[img_id])
  603. raw_ann_info = self.lvis.load_anns(ann_ids)
  604. total_ann_ids.extend(ann_ids)
  605. parsed_data_info = self.parse_data_info({
  606. 'raw_ann_info':
  607. raw_ann_info,
  608. 'raw_img_info':
  609. raw_img_info
  610. })
  611. data_list.append(parsed_data_info)
  612. if self.ANN_ID_UNIQUE:
  613. assert len(set(total_ann_ids)) == len(
  614. total_ann_ids
  615. ), f"Annotation ids in '{self.ann_file}' are not unique!"
  616. del self.lvis
  617. return data_list