手绘图分析(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

https://storage.googleapis.com/quickdraw_dataset/full/binary/The%20Eiffel%20Tower.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/The%20Great%20Wall%20of%20China.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/The%20Mona%20Lisa.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/aircraft%20carrier.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/airplane.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/alarm%20clock.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ambulance.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/angel.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/animal%20migration.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ant.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/anvil.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/apple.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/arm.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/asparagus.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/axe.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/backpack.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/banana.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bandage.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/barn.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/baseball%20bat.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/baseball.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/basket.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/basketball.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bat.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bathtub.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/beach.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bear.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/beard.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bed.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bee.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/belt.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bench.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bicycle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/binoculars.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bird.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/birthday%20cake.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/blackberry.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/blueberry.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/book.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/boomerang.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bottlecap.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bowtie.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bracelet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/brain.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bread.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bridge.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/broccoli.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/broom.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bucket.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bulldozer.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bus.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/bush.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/butterfly.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cactus.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cake.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/calculator.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/calendar.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/camel.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/camera.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/camouflage.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/campfire.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/candle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cannon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/canoe.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/car.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/carrot.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/castle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cat.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ceiling%20fan.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cell%20phone.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cello.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/chair.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/chandelier.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/church.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/circle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/clarinet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/clock.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cloud.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/coffee%20cup.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/compass.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/computer.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cookie.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cooler.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/couch.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cow.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/crab.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/crayon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/crocodile.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/crown.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cruise%20ship.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/cup.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/diamond.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/dishwasher.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/diving%20board.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/dog.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/dolphin.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/donut.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/door.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/dragon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/dresser.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/drill.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/drums.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/duck.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/dumbbell.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ear.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/elbow.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/elephant.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/envelope.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/eraser.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/eye.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/eyeglasses.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/face.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/fan.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/feather.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/fence.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/finger.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/fire%20hydrant.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/fireplace.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/firetruck.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/fish.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/flamingo.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/flashlight.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/flip%20flops.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/floor%20lamp.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/flower.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/flying%20saucer.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/foot.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/fork.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/frog.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/frying%20pan.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/garden%20hose.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/garden.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/giraffe.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/goatee.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/golf%20club.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/grapes.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/grass.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/guitar.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hamburger.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hammer.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hand.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/harp.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hat.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/headphones.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hedgehog.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/helicopter.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/helmet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hexagon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hockey%20puck.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hockey%20stick.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/horse.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hospital.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hot%20air%20balloon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hot%20dog.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hot%20tub.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hourglass.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/house%20plant.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/house.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/hurricane.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ice%20cream.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/jacket.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/jail.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/kangaroo.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/key.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/keyboard.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/knee.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/knife.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ladder.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lantern.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/laptop.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/leaf.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/leg.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/light%20bulb.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lighter.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lighthouse.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lightning.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/line.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lion.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lipstick.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lobster.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/lollipop.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mailbox.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/map.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/marker.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/matches.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/megaphone.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mermaid.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/microphone.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/microwave.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/monkey.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/moon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mosquito.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/motorbike.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mountain.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mouse.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/moustache.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mouth.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mug.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/mushroom.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/nail.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/necklace.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/nose.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/ocean.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/octagon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/octopus.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/onion.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/oven.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/owl.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/paint%20can.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/paintbrush.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/palm%20tree.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/panda.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pants.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/paper%20clip.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/parachute.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/parrot.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/passport.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/peanut.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pear.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/peas.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pencil.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/penguin.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/piano.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pickup%20truck.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/picture%20frame.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pig.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pillow.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pineapple.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pizza.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pliers.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/police%20car.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pond.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/pool.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/popsicle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/postcard.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/potato.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/power%20outlet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/purse.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rabbit.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/raccoon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/radio.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rain.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rainbow.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rake.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/remote%20control.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rhinoceros.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rifle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/river.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/roller%20coaster.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/rollerskates.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sailboat.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sandwich.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/saw.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/saxophone.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/school%20bus.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/scissors.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/scorpion.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/screwdriver.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sea%20turtle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/see%20saw.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/shark.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sheep.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/shoe.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/shorts.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/shovel.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sink.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/skateboard.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/skull.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/skyscraper.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sleeping%20bag.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/smiley%20face.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/snail.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/snake.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/snorkel.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/snowflake.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/snowman.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/soccer%20ball.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sock.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/speedboat.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/spider.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/spoon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/spreadsheet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/square.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/squiggle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/squirrel.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/stairs.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/star.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/steak.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/stereo.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/stethoscope.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/stitches.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/stop%20sign.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/stove.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/strawberry.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/streetlight.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/string%20bean.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/submarine.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/suitcase.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sun.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/swan.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sweater.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/swing%20set.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/sword.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/syringe.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/t-shirt.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/table.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/teapot.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/teddy-bear.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/telephone.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/television.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tennis%20racquet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tent.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tiger.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/toaster.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/toe.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/toilet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tooth.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/toothbrush.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/toothpaste.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tornado.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tractor.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/traffic%20light.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/train.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/tree.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/triangle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/trombone.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/truck.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/trumpet.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/umbrella.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/underwear.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/van.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/vase.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/violin.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/washing%20machine.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/watermelon.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/waterslide.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/whale.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/wheel.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/windmill.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/wine%20bottle.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/wine%20glass.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/wristwatch.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/yoga.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/zebra.bin
https://storage.googleapis.com/quickdraw_dataset/full/binary/zigzag.bin

 (2)quickdrawDownload.py

# encoding:utf-8
import urllib.request as ur
import os
from urllib.parse import unquote
import urllib

import pubchempy
import pandas as pd
import numpy as np
with open("urls.txt", "r") as fd:
    lines = fd.readlines()
    for line in lines:
        line = line.replace("\n", "")
        filename = line[line.rindex("/") + 1:]
        filename = unquote(filename)
        response = ur.urlopen(line, timeout=1000)
        data = response.read()
        response.close()
        with open(filename, "wb") as datafd:
            datafd.write(data)
            datafd.close()

        print(filename)

 (3)保存为图片

# Copyright 2017 Google Inc.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# https://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
 
import struct
from struct import unpack
from PIL import Image, ImageDraw
import os
 
class QuickDrawing():
    """
    Represents a single Quick, Draw! drawing.
    """
    def __init__(self, name, drawing_data):
        self._name =name
        self._drawing_data = drawing_data
        self._strokes = None
        self._image = None
 
    @property
    def name(self):
        """
        Returns the name of the drawing (anvil, aircraft, ant, etc).
        """
        return self._name
 
    @property
    def key_id(self):
        """
        Returns the id of the drawing.
        """
        return self._drawing_data["key_id"]
 
    @property
    def countrycode(self):
        """
        Returns the country code for the drawing.
        """
        return self._drawing_data["countrycode"].decode("utf-8")
 
    @property
    def recognized(self):
        """
        Returns a boolean representing whether the drawing was recognized.
        """
        return bool(self._drawing_data["recognized"])
 
    @property
    def timestamp(self):
        """
        Returns the time the drawing was created (in seconds since the epoch).
        """
        return self._drawing_data["timestamp"]
 
    @property
    def no_of_strokes(self):
        """
        Returns the number of pen strokes used to create the drawing.
        """
        return self._drawing_data["n_strokes"]
 
    @property
    def image_data(self):
        """
        Returns the raw image data as list of strokes with a list of X 
        co-ordinates and a list of Y co-ordinates.
        Co-ordinates are aligned to the top-left hand corner with values
        from 0 to 255.
        See https://github.com/googlecreativelab/quickdraw-dataset#simplified-drawing-files-ndjson
        for more information regarding how the data is represented.
        """
        return self._drawing_data["image"]
    
    @property
    def strokes(self):
        """
        Returns a list of pen strokes containing a list of (x,y) coordinates which make up the drawing.
        To iterate though the strokes data use::
        
            from quickdraw import QuickDrawData
            qd = QuickDrawData()
            anvil = qd.get_drawing("anvil")
            for stroke in anvil.strokes:
                for x, y in stroke:
                    print("x={} y={}".format(x, y)) 
        """
        # load the strokes
        if self._strokes is None:
            
            self._strokes = []
            for stroke in self.image_data:
                points = []
                xs = stroke[0]
                ys = stroke[1]
 
                if len(xs) != len(ys):
                    raise Exception("something is wrong, different number of x's and y's")
 
                for point in range(len(xs)):
                    x = xs[point]
                    y = ys[point]
                    points.append((x,y))
                self._strokes.append(points)
 
        return self._strokes
 
    @property
    def image(self):
        """
        Returns a `PIL Image <https://pillow.readthedocs.io/en/3.0.x/reference/Image.html>`_ 
        object of the drawing on a white background with a black drawing. Alternative image
        parameters can be set using ``get_image()``.
        To save the image you would use the ``save`` method::
            from quickdraw import QuickDrawData
            qd = QuickDrawData()
            anvil = qd.get_drawing("anvil")
            anvil.image.save("my_anvil.gif")
            
        """
        if self._image is None:
            self._image = self.get_image()
 
        return self._image
 
    def get_image(self, stroke_color=(0,0,0), stroke_width=2, bg_color=(255,255,255)):
        """
        Get a `PIL Image <https://pillow.readthedocs.io/en/3.0.x/reference/Image.html>`_ 
        object of the drawing.
        :param list stroke_color:
            A list of RGB (red, green, blue) values for the stroke color,
            defaults to (0,0,0).
        :param int stroke_color:
            A width of the stroke, defaults to 2.
        :param list bg_color:
            A list of RGB (red, green, blue) values for the background color,
            defaults to (255,255,255).
        """
        image = Image.new("RGB", (255,255), color=bg_color)
        image_draw = ImageDraw.Draw(image)
 
        for stroke in self.strokes:
            image_draw.line(stroke, fill=stroke_color, width=stroke_width)
 
        return image
 
    def __str__(self):
        return "QuickDrawing key_id={}".format(self.key_id)
 
 
def unpack_drawing(file_handle):
    key_id, = unpack('Q', file_handle.read(8))
    country_code, = unpack('2s', file_handle.read(2))
    recognized, = unpack('b', file_handle.read(1))
    timestamp, = unpack('I', file_handle.read(4))
    n_strokes, = unpack('H', file_handle.read(2))
    image = []
    for i in range(n_strokes):
        n_points, = unpack('H', file_handle.read(2))
        fmt = str(n_points) + 'B'
        x = unpack(fmt, file_handle.read(n_points))
        y = unpack(fmt, file_handle.read(n_points))
        image.append((x, y))
 
    return {
        'key_id': key_id,
        'country_code': country_code,
        'recognized': recognized,
        'timestamp': timestamp,
        'image': image
    }
 
 
def unpack_drawings(filename):
    with open(filename, 'rb') as f:
        while True:
            try:
                yield unpack_drawing(f)
            except struct.error:
                break
 
 
 
def load_bin_files(dir):
    fileslist = []
    for path, dirs, files in os.walk(dir):
        for file in files:
            fileslist.append(os.path.join(path, file))
    return fileslist
 
if __name__ == "__main__":
    bin_fileslist = load_bin_files("datasetbin")
    datasetdir = "dataset"
    if not os.path.exists(datasetdir):
        os.mkdir(datasetdir)
 
    for binfile in bin_fileslist:
        class_name = binfile[binfile.rindex('/') + 1 : binfile.rindex(".bin")]
        print(binfile, " ", class_name)
 
        class_dir = os.path.join(datasetdir, class_name)
        if not os.path.exists(class_dir):
            os.mkdir(class_dir)
        
        index = 0
        for drawing in unpack_drawings(binfile):
            # do something with the drawing
            qt = QuickDrawing(class_name, drawing)
            image = qt.get_image()
            image.save(os.path.join(class_dir, str(index) + ".jpg")) 
            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

  • 0
    点赞
  • 26
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
网络流量分析(Network Traffic Analysis)是指对网络数据流量进行监控、收集、分析和解释的过程。而网络流量分析中的sketch方法是一种快速而高效的数据结构和算法,用于处理大规模网络流量数据。 Sketch方法的主要目标是通过对流量数据进行采样和聚合,以减少存储和计算的需求,同时保持尽可能高的准确性和可用性。Sketch方法通常由两个主要组件组成:哈希函数和计数器数组。 首先,哈希函数将流量数据映射到计数器数组中的索引位置。这样做的目的是将大量的数据映射到有限的计数器数量上,从而实现数据的压缩和降维。 接下来,计数器数组根据哈希函数的映射结果进行计数更新。这些计数器以某种方式进行聚合,通常是通过增量更新或累加计数器的值。通过适当的聚合策略,我们可以获得流量数据的频率统计信息,如源IP地址、目的IP地址、协议类型等。 在网络流量分析中,使用sketch方法具有以下优势: 1. 高效的存储和计算:相比传统的存储和计算方法,使用sketch方法可以大大减少资源的消耗。通过对流量进行采样和聚合,可以在保持可接受精度的同时,降低存储和计算的需求。 2. 实时性:sketch方法可以在流量不断产生的情况下进行实时的统计和分析。由于其高效的计算和更新机制,可以快速生成最新的结果。 3. 可伸缩性:sketch方法可以适应大规模网络流量的需求。通过调整计数器数组的大小和哈希函数的选择,可以在不同的场景下灵活使用。 然而,sketch方法也存在一些限制,如精度较低、无法恢复原始数据等。因此,在实际应用中,需要根据具体需求和数据特点进行权衡和选择合适的sketch方法。 总而言之,网络流量分析中的sketch方法是一种高效而灵活的数据结构和算法,通过对流量数据进行采样和聚合,可以实现存储和计算的压缩,并提供实时的统计和分析结果。它在网络安全、流量管理和性能优化等领域具有广泛的应用前景。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值