当前位置:   article > 正文

手绘图分析(Sketch Analysis)_手绘图像识别

手绘图像识别

                                  手绘图分析(Sketch Analysis)

        手绘图分析(Sketch Analysis)在计算机视觉和图形领域是研究的热点问题。手绘图分析包括手绘图识别(Sketch Recognition)、手绘图分割(Sketch Segmentation)、基于手绘图检索(Sketch-based Retrieval )、基于手绘图建模(Sketch-based Modeling)等等。接下来将会从手绘图分析设计的各个方面进行相关总结。此系列博客作为个人研究的一个学习记录,也希望与各位进行方法的探讨。

1 手绘图识别

1.1手绘图识别的问题与挑战

        草图识别就是完成从笔迹空间到认知空间的映射,即在某个特定领域内赋予草图具体的语义表达。根据草图构成层次复杂度和处理难度来分类,草图分为单笔画图形符号、多笔画推行符号、多个符号组成的整幅草图。相应构成了草图识别的三种对象,第一种:笔画分割、图元识别、笔手势识别;第二种:图形符号识别;第三种:草图理解。草图识别可分为:二维草图识别、三维的草图识别;在线(联机)草图识别、离线(脱机)草图识别;符号化草图识别、非符号化草图识别。草图识别的时机有三种,第一种:提笔即反馈,常用单笔画手势识别、部分草图识别;第二种,用户画完单个图形对象;第三种,整幅草图绘制完成后,进行分割和识别。基于草图的人机交互技术的主要特征是,用户输入的随意性和草图信息的模糊性。草图识别的最大困难在于如何克服这种模糊性。包括单个图形组元的模糊性和上下文关系的模糊性。本文对于手绘图识别方法的描述,主要是是针对完整手绘图在绘制完成后的识别。手写数字的识别到简笔画的识别。

1.2手绘图数据集介绍

 MINST数据集是由Yann提供的手写数字数据库文件,其官方下载地址MNIST handwritten digit database, Yann LeCun, Corinna Cortes and Chris Burges。这个里面还包含了对这个数据库进行识别的各类算法的结果比较及相关算法的论文。数据库的里的图像都是28*28大小的灰度图像,每个像素的是一个八位字节(0~255)。这个数据库主要包含了60000张的训练图像和10000张的测试图像,主要是下面的四个文件:

数据展示:

  

TU-Berlin SKetch数据集,其官方现在网址:How Do Humans Sketch Objects?。论文《How Do Humans Sketch Objects?》。该数据集一共20000张图片,包含250类常见的物体,图片尺寸256*256。关于每一类物体的识别率可以从官网上查看

http://cybertron.cg.tu-berlin.de/eitz/projects/classifysketch/computational_classification/index.html。

数据展示:

QuickDraw数据集345种类别中的5000万张图纸的集合,图片尺寸256*256,由游戏玩家Quick,Draw!提供。绘图被捕获为带时间戳的向量,标记有元数据,包括要求玩家绘制的内容以及玩家所在的国家/地区。您可以在quickdraw.withgoogle.com/data上浏览已识别的图纸。数据集获取:https://github.com/googlecreativelab/quickdraw-dataset

数据展示:

数据集安全下载并且加载为图片

