Objects365.yaml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
  2. # Objects365 dataset https://www.objects365.org/ by Megvii
  3. # Documentation: https://docs.ultralytics.com/datasets/detect/objects365/
  4. # Example usage: yolo train data=Objects365.yaml
  5. # parent
  6. # ├── ultralytics
  7. # └── datasets
  8. # └── Objects365 ← downloads here (712 GB = 367G data + 345G zips)
  9. # Train/val/test sets as 1) dir: path/to/imgs, 2) file: path/to/imgs.txt, or 3) list: [path/to/imgs1, path/to/imgs2, ..]
  10. path: ../datasets/Objects365 # dataset root dir
  11. train: images/train # train images (relative to 'path') 1742289 images
  12. val: images/val # val images (relative to 'path') 80000 images
  13. test: # test images (optional)
  14. # Classes
  15. names:
  16. 0: Person
  17. 1: Sneakers
  18. 2: Chair
  19. 3: Other Shoes
  20. 4: Hat
  21. 5: Car
  22. 6: Lamp
  23. 7: Glasses
  24. 8: Bottle
  25. 9: Desk
  26. 10: Cup
  27. 11: Street Lights
  28. 12: Cabinet/shelf
  29. 13: Handbag/Satchel
  30. 14: Bracelet
  31. 15: Plate
  32. 16: Picture/Frame
  33. 17: Helmet
  34. 18: Book
  35. 19: Gloves
  36. 20: Storage box
  37. 21: Boat
  38. 22: Leather Shoes
  39. 23: Flower
  40. 24: Bench
  41. 25: Potted Plant
  42. 26: Bowl/Basin
  43. 27: Flag
  44. 28: Pillow
  45. 29: Boots
  46. 30: Vase
  47. 31: Microphone
  48. 32: Necklace
  49. 33: Ring
  50. 34: SUV
  51. 35: Wine Glass
  52. 36: Belt
  53. 37: Monitor/TV
  54. 38: Backpack
  55. 39: Umbrella
  56. 40: Traffic Light
  57. 41: Speaker
  58. 42: Watch
  59. 43: Tie
  60. 44: Trash bin Can
  61. 45: Slippers
  62. 46: Bicycle
  63. 47: Stool
  64. 48: Barrel/bucket
  65. 49: Van
  66. 50: Couch
  67. 51: Sandals
  68. 52: Basket
  69. 53: Drum
  70. 54: Pen/Pencil
  71. 55: Bus
  72. 56: Wild Bird
  73. 57: High Heels
  74. 58: Motorcycle
  75. 59: Guitar
  76. 60: Carpet
  77. 61: Cell Phone
  78. 62: Bread
  79. 63: Camera
  80. 64: Canned
  81. 65: Truck
  82. 66: Traffic cone
  83. 67: Cymbal
  84. 68: Lifesaver
  85. 69: Towel
  86. 70: Stuffed Toy
  87. 71: Candle
  88. 72: Sailboat
  89. 73: Laptop
  90. 74: Awning
  91. 75: Bed
  92. 76: Faucet
  93. 77: Tent
  94. 78: Horse
  95. 79: Mirror
  96. 80: Power outlet
  97. 81: Sink
  98. 82: Apple
  99. 83: Air Conditioner
  100. 84: Knife
  101. 85: Hockey Stick
  102. 86: Paddle
  103. 87: Pickup Truck
  104. 88: Fork
  105. 89: Traffic Sign
  106. 90: Balloon
  107. 91: Tripod
  108. 92: Dog
  109. 93: Spoon
  110. 94: Clock
  111. 95: Pot
  112. 96: Cow
  113. 97: Cake
  114. 98: Dining Table
  115. 99: Sheep
  116. 100: Hanger
  117. 101: Blackboard/Whiteboard
  118. 102: Napkin
  119. 103: Other Fish
  120. 104: Orange/Tangerine
  121. 105: Toiletry
  122. 106: Keyboard
  123. 107: Tomato
  124. 108: Lantern
  125. 109: Machinery Vehicle
  126. 110: Fan
  127. 111: Green Vegetables
  128. 112: Banana
  129. 113: Baseball Glove
  130. 114: Airplane
  131. 115: Mouse
  132. 116: Train
  133. 117: Pumpkin
  134. 118: Soccer
  135. 119: Skiboard
  136. 120: Luggage
  137. 121: Nightstand
  138. 122: Tea pot
  139. 123: Telephone
  140. 124: Trolley
  141. 125: Head Phone
  142. 126: Sports Car
  143. 127: Stop Sign
  144. 128: Dessert
  145. 129: Scooter
  146. 130: Stroller
  147. 131: Crane
  148. 132: Remote
  149. 133: Refrigerator
  150. 134: Oven
  151. 135: Lemon
  152. 136: Duck
  153. 137: Baseball Bat
  154. 138: Surveillance Camera
  155. 139: Cat
  156. 140: Jug
  157. 141: Broccoli
  158. 142: Piano
  159. 143: Pizza
  160. 144: Elephant
  161. 145: Skateboard
  162. 146: Surfboard
  163. 147: Gun
  164. 148: Skating and Skiing shoes
  165. 149: Gas stove
  166. 150: Donut
  167. 151: Bow Tie
  168. 152: Carrot
  169. 153: Toilet
  170. 154: Kite
  171. 155: Strawberry
  172. 156: Other Balls
  173. 157: Shovel
  174. 158: Pepper
  175. 159: Computer Box
  176. 160: Toilet Paper
  177. 161: Cleaning Products
  178. 162: Chopsticks
  179. 163: Microwave
  180. 164: Pigeon
  181. 165: Baseball
  182. 166: Cutting/chopping Board
  183. 167: Coffee Table
  184. 168: Side Table
  185. 169: Scissors
  186. 170: Marker
  187. 171: Pie
  188. 172: Ladder
  189. 173: Snowboard
  190. 174: Cookies
  191. 175: Radiator
  192. 176: Fire Hydrant
  193. 177: Basketball
  194. 178: Zebra
  195. 179: Grape
  196. 180: Giraffe
  197. 181: Potato
  198. 182: Sausage
  199. 183: Tricycle
  200. 184: Violin
  201. 185: Egg
  202. 186: Fire Extinguisher
  203. 187: Candy
  204. 188: Fire Truck
  205. 189: Billiards
  206. 190: Converter
  207. 191: Bathtub
  208. 192: Wheelchair
  209. 193: Golf Club
  210. 194: Briefcase
  211. 195: Cucumber
  212. 196: Cigar/Cigarette
  213. 197: Paint Brush
  214. 198: Pear
  215. 199: Heavy Truck
  216. 200: Hamburger
  217. 201: Extractor
  218. 202: Extension Cord
  219. 203: Tong
  220. 204: Tennis Racket
  221. 205: Folder
  222. 206: American Football
  223. 207: earphone
  224. 208: Mask
  225. 209: Kettle
  226. 210: Tennis
  227. 211: Ship
  228. 212: Swing
  229. 213: Coffee Machine
  230. 214: Slide
  231. 215: Carriage
  232. 216: Onion
  233. 217: Green beans
  234. 218: Projector
  235. 219: Frisbee
  236. 220: Washing Machine/Drying Machine
  237. 221: Chicken
  238. 222: Printer
  239. 223: Watermelon
  240. 224: Saxophone
  241. 225: Tissue
  242. 226: Toothbrush
  243. 227: Ice cream
  244. 228: Hot-air balloon
  245. 229: Cello
  246. 230: French Fries
  247. 231: Scale
  248. 232: Trophy
  249. 233: Cabbage
  250. 234: Hot dog
  251. 235: Blender
  252. 236: Peach
  253. 237: Rice
  254. 238: Wallet/Purse
  255. 239: Volleyball
  256. 240: Deer
  257. 241: Goose
  258. 242: Tape
  259. 243: Tablet
  260. 244: Cosmetics
  261. 245: Trumpet
  262. 246: Pineapple
  263. 247: Golf Ball
  264. 248: Ambulance
  265. 249: Parking meter
  266. 250: Mango
  267. 251: Key
  268. 252: Hurdle
  269. 253: Fishing Rod
  270. 254: Medal
  271. 255: Flute
  272. 256: Brush
  273. 257: Penguin
  274. 258: Megaphone
  275. 259: Corn
  276. 260: Lettuce
  277. 261: Garlic
  278. 262: Swan
  279. 263: Helicopter
  280. 264: Green Onion
  281. 265: Sandwich
  282. 266: Nuts
  283. 267: Speed Limit Sign
  284. 268: Induction Cooker
  285. 269: Broom
  286. 270: Trombone
  287. 271: Plum
  288. 272: Rickshaw
  289. 273: Goldfish
  290. 274: Kiwi fruit
  291. 275: Router/modem
  292. 276: Poker Card
  293. 277: Toaster
  294. 278: Shrimp
  295. 279: Sushi
  296. 280: Cheese
  297. 281: Notepaper
  298. 282: Cherry
  299. 283: Pliers
  300. 284: CD
  301. 285: Pasta
  302. 286: Hammer
  303. 287: Cue
  304. 288: Avocado
  305. 289: Hami melon
  306. 290: Flask
  307. 291: Mushroom
  308. 292: Screwdriver
  309. 293: Soap
  310. 294: Recorder
  311. 295: Bear
  312. 296: Eggplant
  313. 297: Board Eraser
  314. 298: Coconut
  315. 299: Tape Measure/Ruler
  316. 300: Pig
  317. 301: Showerhead
  318. 302: Globe
  319. 303: Chips
  320. 304: Steak
  321. 305: Crosswalk Sign
  322. 306: Stapler
  323. 307: Camel
  324. 308: Formula 1
  325. 309: Pomegranate
  326. 310: Dishwasher
  327. 311: Crab
  328. 312: Hoverboard
  329. 313: Meatball
  330. 314: Rice Cooker
  331. 315: Tuba
  332. 316: Calculator
  333. 317: Papaya
  334. 318: Antelope
  335. 319: Parrot
  336. 320: Seal
  337. 321: Butterfly
  338. 322: Dumbbell
  339. 323: Donkey
  340. 324: Lion
  341. 325: Urinal
  342. 326: Dolphin
  343. 327: Electric Drill
  344. 328: Hair Dryer
  345. 329: Egg tart
  346. 330: Jellyfish
  347. 331: Treadmill
  348. 332: Lighter
  349. 333: Grapefruit
  350. 334: Game board
  351. 335: Mop
  352. 336: Radish
  353. 337: Baozi
  354. 338: Target
  355. 339: French
  356. 340: Spring Rolls
  357. 341: Monkey
  358. 342: Rabbit
  359. 343: Pencil Case
  360. 344: Yak
  361. 345: Red Cabbage
  362. 346: Binoculars
  363. 347: Asparagus
  364. 348: Barbell
  365. 349: Scallop
  366. 350: Noddles
  367. 351: Comb
  368. 352: Dumpling
  369. 353: Oyster
  370. 354: Table Tennis paddle
  371. 355: Cosmetics Brush/Eyeliner Pencil
  372. 356: Chainsaw
  373. 357: Eraser
  374. 358: Lobster
  375. 359: Durian
  376. 360: Okra
  377. 361: Lipstick
  378. 362: Cosmetics Mirror
  379. 363: Curling
  380. 364: Table Tennis
  381. # Download script/URL (optional) ---------------------------------------------------------------------------------------
  382. download: |
  383. from tqdm import tqdm
  384. from ultralytics.utils.checks import check_requirements
  385. from ultralytics.utils.downloads import download
  386. from ultralytics.utils.ops import xyxy2xywhn
  387. import numpy as np
  388. from pathlib import Path
  389. check_requirements(('pycocotools>=2.0',))
  390. from pycocotools.coco import COCO
  391. # Make Directories
  392. dir = Path(yaml['path']) # dataset root dir
  393. for p in 'images', 'labels':
  394. (dir / p).mkdir(parents=True, exist_ok=True)
  395. for q in 'train', 'val':
  396. (dir / p / q).mkdir(parents=True, exist_ok=True)
  397. # Train, Val Splits
  398. for split, patches in [('train', 50 + 1), ('val', 43 + 1)]:
  399. print(f"Processing {split} in {patches} patches ...")
  400. images, labels = dir / 'images' / split, dir / 'labels' / split
  401. # Download
  402. url = f"https://dorc.ks3-cn-beijing.ksyun.com/data-set/2020Objects365%E6%95%B0%E6%8D%AE%E9%9B%86/{split}/"
  403. if split == 'train':
  404. download([f'{url}zhiyuan_objv2_{split}.tar.gz'], dir=dir) # annotations json
  405. download([f'{url}patch{i}.tar.gz' for i in range(patches)], dir=images, curl=True, threads=8)
  406. elif split == 'val':
  407. download([f'{url}zhiyuan_objv2_{split}.json'], dir=dir) # annotations json
  408. download([f'{url}images/v1/patch{i}.tar.gz' for i in range(15 + 1)], dir=images, curl=True, threads=8)
  409. download([f'{url}images/v2/patch{i}.tar.gz' for i in range(16, patches)], dir=images, curl=True, threads=8)
  410. # Move
  411. for f in tqdm(images.rglob('*.jpg'), desc=f'Moving {split} images'):
  412. f.rename(images / f.name) # move to /images/{split}
  413. # Labels
  414. coco = COCO(dir / f'zhiyuan_objv2_{split}.json')
  415. names = [x["name"] for x in coco.loadCats(coco.getCatIds())]
  416. for cid, cat in enumerate(names):
  417. catIds = coco.getCatIds(catNms=[cat])
  418. imgIds = coco.getImgIds(catIds=catIds)
  419. for im in tqdm(coco.loadImgs(imgIds), desc=f'Class {cid + 1}/{len(names)} {cat}'):
  420. width, height = im["width"], im["height"]
  421. path = Path(im["file_name"]) # image filename
  422. try:
  423. with open(labels / path.with_suffix('.txt').name, 'a') as file:
  424. annIds = coco.getAnnIds(imgIds=im["id"], catIds=catIds, iscrowd=None)
  425. for a in coco.loadAnns(annIds):
  426. x, y, w, h = a['bbox'] # bounding box in xywh (xy top-left corner)
  427. xyxy = np.array([x, y, x + w, y + h])[None] # pixels(1,4)
  428. x, y, w, h = xyxy2xywhn(xyxy, w=width, h=height, clip=True)[0] # normalized and clipped
  429. file.write(f"{cid} {x:.5f} {y:.5f} {w:.5f} {h:.5f}\n")
  430. except Exception as e:
  431. print(e)