Objects365.yaml 9.0 KB

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