Quick Draw is a drawing game which is training a neural network to recognise doodles.
quickdraw is an API for accessing the Quick Draw data - it downloads the data files as and when needed, caches them locally and interprets them so they can be used.
Install the quickdraw python library using pip.
pip install quickdraw
pip3 install quickdraw
- Linux / Raspberry Pi
sudo pip3 install quickdraw
Here are some examples of how to use
quickdraw but be sure to also checkout the API documentation for more information.
Open the Quick Draw data using QuickDrawData and pull back a drawing of an anvil.
from quickdraw import QuickDrawData qd = QuickDrawData() anvil = qd.get_drawing("anvil") print(anvil)
quickdraw will download the
anvil.bin data file and return the data for a random drawing of an anvil (well a doodle of an anvil anyway).
Drawings are returned as QuickDrawing objects which exposes the properties of the drawing.
print(anvil.name) print(anvil.key_id) print(anvil.countrycode) print(anvil.recognized) print(anvil.timestamp) print(anvil.no_of_strokes) print(anvil.image_data) print(anvil.strokes)
You can save the drawing using the
You can open a group of Quick Draw drawings using QuickDrawDataGroup passing the name of the drawing (“anvil”, “aircraft”, “baseball”, etc).
from quickdraw import QuickDrawDataGroup anvils = QuickDrawDataGroup("anvil") print(anvils.drawing_count) print(anvils.get_drawing())
By default only 1000 drawings are opened, you can change this by modifying the
max_drawings parameter of QuickDrawDataGroup, setting it to
None will open all the drawings in that group.
from quickdraw import QuickDrawDataGroup anvils = QuickDrawDataGroup("anvil", max_drawings=None) print(anvils.drawing_count)
To iterate through all the drawings in a group use the drawings generator.
from quickdraw import QuickDrawDataGroup qdg = QuickDrawDataGroup("anvil") for drawing in qdg.drawings: print(drawing)
from quickdraw import QuickDrawData qd = QuickDrawData() print(qd.drawing_names)
The drawings have been moderated but there is no guarantee it’ll actually be a picture of what you are asking it for (although in my experience they are)!