(1)urls.txt

  1. https://storage.googleapis.com/quickdraw_dataset/full/binary/The%20Eiffel%20Tower.bin
  2. https://storage.googleapis.com/quickdraw_dataset/full/binary/The%20Great%20Wall%20of%20China.bin
  3. https://storage.googleapis.com/quickdraw_dataset/full/binary/The%20Mona%20Lisa.bin
  4. https://storage.googleapis.com/quickdraw_dataset/full/binary/aircraft%20carrier.bin
  5. https://storage.googleapis.com/quickdraw_dataset/full/binary/airplane.bin
  6. https://storage.googleapis.com/quickdraw_dataset/full/binary/alarm%20clock.bin
  7. https://storage.googleapis.com/quickdraw_dataset/full/binary/ambulance.bin
  8. https://storage.googleapis.com/quickdraw_dataset/full/binary/angel.bin
  9. https://storage.googleapis.com/quickdraw_dataset/full/binary/animal%20migration.bin
  10. https://storage.googleapis.com/quickdraw_dataset/full/binary/ant.bin
  11. https://storage.googleapis.com/quickdraw_dataset/full/binary/anvil.bin
  12. https://storage.googleapis.com/quickdraw_dataset/full/binary/apple.bin
  13. https://storage.googleapis.com/quickdraw_dataset/full/binary/arm.bin
  14. https://storage.googleapis.com/quickdraw_dataset/full/binary/asparagus.bin
  15. https://storage.googleapis.com/quickdraw_dataset/full/binary/axe.bin
  16. https://storage.googleapis.com/quickdraw_dataset/full/binary/backpack.bin
  17. https://storage.googleapis.com/quickdraw_dataset/full/binary/banana.bin
  18. https://storage.googleapis.com/quickdraw_dataset/full/binary/bandage.bin
  19. https://storage.googleapis.com/quickdraw_dataset/full/binary/barn.bin
  20. https://storage.googleapis.com/quickdraw_dataset/full/binary/baseball%20bat.bin
  21. https://storage.googleapis.com/quickdraw_dataset/full/binary/baseball.bin
  22. https://storage.googleapis.com/quickdraw_dataset/full/binary/basket.bin
  23. https://storage.googleapis.com/quickdraw_dataset/full/binary/basketball.bin
  24. https://storage.googleapis.com/quickdraw_dataset/full/binary/bat.bin
  25. https://storage.googleapis.com/quickdraw_dataset/full/binary/bathtub.bin
  26. https://storage.googleapis.com/quickdraw_dataset/full/binary/beach.bin
  27. https://storage.googleapis.com/quickdraw_dataset/full/binary/bear.bin
  28. https://storage.googleapis.com/quickdraw_dataset/full/binary/beard.bin
  29. https://storage.googleapis.com/quickdraw_dataset/full/binary/bed.bin
  30. https://storage.googleapis.com/quickdraw_dataset/full/binary/bee.bin
  31. https://storage.googleapis.com/quickdraw_dataset/full/binary/belt.bin
  32. https://storage.googleapis.com/quickdraw_dataset/full/binary/bench.bin
  33. https://storage.googleapis.com/quickdraw_dataset/full/binary/bicycle.bin
  34. https://storage.googleapis.com/quickdraw_dataset/full/binary/binoculars.bin
  35. https://storage.googleapis.com/quickdraw_dataset/full/binary/bird.bin
  36. https://storage.googleapis.com/quickdraw_dataset/full/binary/birthday%20cake.bin
  37. https://storage.googleapis.com/quickdraw_dataset/full/binary/blackberry.bin
  38. https://storage.googleapis.com/quickdraw_dataset/full/binary/blueberry.bin
  39. https://storage.googleapis.com/quickdraw_dataset/full/binary/book.bin
  40. https://storage.googleapis.com/quickdraw_dataset/full/binary/boomerang.bin
  41. https://storage.googleapis.com/quickdraw_dataset/full/binary/bottlecap.bin
  42. https://storage.googleapis.com/quickdraw_dataset/full/binary/bowtie.bin
  43. https://storage.googleapis.com/quickdraw_dataset/full/binary/bracelet.bin
  44. https://storage.googleapis.com/quickdraw_dataset/full/binary/brain.bin
  45. https://storage.googleapis.com/quickdraw_dataset/full/binary/bread.bin
  46. https://storage.googleapis.com/quickdraw_dataset/full/binary/bridge.bin
  47. https://storage.googleapis.com/quickdraw_dataset/full/binary/broccoli.bin
  48. https://storage.googleapis.com/quickdraw_dataset/full/binary/broom.bin
  49. https://storage.googleapis.com/quickdraw_dataset/full/binary/bucket.bin
  50. https://storage.googleapis.com/quickdraw_dataset/full/binary/bulldozer.bin
  51. https://storage.googleapis.com/quickdraw_dataset/full/binary/bus.bin
  52. https://storage.googleapis.com/quickdraw_dataset/full/binary/bush.bin
  53. https://storage.googleapis.com/quickdraw_dataset/full/binary/butterfly.bin
  54. https://storage.googleapis.com/quickdraw_dataset/full/binary/cactus.bin
  55. https://storage.googleapis.com/quickdraw_dataset/full/binary/cake.bin
  56. https://storage.googleapis.com/quickdraw_dataset/full/binary/calculator.bin
  57. https://storage.googleapis.com/quickdraw_dataset/full/binary/calendar.bin
  58. https://storage.googleapis.com/quickdraw_dataset/full/binary/camel.bin
  59. https://storage.googleapis.com/quickdraw_dataset/full/binary/camera.bin
  60. https://storage.googleapis.com/quickdraw_dataset/full/binary/camouflage.bin
  61. https://storage.googleapis.com/quickdraw_dataset/full/binary/campfire.bin
  62. https://storage.googleapis.com/quickdraw_dataset/full/binary/candle.bin
  63. https://storage.googleapis.com/quickdraw_dataset/full/binary/cannon.bin
  64. https://storage.googleapis.com/quickdraw_dataset/full/binary/canoe.bin
  65. https://storage.googleapis.com/quickdraw_dataset/full/binary/car.bin
  66. https://storage.googleapis.com/quickdraw_dataset/full/binary/carrot.bin
  67. https://storage.googleapis.com/quickdraw_dataset/full/binary/castle.bin
  68. https://storage.googleapis.com/quickdraw_dataset/full/binary/cat.bin
  69. https://storage.googleapis.com/quickdraw_dataset/full/binary/ceiling%20fan.bin
  70. https://storage.googleapis.com/quickdraw_dataset/full/binary/cell%20phone.bin
  71. https://storage.googleapis.com/quickdraw_dataset/full/binary/cello.bin
  72. https://storage.googleapis.com/quickdraw_dataset/full/binary/chair.bin
  73. https://storage.googleapis.com/quickdraw_dataset/full/binary/chandelier.bin
  74. https://storage.googleapis.com/quickdraw_dataset/full/binary/church.bin
  75. https://storage.googleapis.com/quickdraw_dataset/full/binary/circle.bin
  76. https://storage.googleapis.com/quickdraw_dataset/full/binary/clarinet.bin
  77. https://storage.googleapis.com/quickdraw_dataset/full/binary/clock.bin
  78. https://storage.googleapis.com/quickdraw_dataset/full/binary/cloud.bin
  79. https://storage.googleapis.com/quickdraw_dataset/full/binary/coffee%20cup.bin
  80. https://storage.googleapis.com/quickdraw_dataset/full/binary/compass.bin
  81. https://storage.googleapis.com/quickdraw_dataset/full/binary/computer.bin
  82. https://storage.googleapis.com/quickdraw_dataset/full/binary/cookie.bin
  83. https://storage.googleapis.com/quickdraw_dataset/full/binary/cooler.bin
  84. https://storage.googleapis.com/quickdraw_dataset/full/binary/couch.bin
  85. https://storage.googleapis.com/quickdraw_dataset/full/binary/cow.bin
  86. https://storage.googleapis.com/quickdraw_dataset/full/binary/crab.bin
  87. https://storage.googleapis.com/quickdraw_dataset/full/binary/crayon.bin
  88. https://storage.googleapis.com/quickdraw_dataset/full/binary/crocodile.bin
  89. https://storage.googleapis.com/quickdraw_dataset/full/binary/crown.bin
  90. https://storage.googleapis.com/quickdraw_dataset/full/binary/cruise%20ship.bin
  91. https://storage.googleapis.com/quickdraw_dataset/full/binary/cup.bin
  92. https://storage.googleapis.com/quickdraw_dataset/full/binary/diamond.bin
  93. https://storage.googleapis.com/quickdraw_dataset/full/binary/dishwasher.bin
  94. https://storage.googleapis.com/quickdraw_dataset/full/binary/diving%20board.bin
  95. https://storage.googleapis.com/quickdraw_dataset/full/binary/dog.bin
  96. https://storage.googleapis.com/quickdraw_dataset/full/binary/dolphin.bin
  97. https://storage.googleapis.com/quickdraw_dataset/full/binary/donut.bin
  98. https://storage.googleapis.com/quickdraw_dataset/full/binary/door.bin
  99. https://storage.googleapis.com/quickdraw_dataset/full/binary/dragon.bin
  100. https://storage.googleapis.com/quickdraw_dataset/full/binary/dresser.bin
  101. https://storage.googleapis.com/quickdraw_dataset/full/binary/drill.bin
  102. https://storage.googleapis.com/quickdraw_dataset/full/binary/drums.bin
  103. https://storage.googleapis.com/quickdraw_dataset/full/binary/duck.bin
  104. https://storage.googleapis.com/quickdraw_dataset/full/binary/dumbbell.bin
  105. https://storage.googleapis.com/quickdraw_dataset/full/binary/ear.bin
  106. https://storage.googleapis.com/quickdraw_dataset/full/binary/elbow.bin
  107. https://storage.googleapis.com/quickdraw_dataset/full/binary/elephant.bin
  108. https://storage.googleapis.com/quickdraw_dataset/full/binary/envelope.bin
  109. https://storage.googleapis.com/quickdraw_dataset/full/binary/eraser.bin
  110. https://storage.googleapis.com/quickdraw_dataset/full/binary/eye.bin
  111. https://storage.googleapis.com/quickdraw_dataset/full/binary/eyeglasses.bin
  112. https://storage.googleapis.com/quickdraw_dataset/full/binary/face.bin
  113. https://storage.googleapis.com/quickdraw_dataset/full/binary/fan.bin
  114. https://storage.googleapis.com/quickdraw_dataset/full/binary/feather.bin
  115. https://storage.googleapis.com/quickdraw_dataset/full/binary/fence.bin
  116. https://storage.googleapis.com/quickdraw_dataset/full/binary/finger.bin
  117. https://storage.googleapis.com/quickdraw_dataset/full/binary/fire%20hydrant.bin
  118. https://storage.googleapis.com/quickdraw_dataset/full/binary/fireplace.bin
  119. https://storage.googleapis.com/quickdraw_dataset/full/binary/firetruck.bin
  120. https://storage.googleapis.com/quickdraw_dataset/full/binary/fish.bin
  121. https://storage.googleapis.com/quickdraw_dataset/full/binary/flamingo.bin
  122. https://storage.googleapis.com/quickdraw_dataset/full/binary/flashlight.bin
  123. https://storage.googleapis.com/quickdraw_dataset/full/binary/flip%20flops.bin
  124. https://storage.googleapis.com/quickdraw_dataset/full/binary/floor%20lamp.bin
  125. https://storage.googleapis.com/quickdraw_dataset/full/binary/flower.bin
  126. https://storage.googleapis.com/quickdraw_dataset/full/binary/flying%20saucer.bin
  127. https://storage.googleapis.com/quickdraw_dataset/full/binary/foot.bin
  128. https://storage.googleapis.com/quickdraw_dataset/full/binary/fork.bin
  129. https://storage.googleapis.com/quickdraw_dataset/full/binary/frog.bin
  130. https://storage.googleapis.com/quickdraw_dataset/full/binary/frying%20pan.bin
  131. https://storage.googleapis.com/quickdraw_dataset/full/binary/garden%20hose.bin
  132. https://storage.googleapis.com/quickdraw_dataset/full/binary/garden.bin
  133. https://storage.googleapis.com/quickdraw_dataset/full/binary/giraffe.bin
  134. https://storage.googleapis.com/quickdraw_dataset/full/binary/goatee.bin
  135. https://storage.googleapis.com/quickdraw_dataset/full/binary/golf%20club.bin
  136. https://storage.googleapis.com/quickdraw_dataset/full/binary/grapes.bin
  137. https://storage.googleapis.com/quickdraw_dataset/full/binary/grass.bin
  138. https://storage.googleapis.com/quickdraw_dataset/full/binary/guitar.bin
  139. https://storage.googleapis.com/quickdraw_dataset/full/binary/hamburger.bin
  140. https://storage.googleapis.com/quickdraw_dataset/full/binary/hammer.bin
  141. https://storage.googleapis.com/quickdraw_dataset/full/binary/hand.bin
  142. https://storage.googleapis.com/quickdraw_dataset/full/binary/harp.bin
  143. https://storage.googleapis.com/quickdraw_dataset/full/binary/hat.bin
  144. https://storage.googleapis.com/quickdraw_dataset/full/binary/headphones.bin
  145. https://storage.googleapis.com/quickdraw_dataset/full/binary/hedgehog.bin
  146. https://storage.googleapis.com/quickdraw_dataset/full/binary/helicopter.bin
  147. https://storage.googleapis.com/quickdraw_dataset/full/binary/helmet.bin
  148. https://storage.googleapis.com/quickdraw_dataset/full/binary/hexagon.bin
  149. https://storage.googleapis.com/quickdraw_dataset/full/binary/hockey%20puck.bin
  150. https://storage.googleapis.com/quickdraw_dataset/full/binary/hockey%20stick.bin
  151. https://storage.googleapis.com/quickdraw_dataset/full/binary/horse.bin
  152. https://storage.googleapis.com/quickdraw_dataset/full/binary/hospital.bin
  153. https://storage.googleapis.com/quickdraw_dataset/full/binary/hot%20air%20balloon.bin
  154. https://storage.googleapis.com/quickdraw_dataset/full/binary/hot%20dog.bin
  155. https://storage.googleapis.com/quickdraw_dataset/full/binary/hot%20tub.bin
  156. https://storage.googleapis.com/quickdraw_dataset/full/binary/hourglass.bin
  157. https://storage.googleapis.com/quickdraw_dataset/full/binary/house%20plant.bin
  158. https://storage.googleapis.com/quickdraw_dataset/full/binary/house.bin
  159. https://storage.googleapis.com/quickdraw_dataset/full/binary/hurricane.bin
  160. https://storage.googleapis.com/quickdraw_dataset/full/binary/ice%20cream.bin
  161. https://storage.googleapis.com/quickdraw_dataset/full/binary/jacket.bin
  162. https://storage.googleapis.com/quickdraw_dataset/full/binary/jail.bin
  163. https://storage.googleapis.com/quickdraw_dataset/full/binary/kangaroo.bin
  164. https://storage.googleapis.com/quickdraw_dataset/full/binary/key.bin
  165. https://storage.googleapis.com/quickdraw_dataset/full/binary/keyboard.bin
  166. https://storage.googleapis.com/quickdraw_dataset/full/binary/knee.bin
  167. https://storage.googleapis.com/quickdraw_dataset/full/binary/knife.bin
  168. https://storage.googleapis.com/quickdraw_dataset/full/binary/ladder.bin
  169. https://storage.googleapis.com/quickdraw_dataset/full/binary/lantern.bin
  170. https://storage.googleapis.com/quickdraw_dataset/full/binary/laptop.bin
  171. https://storage.googleapis.com/quickdraw_dataset/full/binary/leaf.bin
  172. https://storage.googleapis.com/quickdraw_dataset/full/binary/leg.bin
  173. https://storage.googleapis.com/quickdraw_dataset/full/binary/light%20bulb.bin
  174. https://storage.googleapis.com/quickdraw_dataset/full/binary/lighter.bin
  175. https://storage.googleapis.com/quickdraw_dataset/full/binary/lighthouse.bin
  176. https://storage.googleapis.com/quickdraw_dataset/full/binary/lightning.bin
  177. https://storage.googleapis.com/quickdraw_dataset/full/binary/line.bin
  178. https://storage.googleapis.com/quickdraw_dataset/full/binary/lion.bin
  179. https://storage.googleapis.com/quickdraw_dataset/full/binary/lipstick.bin
  180. https://storage.googleapis.com/quickdraw_dataset/full/binary/lobster.bin
  181. https://storage.googleapis.com/quickdraw_dataset/full/binary/lollipop.bin
  182. https://storage.googleapis.com/quickdraw_dataset/full/binary/mailbox.bin
  183. https://storage.googleapis.com/quickdraw_dataset/full/binary/map.bin
  184. https://storage.googleapis.com/quickdraw_dataset/full/binary/marker.bin
  185. https://storage.googleapis.com/quickdraw_dataset/full/binary/matches.bin
  186. https://storage.googleapis.com/quickdraw_dataset/full/binary/megaphone.bin
  187. https://storage.googleapis.com/quickdraw_dataset/full/binary/mermaid.bin
  188. https://storage.googleapis.com/quickdraw_dataset/full/binary/microphone.bin
  189. https://storage.googleapis.com/quickdraw_dataset/full/binary/microwave.bin
  190. https://storage.googleapis.com/quickdraw_dataset/full/binary/monkey.bin
  191. https://storage.googleapis.com/quickdraw_dataset/full/binary/moon.bin
  192. https://storage.googleapis.com/quickdraw_dataset/full/binary/mosquito.bin
  193. https://storage.googleapis.com/quickdraw_dataset/full/binary/motorbike.bin
  194. https://storage.googleapis.com/quickdraw_dataset/full/binary/mountain.bin
  195. https://storage.googleapis.com/quickdraw_dataset/full/binary/mouse.bin
  196. https://storage.googleapis.com/quickdraw_dataset/full/binary/moustache.bin
  197. https://storage.googleapis.com/quickdraw_dataset/full/binary/mouth.bin
  198. https://storage.googleapis.com/quickdraw_dataset/full/binary/mug.bin
  199. https://storage.googleapis.com/quickdraw_dataset/full/binary/mushroom.bin
  200. https://storage.googleapis.com/quickdraw_dataset/full/binary/nail.bin
  201. https://storage.googleapis.com/quickdraw_dataset/full/binary/necklace.bin
  202. https://storage.googleapis.com/quickdraw_dataset/full/binary/nose.bin
  203. https://storage.googleapis.com/quickdraw_dataset/full/binary/ocean.bin
  204. https://storage.googleapis.com/quickdraw_dataset/full/binary/octagon.bin
  205. https://storage.googleapis.com/quickdraw_dataset/full/binary/octopus.bin
  206. https://storage.googleapis.com/quickdraw_dataset/full/binary/onion.bin
  207. https://storage.googleapis.com/quickdraw_dataset/full/binary/oven.bin
  208. https://storage.googleapis.com/quickdraw_dataset/full/binary/owl.bin
  209. https://storage.googleapis.com/quickdraw_dataset/full/binary/paint%20can.bin
  210. https://storage.googleapis.com/quickdraw_dataset/full/binary/paintbrush.bin
  211. https://storage.googleapis.com/quickdraw_dataset/full/binary/palm%20tree.bin
  212. https://storage.googleapis.com/quickdraw_dataset/full/binary/panda.bin
  213. https://storage.googleapis.com/quickdraw_dataset/full/binary/pants.bin
  214. https://storage.googleapis.com/quickdraw_dataset/full/binary/paper%20clip.bin
  215. https://storage.googleapis.com/quickdraw_dataset/full/binary/parachute.bin
  216. https://storage.googleapis.com/quickdraw_dataset/full/binary/parrot.bin
  217. https://storage.googleapis.com/quickdraw_dataset/full/binary/passport.bin
  218. https://storage.googleapis.com/quickdraw_dataset/full/binary/peanut.bin
  219. https://storage.googleapis.com/quickdraw_dataset/full/binary/pear.bin
  220. https://storage.googleapis.com/quickdraw_dataset/full/binary/peas.bin
  221. https://storage.googleapis.com/quickdraw_dataset/full/binary/pencil.bin
  222. https://storage.googleapis.com/quickdraw_dataset/full/binary/penguin.bin
  223. https://storage.googleapis.com/quickdraw_dataset/full/binary/piano.bin
  224. https://storage.googleapis.com/quickdraw_dataset/full/binary/pickup%20truck.bin
  225. https://storage.googleapis.com/quickdraw_dataset/full/binary/picture%20frame.bin
  226. https://storage.googleapis.com/quickdraw_dataset/full/binary/pig.bin
  227. https://storage.googleapis.com/quickdraw_dataset/full/binary/pillow.bin
  228. https://storage.googleapis.com/quickdraw_dataset/full/binary/pineapple.bin
  229. https://storage.googleapis.com/quickdraw_dataset/full/binary/pizza.bin
  230. https://storage.googleapis.com/quickdraw_dataset/full/binary/pliers.bin
  231. https://storage.googleapis.com/quickdraw_dataset/full/binary/police%20car.bin
  232. https://storage.googleapis.com/quickdraw_dataset/full/binary/pond.bin
  233. https://storage.googleapis.com/quickdraw_dataset/full/binary/pool.bin
  234. https://storage.googleapis.com/quickdraw_dataset/full/binary/popsicle.bin
  235. https://storage.googleapis.com/quickdraw_dataset/full/binary/postcard.bin
  236. https://storage.googleapis.com/quickdraw_dataset/full/binary/potato.bin
  237. https://storage.googleapis.com/quickdraw_dataset/full/binary/power%20outlet.bin
  238. https://storage.googleapis.com/quickdraw_dataset/full/binary/purse.bin
  239. https://storage.googleapis.com/quickdraw_dataset/full/binary/rabbit.bin
  240. https://storage.googleapis.com/quickdraw_dataset/full/binary/raccoon.bin
  241. https://storage.googleapis.com/quickdraw_dataset/full/binary/radio.bin
  242. https://storage.googleapis.com/quickdraw_dataset/full/binary/rain.bin
  243. https://storage.googleapis.com/quickdraw_dataset/full/binary/rainbow.bin
  244. https://storage.googleapis.com/quickdraw_dataset/full/binary/rake.bin
  245. https://storage.googleapis.com/quickdraw_dataset/full/binary/remote%20control.bin
  246. https://storage.googleapis.com/quickdraw_dataset/full/binary/rhinoceros.bin
  247. https://storage.googleapis.com/quickdraw_dataset/full/binary/rifle.bin
  248. https://storage.googleapis.com/quickdraw_dataset/full/binary/river.bin
  249. https://storage.googleapis.com/quickdraw_dataset/full/binary/roller%20coaster.bin
  250. https://storage.googleapis.com/quickdraw_dataset/full/binary/rollerskates.bin
  251. https://storage.googleapis.com/quickdraw_dataset/full/binary/sailboat.bin
  252. https://storage.googleapis.com/quickdraw_dataset/full/binary/sandwich.bin
  253. https://storage.googleapis.com/quickdraw_dataset/full/binary/saw.bin
  254. https://storage.googleapis.com/quickdraw_dataset/full/binary/saxophone.bin
  255. https://storage.googleapis.com/quickdraw_dataset/full/binary/school%20bus.bin
  256. https://storage.googleapis.com/quickdraw_dataset/full/binary/scissors.bin
  257. https://storage.googleapis.com/quickdraw_dataset/full/binary/scorpion.bin
  258. https://storage.googleapis.com/quickdraw_dataset/full/binary/screwdriver.bin
  259. https://storage.googleapis.com/quickdraw_dataset/full/binary/sea%20turtle.bin
  260. https://storage.googleapis.com/quickdraw_dataset/full/binary/see%20saw.bin
  261. https://storage.googleapis.com/quickdraw_dataset/full/binary/shark.bin
  262. https://storage.googleapis.com/quickdraw_dataset/full/binary/sheep.bin
  263. https://storage.googleapis.com/quickdraw_dataset/full/binary/shoe.bin
  264. https://storage.googleapis.com/quickdraw_dataset/full/binary/shorts.bin
  265. https://storage.googleapis.com/quickdraw_dataset/full/binary/shovel.bin
  266. https://storage.googleapis.com/quickdraw_dataset/full/binary/sink.bin
  267. https://storage.googleapis.com/quickdraw_dataset/full/binary/skateboard.bin
  268. https://storage.googleapis.com/quickdraw_dataset/full/binary/skull.bin
  269. https://storage.googleapis.com/quickdraw_dataset/full/binary/skyscraper.bin
  270. https://storage.googleapis.com/quickdraw_dataset/full/binary/sleeping%20bag.bin
  271. https://storage.googleapis.com/quickdraw_dataset/full/binary/smiley%20face.bin
  272. https://storage.googleapis.com/quickdraw_dataset/full/binary/snail.bin
  273. https://storage.googleapis.com/quickdraw_dataset/full/binary/snake.bin
  274. https://storage.googleapis.com/quickdraw_dataset/full/binary/snorkel.bin
  275. https://storage.googleapis.com/quickdraw_dataset/full/binary/snowflake.bin
  276. https://storage.googleapis.com/quickdraw_dataset/full/binary/snowman.bin
  277. https://storage.googleapis.com/quickdraw_dataset/full/binary/soccer%20ball.bin
  278. https://storage.googleapis.com/quickdraw_dataset/full/binary/sock.bin
  279. https://storage.googleapis.com/quickdraw_dataset/full/binary/speedboat.bin
  280. https://storage.googleapis.com/quickdraw_dataset/full/binary/spider.bin
  281. https://storage.googleapis.com/quickdraw_dataset/full/binary/spoon.bin
  282. https://storage.googleapis.com/quickdraw_dataset/full/binary/spreadsheet.bin
  283. https://storage.googleapis.com/quickdraw_dataset/full/binary/square.bin
  284. https://storage.googleapis.com/quickdraw_dataset/full/binary/squiggle.bin
  285. https://storage.googleapis.com/quickdraw_dataset/full/binary/squirrel.bin
  286. https://storage.googleapis.com/quickdraw_dataset/full/binary/stairs.bin
  287. https://storage.googleapis.com/quickdraw_dataset/full/binary/star.bin
  288. https://storage.googleapis.com/quickdraw_dataset/full/binary/steak.bin
  289. https://storage.googleapis.com/quickdraw_dataset/full/binary/stereo.bin
  290. https://storage.googleapis.com/quickdraw_dataset/full/binary/stethoscope.bin
  291. https://storage.googleapis.com/quickdraw_dataset/full/binary/stitches.bin
  292. https://storage.googleapis.com/quickdraw_dataset/full/binary/stop%20sign.bin
  293. https://storage.googleapis.com/quickdraw_dataset/full/binary/stove.bin
  294. https://storage.googleapis.com/quickdraw_dataset/full/binary/strawberry.bin
  295. https://storage.googleapis.com/quickdraw_dataset/full/binary/streetlight.bin
  296. https://storage.googleapis.com/quickdraw_dataset/full/binary/string%20bean.bin
  297. https://storage.googleapis.com/quickdraw_dataset/full/binary/submarine.bin
  298. https://storage.googleapis.com/quickdraw_dataset/full/binary/suitcase.bin
  299. https://storage.googleapis.com/quickdraw_dataset/full/binary/sun.bin
  300. https://storage.googleapis.com/quickdraw_dataset/full/binary/swan.bin
  301. https://storage.googleapis.com/quickdraw_dataset/full/binary/sweater.bin
  302. https://storage.googleapis.com/quickdraw_dataset/full/binary/swing%20set.bin
  303. https://storage.googleapis.com/quickdraw_dataset/full/binary/sword.bin
  304. https://storage.googleapis.com/quickdraw_dataset/full/binary/syringe.bin
  305. https://storage.googleapis.com/quickdraw_dataset/full/binary/t-shirt.bin
  306. https://storage.googleapis.com/quickdraw_dataset/full/binary/table.bin
  307. https://storage.googleapis.com/quickdraw_dataset/full/binary/teapot.bin
  308. https://storage.googleapis.com/quickdraw_dataset/full/binary/teddy-bear.bin
  309. https://storage.googleapis.com/quickdraw_dataset/full/binary/telephone.bin
  310. https://storage.googleapis.com/quickdraw_dataset/full/binary/television.bin
  311. https://storage.googleapis.com/quickdraw_dataset/full/binary/tennis%20racquet.bin
  312. https://storage.googleapis.com/quickdraw_dataset/full/binary/tent.bin
  313. https://storage.googleapis.com/quickdraw_dataset/full/binary/tiger.bin
  314. https://storage.googleapis.com/quickdraw_dataset/full/binary/toaster.bin
  315. https://storage.googleapis.com/quickdraw_dataset/full/binary/toe.bin
  316. https://storage.googleapis.com/quickdraw_dataset/full/binary/toilet.bin
  317. https://storage.googleapis.com/quickdraw_dataset/full/binary/tooth.bin
  318. https://storage.googleapis.com/quickdraw_dataset/full/binary/toothbrush.bin
  319. https://storage.googleapis.com/quickdraw_dataset/full/binary/toothpaste.bin
  320. https://storage.googleapis.com/quickdraw_dataset/full/binary/tornado.bin
  321. https://storage.googleapis.com/quickdraw_dataset/full/binary/tractor.bin
  322. https://storage.googleapis.com/quickdraw_dataset/full/binary/traffic%20light.bin
  323. https://storage.googleapis.com/quickdraw_dataset/full/binary/train.bin
  324. https://storage.googleapis.com/quickdraw_dataset/full/binary/tree.bin
  325. https://storage.googleapis.com/quickdraw_dataset/full/binary/triangle.bin
  326. https://storage.googleapis.com/quickdraw_dataset/full/binary/trombone.bin
  327. https://storage.googleapis.com/quickdraw_dataset/full/binary/truck.bin
  328. https://storage.googleapis.com/quickdraw_dataset/full/binary/trumpet.bin
  329. https://storage.googleapis.com/quickdraw_dataset/full/binary/umbrella.bin
  330. https://storage.googleapis.com/quickdraw_dataset/full/binary/underwear.bin
  331. https://storage.googleapis.com/quickdraw_dataset/full/binary/van.bin
  332. https://storage.googleapis.com/quickdraw_dataset/full/binary/vase.bin
  333. https://storage.googleapis.com/quickdraw_dataset/full/binary/violin.bin
  334. https://storage.googleapis.com/quickdraw_dataset/full/binary/washing%20machine.bin
  335. https://storage.googleapis.com/quickdraw_dataset/full/binary/watermelon.bin
  336. https://storage.googleapis.com/quickdraw_dataset/full/binary/waterslide.bin
  337. https://storage.googleapis.com/quickdraw_dataset/full/binary/whale.bin
  338. https://storage.googleapis.com/quickdraw_dataset/full/binary/wheel.bin
  339. https://storage.googleapis.com/quickdraw_dataset/full/binary/windmill.bin
  340. https://storage.googleapis.com/quickdraw_dataset/full/binary/wine%20bottle.bin
  341. https://storage.googleapis.com/quickdraw_dataset/full/binary/wine%20glass.bin
  342. https://storage.googleapis.com/quickdraw_dataset/full/binary/wristwatch.bin
  343. https://storage.googleapis.com/quickdraw_dataset/full/binary/yoga.bin
  344. https://storage.googleapis.com/quickdraw_dataset/full/binary/zebra.bin
  345. https://storage.googleapis.com/quickdraw_dataset/full/binary/zigzag.bin

 (2)quickdrawDownload.py

  1. # encoding:utf-8
  2. import urllib.request as ur
  3. import os
  4. from urllib.parse import unquote
  5. import urllib
  6. import pubchempy
  7. import pandas as pd
  8. import numpy as np
  9. with open("urls.txt", "r") as fd:
  10. lines = fd.readlines()
  11. for line in lines:
  12. line = line.replace("\n", "")
  13. filename = line[line.rindex("/") + 1:]
  14. filename = unquote(filename)
  15. response = ur.urlopen(line, timeout=1000)
  16. data = response.read()
  17. response.close()
  18. with open(filename, "wb") as datafd:
  19. datafd.write(data)
  20. datafd.close()
  21. print(filename)

 (3)保存为图片

  1. # Copyright 2017 Google Inc.
  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. # https://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. import struct
  15. from struct import unpack
  16. from PIL import Image, ImageDraw
  17. import os
  18. class QuickDrawing():
  19. """
  20. Represents a single Quick, Draw! drawing.
  21. """
  22. def __init__(self, name, drawing_data):
  23. self._name =name
  24. self._drawing_data = drawing_data
  25. self._strokes = None
  26. self._image = None
  27. @property
  28. def name(self):
  29. """
  30. Returns the name of the drawing (anvil, aircraft, ant, etc).
  31. """
  32. return self._name
  33. @property
  34. def key_id(self):
  35. """
  36. Returns the id of the drawing.
  37. """
  38. return self._drawing_data["key_id"]
  39. @property
  40. def countrycode(self):
  41. """
  42. Returns the country code for the drawing.
  43. """
  44. return self._drawing_data["countrycode"].decode("utf-8")
  45. @property
  46. def recognized(self):
  47. """
  48. Returns a boolean representing whether the drawing was recognized.
  49. """
  50. return bool(self._drawing_data["recognized"])
  51. @property
  52. def timestamp(self):
  53. """
  54. Returns the time the drawing was created (in seconds since the epoch).
  55. """
  56. return self._drawing_data["timestamp"]
  57. @property
  58. def no_of_strokes(self):
  59. """
  60. Returns the number of pen strokes used to create the drawing.
  61. """
  62. return self._drawing_data["n_strokes"]
  63. @property
  64. def image_data(self):
  65. """
  66. Returns the raw image data as list of strokes with a list of X
  67. co-ordinates and a list of Y co-ordinates.
  68. Co-ordinates are aligned to the top-left hand corner with values
  69. from 0 to 255.
  70. See https://github.com/googlecreativelab/quickdraw-dataset#simplified-drawing-files-ndjson
  71. for more information regarding how the data is represented.
  72. """
  73. return self._drawing_data["image"]
  74. @property
  75. def strokes(self):
  76. """
  77. Returns a list of pen strokes containing a list of (x,y) coordinates which make up the drawing.
  78. To iterate though the strokes data use::
  79. from quickdraw import QuickDrawData
  80. qd = QuickDrawData()
  81. anvil = qd.get_drawing("anvil")
  82. for stroke in anvil.strokes:
  83. for x, y in stroke:
  84. print("x={} y={}".format(x, y))
  85. """
  86. # load the strokes
  87. if self._strokes is None:
  88. self._strokes = []
  89. for stroke in self.image_data:
  90. points = []
  91. xs = stroke[0]
  92. ys = stroke[1]
  93. if len(xs) != len(ys):
  94. raise Exception("something is wrong, different number of x's and y's")
  95. for point in range(len(xs)):
  96. x = xs[point]
  97. y = ys[point]
  98. points.append((x,y))
  99. self._strokes.append(points)
  100. return self._strokes
  101. @property
  102. def image(self):
  103. """
  104. Returns a `PIL Image <https://pillow.readthedocs.io/en/3.0.x/reference/Image.html>`_
  105. object of the drawing on a white background with a black drawing. Alternative image
  106. parameters can be set using ``get_image()``.
  107. To save the image you would use the ``save`` method::
  108. from quickdraw import QuickDrawData
  109. qd = QuickDrawData()
  110. anvil = qd.get_drawing("anvil")
  111. anvil.image.save("my_anvil.gif")
  112. """
  113. if self._image is None:
  114. self._image = self.get_image()
  115. return self._image
  116. def get_image(self, stroke_color=(0,0,0), stroke_width=2, bg_color=(255,255,255)):
  117. """
  118. Get a `PIL Image <https://pillow.readthedocs.io/en/3.0.x/reference/Image.html>`_
  119. object of the drawing.
  120. :param list stroke_color:
  121. A list of RGB (red, green, blue) values for the stroke color,
  122. defaults to (0,0,0).
  123. :param int stroke_color:
  124. A width of the stroke, defaults to 2.
  125. :param list bg_color:
  126. A list of RGB (red, green, blue) values for the background color,
  127. defaults to (255,255,255).
  128. """
  129. image = Image.new("RGB", (255,255), color=bg_color)
  130. image_draw = ImageDraw.Draw(image)
  131. for stroke in self.strokes:
  132. image_draw.line(stroke, fill=stroke_color, width=stroke_width)
  133. return image
  134. def __str__(self):
  135. return "QuickDrawing key_id={}".format(self.key_id)
  136. def unpack_drawing(file_handle):
  137. key_id, = unpack('Q', file_handle.read(8))
  138. country_code, = unpack('2s', file_handle.read(2))
  139. recognized, = unpack('b', file_handle.read(1))
  140. timestamp, = unpack('I', file_handle.read(4))
  141. n_strokes, = unpack('H', file_handle.read(2))
  142. image = []
  143. for i in range(n_strokes):
  144. n_points, = unpack('H', file_handle.read(2))
  145. fmt = str(n_points) + 'B'
  146. x = unpack(fmt, file_handle.read(n_points))
  147. y = unpack(fmt, file_handle.read(n_points))
  148. image.append((x, y))
  149. return {
  150. 'key_id': key_id,
  151. 'country_code': country_code,
  152. 'recognized': recognized,
  153. 'timestamp': timestamp,
  154. 'image': image
  155. }
  156. def unpack_drawings(filename):
  157. with open(filename, 'rb') as f:
  158. while True:
  159. try:
  160. yield unpack_drawing(f)
  161. except struct.error:
  162. break
  163. def load_bin_files(dir):
  164. fileslist = []
  165. for path, dirs, files in os.walk(dir):
  166. for file in files:
  167. fileslist.append(os.path.join(path, file))
  168. return fileslist
  169. if __name__ == "__main__":
  170. bin_fileslist = load_bin_files("datasetbin")
  171. datasetdir = "dataset"
  172. if not os.path.exists(datasetdir):
  173. os.mkdir(datasetdir)
  174. for binfile in bin_fileslist:
  175. class_name = binfile[binfile.rindex('/') + 1 : binfile.rindex(".bin")]
  176. print(binfile, " ", class_name)
  177. class_dir = os.path.join(datasetdir, class_name)
  178. if not os.path.exists(class_dir):
  179. os.mkdir(class_dir)
  180. index = 0
  181. for drawing in unpack_drawings(binfile):
  182. # do something with the drawing
  183. qt = QuickDrawing(class_name, drawing)
  184. image = qt.get_image()
  185. image.save(os.path.join(class_dir, str(index) + ".jpg"))
  186. index = index + 1

