category.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. from __future__ import absolute_import
  15. from __future__ import division
  16. from __future__ import print_function
  17. import os
  18. from paddlex.ppdet.data.source.voc import pascalvoc_label
  19. from paddlex.ppdet.data.source.widerface import widerface_label
  20. from paddlex.ppdet.utils.logger import setup_logger
  21. logger = setup_logger(__name__)
  22. __all__ = ['get_categories']
  23. def get_categories(metric_type, anno_file=None, arch=None):
  24. """
  25. Get class id to category id map and category id
  26. to category name map from annotation file.
  27. Args:
  28. metric_type (str): metric type, currently support 'coco', 'voc', 'oid'
  29. and 'widerface'.
  30. anno_file (str): annotation file path
  31. """
  32. if arch == 'keypoint_arch':
  33. return (None, {'id': 'keypoint'})
  34. if metric_type.lower() == 'coco' or metric_type.lower(
  35. ) == 'rbox' or metric_type.lower() == 'snipercoco':
  36. if anno_file and os.path.isfile(anno_file):
  37. # lazy import pycocotools here
  38. from pycocotools.coco import COCO
  39. coco = COCO(anno_file)
  40. cats = coco.loadCats(coco.getCatIds())
  41. clsid2catid = {i: cat['id'] for i, cat in enumerate(cats)}
  42. catid2name = {cat['id']: cat['name'] for cat in cats}
  43. return clsid2catid, catid2name
  44. # anno file not exist, load default categories of COCO17
  45. else:
  46. if metric_type.lower() == 'rbox':
  47. return _dota_category()
  48. return _coco17_category()
  49. elif metric_type.lower() == 'voc':
  50. if anno_file and os.path.isfile(anno_file):
  51. cats = []
  52. with open(anno_file) as f:
  53. for line in f.readlines():
  54. cats.append(line.strip())
  55. if cats[0] == 'background':
  56. cats = cats[1:]
  57. clsid2catid = {i: i for i in range(len(cats))}
  58. catid2name = {i: name for i, name in enumerate(cats)}
  59. return clsid2catid, catid2name
  60. # anno file not exist, load default categories of
  61. # VOC all 20 categories
  62. else:
  63. return _vocall_category()
  64. elif metric_type.lower() == 'oid':
  65. if anno_file and os.path.isfile(anno_file):
  66. logger.warning("only default categories support for OID19")
  67. return _oid19_category()
  68. elif metric_type.lower() == 'widerface':
  69. return _widerface_category()
  70. elif metric_type.lower() == 'keypointtopdowncocoeval' or metric_type.lower(
  71. ) == 'keypointtopdownmpiieval':
  72. return (None, {'id': 'keypoint'})
  73. elif metric_type.lower() in ['mot', 'motdet', 'reid']:
  74. if anno_file and os.path.isfile(anno_file):
  75. cats = []
  76. with open(anno_file) as f:
  77. for line in f.readlines():
  78. cats.append(line.strip())
  79. if cats[0] == 'background':
  80. cats = cats[1:]
  81. clsid2catid = {i: i for i in range(len(cats))}
  82. catid2name = {i: name for i, name in enumerate(cats)}
  83. return clsid2catid, catid2name
  84. # anno file not exist, load default category 'pedestrian'.
  85. else:
  86. return _mot_category(category='pedestrian')
  87. elif metric_type.lower() in ['kitti', 'bdd100kmot']:
  88. return _mot_category(category='vehicle')
  89. elif metric_type.lower() in ['mcmot']:
  90. if anno_file and os.path.isfile(anno_file):
  91. cats = []
  92. with open(anno_file) as f:
  93. for line in f.readlines():
  94. cats.append(line.strip())
  95. if cats[0] == 'background':
  96. cats = cats[1:]
  97. clsid2catid = {i: i for i in range(len(cats))}
  98. catid2name = {i: name for i, name in enumerate(cats)}
  99. return clsid2catid, catid2name
  100. # anno file not exist, load default categories of visdrone all 10 categories
  101. else:
  102. return _visdrone_category()
  103. else:
  104. raise ValueError("unknown metric type {}".format(metric_type))
  105. def _mot_category(category='pedestrian'):
  106. """
  107. Get class id to category id map and category id
  108. to category name map of mot dataset
  109. """
  110. label_map = {category: 0}
  111. label_map = sorted(label_map.items(), key=lambda x: x[1])
  112. cats = [l[0] for l in label_map]
  113. clsid2catid = {i: i for i in range(len(cats))}
  114. catid2name = {i: name for i, name in enumerate(cats)}
  115. return clsid2catid, catid2name
  116. def _coco17_category():
  117. """
  118. Get class id to category id map and category id
  119. to category name map of COCO2017 dataset
  120. """
  121. clsid2catid = {
  122. 1: 1,
  123. 2: 2,
  124. 3: 3,
  125. 4: 4,
  126. 5: 5,
  127. 6: 6,
  128. 7: 7,
  129. 8: 8,
  130. 9: 9,
  131. 10: 10,
  132. 11: 11,
  133. 12: 13,
  134. 13: 14,
  135. 14: 15,
  136. 15: 16,
  137. 16: 17,
  138. 17: 18,
  139. 18: 19,
  140. 19: 20,
  141. 20: 21,
  142. 21: 22,
  143. 22: 23,
  144. 23: 24,
  145. 24: 25,
  146. 25: 27,
  147. 26: 28,
  148. 27: 31,
  149. 28: 32,
  150. 29: 33,
  151. 30: 34,
  152. 31: 35,
  153. 32: 36,
  154. 33: 37,
  155. 34: 38,
  156. 35: 39,
  157. 36: 40,
  158. 37: 41,
  159. 38: 42,
  160. 39: 43,
  161. 40: 44,
  162. 41: 46,
  163. 42: 47,
  164. 43: 48,
  165. 44: 49,
  166. 45: 50,
  167. 46: 51,
  168. 47: 52,
  169. 48: 53,
  170. 49: 54,
  171. 50: 55,
  172. 51: 56,
  173. 52: 57,
  174. 53: 58,
  175. 54: 59,
  176. 55: 60,
  177. 56: 61,
  178. 57: 62,
  179. 58: 63,
  180. 59: 64,
  181. 60: 65,
  182. 61: 67,
  183. 62: 70,
  184. 63: 72,
  185. 64: 73,
  186. 65: 74,
  187. 66: 75,
  188. 67: 76,
  189. 68: 77,
  190. 69: 78,
  191. 70: 79,
  192. 71: 80,
  193. 72: 81,
  194. 73: 82,
  195. 74: 84,
  196. 75: 85,
  197. 76: 86,
  198. 77: 87,
  199. 78: 88,
  200. 79: 89,
  201. 80: 90
  202. }
  203. catid2name = {
  204. 0: 'background',
  205. 1: 'person',
  206. 2: 'bicycle',
  207. 3: 'car',
  208. 4: 'motorcycle',
  209. 5: 'airplane',
  210. 6: 'bus',
  211. 7: 'train',
  212. 8: 'truck',
  213. 9: 'boat',
  214. 10: 'traffic light',
  215. 11: 'fire hydrant',
  216. 13: 'stop sign',
  217. 14: 'parking meter',
  218. 15: 'bench',
  219. 16: 'bird',
  220. 17: 'cat',
  221. 18: 'dog',
  222. 19: 'horse',
  223. 20: 'sheep',
  224. 21: 'cow',
  225. 22: 'elephant',
  226. 23: 'bear',
  227. 24: 'zebra',
  228. 25: 'giraffe',
  229. 27: 'backpack',
  230. 28: 'umbrella',
  231. 31: 'handbag',
  232. 32: 'tie',
  233. 33: 'suitcase',
  234. 34: 'frisbee',
  235. 35: 'skis',
  236. 36: 'snowboard',
  237. 37: 'sports ball',
  238. 38: 'kite',
  239. 39: 'baseball bat',
  240. 40: 'baseball glove',
  241. 41: 'skateboard',
  242. 42: 'surfboard',
  243. 43: 'tennis racket',
  244. 44: 'bottle',
  245. 46: 'wine glass',
  246. 47: 'cup',
  247. 48: 'fork',
  248. 49: 'knife',
  249. 50: 'spoon',
  250. 51: 'bowl',
  251. 52: 'banana',
  252. 53: 'apple',
  253. 54: 'sandwich',
  254. 55: 'orange',
  255. 56: 'broccoli',
  256. 57: 'carrot',
  257. 58: 'hot dog',
  258. 59: 'pizza',
  259. 60: 'donut',
  260. 61: 'cake',
  261. 62: 'chair',
  262. 63: 'couch',
  263. 64: 'potted plant',
  264. 65: 'bed',
  265. 67: 'dining table',
  266. 70: 'toilet',
  267. 72: 'tv',
  268. 73: 'laptop',
  269. 74: 'mouse',
  270. 75: 'remote',
  271. 76: 'keyboard',
  272. 77: 'cell phone',
  273. 78: 'microwave',
  274. 79: 'oven',
  275. 80: 'toaster',
  276. 81: 'sink',
  277. 82: 'refrigerator',
  278. 84: 'book',
  279. 85: 'clock',
  280. 86: 'vase',
  281. 87: 'scissors',
  282. 88: 'teddy bear',
  283. 89: 'hair drier',
  284. 90: 'toothbrush'
  285. }
  286. clsid2catid = {k - 1: v for k, v in clsid2catid.items()}
  287. catid2name.pop(0)
  288. return clsid2catid, catid2name
  289. def _dota_category():
  290. """
  291. Get class id to category id map and category id
  292. to category name map of dota dataset
  293. """
  294. catid2name = {
  295. 0: 'background',
  296. 1: 'plane',
  297. 2: 'baseball-diamond',
  298. 3: 'bridge',
  299. 4: 'ground-track-field',
  300. 5: 'small-vehicle',
  301. 6: 'large-vehicle',
  302. 7: 'ship',
  303. 8: 'tennis-court',
  304. 9: 'basketball-court',
  305. 10: 'storage-tank',
  306. 11: 'soccer-ball-field',
  307. 12: 'roundabout',
  308. 13: 'harbor',
  309. 14: 'swimming-pool',
  310. 15: 'helicopter'
  311. }
  312. catid2name.pop(0)
  313. clsid2catid = {i: i + 1 for i in range(len(catid2name))}
  314. return clsid2catid, catid2name
  315. def _vocall_category():
  316. """
  317. Get class id to category id map and category id
  318. to category name map of mixup voc dataset
  319. """
  320. label_map = pascalvoc_label()
  321. label_map = sorted(label_map.items(), key=lambda x: x[1])
  322. cats = [l[0] for l in label_map]
  323. clsid2catid = {i: i for i in range(len(cats))}
  324. catid2name = {i: name for i, name in enumerate(cats)}
  325. return clsid2catid, catid2name
  326. def _widerface_category():
  327. label_map = widerface_label()
  328. label_map = sorted(label_map.items(), key=lambda x: x[1])
  329. cats = [l[0] for l in label_map]
  330. clsid2catid = {i: i for i in range(len(cats))}
  331. catid2name = {i: name for i, name in enumerate(cats)}
  332. return clsid2catid, catid2name
  333. def _oid19_category():
  334. clsid2catid = {k: k + 1 for k in range(500)}
  335. catid2name = {
  336. 0: "background",
  337. 1: "Infant bed",
  338. 2: "Rose",
  339. 3: "Flag",
  340. 4: "Flashlight",
  341. 5: "Sea turtle",
  342. 6: "Camera",
  343. 7: "Animal",
  344. 8: "Glove",
  345. 9: "Crocodile",
  346. 10: "Cattle",
  347. 11: "House",
  348. 12: "Guacamole",
  349. 13: "Penguin",
  350. 14: "Vehicle registration plate",
  351. 15: "Bench",
  352. 16: "Ladybug",
  353. 17: "Human nose",
  354. 18: "Watermelon",
  355. 19: "Flute",
  356. 20: "Butterfly",
  357. 21: "Washing machine",
  358. 22: "Raccoon",
  359. 23: "Segway",
  360. 24: "Taco",
  361. 25: "Jellyfish",
  362. 26: "Cake",
  363. 27: "Pen",
  364. 28: "Cannon",
  365. 29: "Bread",
  366. 30: "Tree",
  367. 31: "Shellfish",
  368. 32: "Bed",
  369. 33: "Hamster",
  370. 34: "Hat",
  371. 35: "Toaster",
  372. 36: "Sombrero",
  373. 37: "Tiara",
  374. 38: "Bowl",
  375. 39: "Dragonfly",
  376. 40: "Moths and butterflies",
  377. 41: "Antelope",
  378. 42: "Vegetable",
  379. 43: "Torch",
  380. 44: "Building",
  381. 45: "Power plugs and sockets",
  382. 46: "Blender",
  383. 47: "Billiard table",
  384. 48: "Cutting board",
  385. 49: "Bronze sculpture",
  386. 50: "Turtle",
  387. 51: "Broccoli",
  388. 52: "Tiger",
  389. 53: "Mirror",
  390. 54: "Bear",
  391. 55: "Zucchini",
  392. 56: "Dress",
  393. 57: "Volleyball",
  394. 58: "Guitar",
  395. 59: "Reptile",
  396. 60: "Golf cart",
  397. 61: "Tart",
  398. 62: "Fedora",
  399. 63: "Carnivore",
  400. 64: "Car",
  401. 65: "Lighthouse",
  402. 66: "Coffeemaker",
  403. 67: "Food processor",
  404. 68: "Truck",
  405. 69: "Bookcase",
  406. 70: "Surfboard",
  407. 71: "Footwear",
  408. 72: "Bench",
  409. 73: "Necklace",
  410. 74: "Flower",
  411. 75: "Radish",
  412. 76: "Marine mammal",
  413. 77: "Frying pan",
  414. 78: "Tap",
  415. 79: "Peach",
  416. 80: "Knife",
  417. 81: "Handbag",
  418. 82: "Laptop",
  419. 83: "Tent",
  420. 84: "Ambulance",
  421. 85: "Christmas tree",
  422. 86: "Eagle",
  423. 87: "Limousine",
  424. 88: "Kitchen & dining room table",
  425. 89: "Polar bear",
  426. 90: "Tower",
  427. 91: "Football",
  428. 92: "Willow",
  429. 93: "Human head",
  430. 94: "Stop sign",
  431. 95: "Banana",
  432. 96: "Mixer",
  433. 97: "Binoculars",
  434. 98: "Dessert",
  435. 99: "Bee",
  436. 100: "Chair",
  437. 101: "Wood-burning stove",
  438. 102: "Flowerpot",
  439. 103: "Beaker",
  440. 104: "Oyster",
  441. 105: "Woodpecker",
  442. 106: "Harp",
  443. 107: "Bathtub",
  444. 108: "Wall clock",
  445. 109: "Sports uniform",
  446. 110: "Rhinoceros",
  447. 111: "Beehive",
  448. 112: "Cupboard",
  449. 113: "Chicken",
  450. 114: "Man",
  451. 115: "Blue jay",
  452. 116: "Cucumber",
  453. 117: "Balloon",
  454. 118: "Kite",
  455. 119: "Fireplace",
  456. 120: "Lantern",
  457. 121: "Missile",
  458. 122: "Book",
  459. 123: "Spoon",
  460. 124: "Grapefruit",
  461. 125: "Squirrel",
  462. 126: "Orange",
  463. 127: "Coat",
  464. 128: "Punching bag",
  465. 129: "Zebra",
  466. 130: "Billboard",
  467. 131: "Bicycle",
  468. 132: "Door handle",
  469. 133: "Mechanical fan",
  470. 134: "Ring binder",
  471. 135: "Table",
  472. 136: "Parrot",
  473. 137: "Sock",
  474. 138: "Vase",
  475. 139: "Weapon",
  476. 140: "Shotgun",
  477. 141: "Glasses",
  478. 142: "Seahorse",
  479. 143: "Belt",
  480. 144: "Watercraft",
  481. 145: "Window",
  482. 146: "Giraffe",
  483. 147: "Lion",
  484. 148: "Tire",
  485. 149: "Vehicle",
  486. 150: "Canoe",
  487. 151: "Tie",
  488. 152: "Shelf",
  489. 153: "Picture frame",
  490. 154: "Printer",
  491. 155: "Human leg",
  492. 156: "Boat",
  493. 157: "Slow cooker",
  494. 158: "Croissant",
  495. 159: "Candle",
  496. 160: "Pancake",
  497. 161: "Pillow",
  498. 162: "Coin",
  499. 163: "Stretcher",
  500. 164: "Sandal",
  501. 165: "Woman",
  502. 166: "Stairs",
  503. 167: "Harpsichord",
  504. 168: "Stool",
  505. 169: "Bus",
  506. 170: "Suitcase",
  507. 171: "Human mouth",
  508. 172: "Juice",
  509. 173: "Skull",
  510. 174: "Door",
  511. 175: "Violin",
  512. 176: "Chopsticks",
  513. 177: "Digital clock",
  514. 178: "Sunflower",
  515. 179: "Leopard",
  516. 180: "Bell pepper",
  517. 181: "Harbor seal",
  518. 182: "Snake",
  519. 183: "Sewing machine",
  520. 184: "Goose",
  521. 185: "Helicopter",
  522. 186: "Seat belt",
  523. 187: "Coffee cup",
  524. 188: "Microwave oven",
  525. 189: "Hot dog",
  526. 190: "Countertop",
  527. 191: "Serving tray",
  528. 192: "Dog bed",
  529. 193: "Beer",
  530. 194: "Sunglasses",
  531. 195: "Golf ball",
  532. 196: "Waffle",
  533. 197: "Palm tree",
  534. 198: "Trumpet",
  535. 199: "Ruler",
  536. 200: "Helmet",
  537. 201: "Ladder",
  538. 202: "Office building",
  539. 203: "Tablet computer",
  540. 204: "Toilet paper",
  541. 205: "Pomegranate",
  542. 206: "Skirt",
  543. 207: "Gas stove",
  544. 208: "Cookie",
  545. 209: "Cart",
  546. 210: "Raven",
  547. 211: "Egg",
  548. 212: "Burrito",
  549. 213: "Goat",
  550. 214: "Kitchen knife",
  551. 215: "Skateboard",
  552. 216: "Salt and pepper shakers",
  553. 217: "Lynx",
  554. 218: "Boot",
  555. 219: "Platter",
  556. 220: "Ski",
  557. 221: "Swimwear",
  558. 222: "Swimming pool",
  559. 223: "Drinking straw",
  560. 224: "Wrench",
  561. 225: "Drum",
  562. 226: "Ant",
  563. 227: "Human ear",
  564. 228: "Headphones",
  565. 229: "Fountain",
  566. 230: "Bird",
  567. 231: "Jeans",
  568. 232: "Television",
  569. 233: "Crab",
  570. 234: "Microphone",
  571. 235: "Home appliance",
  572. 236: "Snowplow",
  573. 237: "Beetle",
  574. 238: "Artichoke",
  575. 239: "Jet ski",
  576. 240: "Stationary bicycle",
  577. 241: "Human hair",
  578. 242: "Brown bear",
  579. 243: "Starfish",
  580. 244: "Fork",
  581. 245: "Lobster",
  582. 246: "Corded phone",
  583. 247: "Drink",
  584. 248: "Saucer",
  585. 249: "Carrot",
  586. 250: "Insect",
  587. 251: "Clock",
  588. 252: "Castle",
  589. 253: "Tennis racket",
  590. 254: "Ceiling fan",
  591. 255: "Asparagus",
  592. 256: "Jaguar",
  593. 257: "Musical instrument",
  594. 258: "Train",
  595. 259: "Cat",
  596. 260: "Rifle",
  597. 261: "Dumbbell",
  598. 262: "Mobile phone",
  599. 263: "Taxi",
  600. 264: "Shower",
  601. 265: "Pitcher",
  602. 266: "Lemon",
  603. 267: "Invertebrate",
  604. 268: "Turkey",
  605. 269: "High heels",
  606. 270: "Bust",
  607. 271: "Elephant",
  608. 272: "Scarf",
  609. 273: "Barrel",
  610. 274: "Trombone",
  611. 275: "Pumpkin",
  612. 276: "Box",
  613. 277: "Tomato",
  614. 278: "Frog",
  615. 279: "Bidet",
  616. 280: "Human face",
  617. 281: "Houseplant",
  618. 282: "Van",
  619. 283: "Shark",
  620. 284: "Ice cream",
  621. 285: "Swim cap",
  622. 286: "Falcon",
  623. 287: "Ostrich",
  624. 288: "Handgun",
  625. 289: "Whiteboard",
  626. 290: "Lizard",
  627. 291: "Pasta",
  628. 292: "Snowmobile",
  629. 293: "Light bulb",
  630. 294: "Window blind",
  631. 295: "Muffin",
  632. 296: "Pretzel",
  633. 297: "Computer monitor",
  634. 298: "Horn",
  635. 299: "Furniture",
  636. 300: "Sandwich",
  637. 301: "Fox",
  638. 302: "Convenience store",
  639. 303: "Fish",
  640. 304: "Fruit",
  641. 305: "Earrings",
  642. 306: "Curtain",
  643. 307: "Grape",
  644. 308: "Sofa bed",
  645. 309: "Horse",
  646. 310: "Luggage and bags",
  647. 311: "Desk",
  648. 312: "Crutch",
  649. 313: "Bicycle helmet",
  650. 314: "Tick",
  651. 315: "Airplane",
  652. 316: "Canary",
  653. 317: "Spatula",
  654. 318: "Watch",
  655. 319: "Lily",
  656. 320: "Kitchen appliance",
  657. 321: "Filing cabinet",
  658. 322: "Aircraft",
  659. 323: "Cake stand",
  660. 324: "Candy",
  661. 325: "Sink",
  662. 326: "Mouse",
  663. 327: "Wine",
  664. 328: "Wheelchair",
  665. 329: "Goldfish",
  666. 330: "Refrigerator",
  667. 331: "French fries",
  668. 332: "Drawer",
  669. 333: "Treadmill",
  670. 334: "Picnic basket",
  671. 335: "Dice",
  672. 336: "Cabbage",
  673. 337: "Football helmet",
  674. 338: "Pig",
  675. 339: "Person",
  676. 340: "Shorts",
  677. 341: "Gondola",
  678. 342: "Honeycomb",
  679. 343: "Doughnut",
  680. 344: "Chest of drawers",
  681. 345: "Land vehicle",
  682. 346: "Bat",
  683. 347: "Monkey",
  684. 348: "Dagger",
  685. 349: "Tableware",
  686. 350: "Human foot",
  687. 351: "Mug",
  688. 352: "Alarm clock",
  689. 353: "Pressure cooker",
  690. 354: "Human hand",
  691. 355: "Tortoise",
  692. 356: "Baseball glove",
  693. 357: "Sword",
  694. 358: "Pear",
  695. 359: "Miniskirt",
  696. 360: "Traffic sign",
  697. 361: "Girl",
  698. 362: "Roller skates",
  699. 363: "Dinosaur",
  700. 364: "Porch",
  701. 365: "Human beard",
  702. 366: "Submarine sandwich",
  703. 367: "Screwdriver",
  704. 368: "Strawberry",
  705. 369: "Wine glass",
  706. 370: "Seafood",
  707. 371: "Racket",
  708. 372: "Wheel",
  709. 373: "Sea lion",
  710. 374: "Toy",
  711. 375: "Tea",
  712. 376: "Tennis ball",
  713. 377: "Waste container",
  714. 378: "Mule",
  715. 379: "Cricket ball",
  716. 380: "Pineapple",
  717. 381: "Coconut",
  718. 382: "Doll",
  719. 383: "Coffee table",
  720. 384: "Snowman",
  721. 385: "Lavender",
  722. 386: "Shrimp",
  723. 387: "Maple",
  724. 388: "Cowboy hat",
  725. 389: "Goggles",
  726. 390: "Rugby ball",
  727. 391: "Caterpillar",
  728. 392: "Poster",
  729. 393: "Rocket",
  730. 394: "Organ",
  731. 395: "Saxophone",
  732. 396: "Traffic light",
  733. 397: "Cocktail",
  734. 398: "Plastic bag",
  735. 399: "Squash",
  736. 400: "Mushroom",
  737. 401: "Hamburger",
  738. 402: "Light switch",
  739. 403: "Parachute",
  740. 404: "Teddy bear",
  741. 405: "Winter melon",
  742. 406: "Deer",
  743. 407: "Musical keyboard",
  744. 408: "Plumbing fixture",
  745. 409: "Scoreboard",
  746. 410: "Baseball bat",
  747. 411: "Envelope",
  748. 412: "Adhesive tape",
  749. 413: "Briefcase",
  750. 414: "Paddle",
  751. 415: "Bow and arrow",
  752. 416: "Telephone",
  753. 417: "Sheep",
  754. 418: "Jacket",
  755. 419: "Boy",
  756. 420: "Pizza",
  757. 421: "Otter",
  758. 422: "Office supplies",
  759. 423: "Couch",
  760. 424: "Cello",
  761. 425: "Bull",
  762. 426: "Camel",
  763. 427: "Ball",
  764. 428: "Duck",
  765. 429: "Whale",
  766. 430: "Shirt",
  767. 431: "Tank",
  768. 432: "Motorcycle",
  769. 433: "Accordion",
  770. 434: "Owl",
  771. 435: "Porcupine",
  772. 436: "Sun hat",
  773. 437: "Nail",
  774. 438: "Scissors",
  775. 439: "Swan",
  776. 440: "Lamp",
  777. 441: "Crown",
  778. 442: "Piano",
  779. 443: "Sculpture",
  780. 444: "Cheetah",
  781. 445: "Oboe",
  782. 446: "Tin can",
  783. 447: "Mango",
  784. 448: "Tripod",
  785. 449: "Oven",
  786. 450: "Mouse",
  787. 451: "Barge",
  788. 452: "Coffee",
  789. 453: "Snowboard",
  790. 454: "Common fig",
  791. 455: "Salad",
  792. 456: "Marine invertebrates",
  793. 457: "Umbrella",
  794. 458: "Kangaroo",
  795. 459: "Human arm",
  796. 460: "Measuring cup",
  797. 461: "Snail",
  798. 462: "Loveseat",
  799. 463: "Suit",
  800. 464: "Teapot",
  801. 465: "Bottle",
  802. 466: "Alpaca",
  803. 467: "Kettle",
  804. 468: "Trousers",
  805. 469: "Popcorn",
  806. 470: "Centipede",
  807. 471: "Spider",
  808. 472: "Sparrow",
  809. 473: "Plate",
  810. 474: "Bagel",
  811. 475: "Personal care",
  812. 476: "Apple",
  813. 477: "Brassiere",
  814. 478: "Bathroom cabinet",
  815. 479: "studio couch",
  816. 480: "Computer keyboard",
  817. 481: "Table tennis racket",
  818. 482: "Sushi",
  819. 483: "Cabinetry",
  820. 484: "Street light",
  821. 485: "Towel",
  822. 486: "Nightstand",
  823. 487: "Rabbit",
  824. 488: "Dolphin",
  825. 489: "Dog",
  826. 490: "Jug",
  827. 491: "Wok",
  828. 492: "Fire hydrant",
  829. 493: "Human eye",
  830. 494: "Skyscraper",
  831. 495: "Backpack",
  832. 496: "Potato",
  833. 497: "Paper towel",
  834. 498: "Lifejacket",
  835. 499: "Bicycle wheel",
  836. 500: "Toilet",
  837. }
  838. return clsid2catid, catid2name
  839. def _visdrone_category():
  840. clsid2catid = {i: i for i in range(10)}
  841. catid2name = {
  842. 0: 'pedestrian',
  843. 1: 'people',
  844. 2: 'bicycle',
  845. 3: 'car',
  846. 4: 'van',
  847. 5: 'truck',
  848. 6: 'tricycle',
  849. 7: 'awning-tricycle',
  850. 8: 'bus',
  851. 9: 'motor'
  852. }
  853. return clsid2catid, catid2name