Sketch-RNN QuickDraw数据集,在此数据集中,从每个类别中随机选择75K样本(70K训练,2.5K验证,2.5K测试),使用[RDP]处理(https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm)线条简化,epsilon参数为2.0。每个类别都将存储在自己的.npz文件中,例如cat.npz。Sketch-Rnn 论文《A Neural Representation of Sketch Drawings》

数据展示:

Sketch-500数据集,此数据集为未公开数据集,在论文《Query-Adaptive Shape Topic Mining for Hand-Drawn
Sketch Recognition》中提出,1000个名词,每一个名词收集了相应的500张图片,用来测试QST模型。

数据展示:

MPEG-7 dataset数据集,此数据集用于形状识别,一共70个形状类,其中每个形状类包含表单中的20个不同形状轮廓

二进制图像。此数据集总共包含1400个形状轮廓。参考论文《MPEG-7 Visual Shape Descriptors》

数据展示:

1.3手绘图识别方法

Sketch-A-net:《Sketch-a-Net: A Deep Neural Network that Beats Humans

github:http://www.eecs.qmul.ac.uk/~tmh/

https://github.com/ayush29feb/Sketch-A-XNORNet

Sketch-RNN:《A Neural Representation of Sketch Drawings

github:https://github.com/tensorflow/magenta/tree/master/magenta/models/sketch_rnn

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号