Quick, Draw! doodles (ONNX)

Two small doodle models trained by funground for the funground-ml Python package. Each one takes a 28 x 28 drawing and gives a chance for each word it knows. ml.doodle uses the first; ml.doodle_shape uses the second.

File Words Learnt from Tested on First guess right Right in first three Pen Fit
doodle_15_things.onnx 15 things 52,500 7,500 87.5 % 96.7 % 1.0 24
doodle_9_shapes.onnx 9 shapes 720 180 81.7 % 97.2 % 1.2 27
  • 15 things: apple, baseball bat, basketball, clock, compass, cookie, donut, ladder, mountain, pizza, rabbit, soccer ball, spider, t-shirt, wheel.
  • 9 shapes: circle, square, triangle, line, star, diamond, zigzag, squiggle, rectangle. Quick, Draw! has no rectangle, so the rectangles are its square drawings squeezed along one side to between 0.25 and 0.6 of their size.

The drawings tested on were kept back from training. The figures are the ones the training script measured, and the file's metadata repeats them.

The files

  • SHA-256 of doodle_15_things.onnx: fa5ab320c64f2c9a9aae05f7e6ba5f165cb668b1a2f1a114d6db71f45452eb8f (1,501,242 bytes)
  • SHA-256 of doodle_9_shapes.onnx: 804115a4dabffa620e08a59ffbdf8496de15e3adf26d955d59e0f4c402b6b6e7 (1,488,910 bytes)
  • Network: three groups of two 3 x 3 convolutions (16, 32 and 64 filters), each group followed by a 2 x 2 max pool, then 512 neurons and one score for each word. Standard ONNX operators only (Conv, Relu, MaxPool, Flatten, Gemm, Softmax), opset 13, about 375,000 numbers.
  • Input: drawing, float32, (n, 1, 28, 28), ink 1 and paper 0.
  • Output: chances, float32, (n, words), adding up to 1.
  • Metadata: words (a JSON list, in the order of the output), data, net, look, pen, fit, learnt_from, tested_on, first_guess_right, in_first_three, and for the shapes note.
  • How to draw for it: pen is the line's width in pixels of the 28 x 28 picture; fit is how many pixels the longer side of the doodle's pen path takes, centred in the picture. The two files were trained on drawings of different looks (google: Google's own 28 x 28 files; thin: the thinner drawings with no margin in the npm package quickdraw.js), so each needs its own pen and fit.

How they were made

train_doodles.py (JAX and optax) trains the network and writes the ONNX file with its metadata. While it learns, each drawing is moved a little at random and some lines are thickened or softened, and some neurons are switched off at random.

  • doodle_15_things.onnx, from Google's files (numpy_bitmap/<word>.npy), the first 4,000 drawings of each word:

    python train_doodles.py --source <folder of the .npy files> --most 4000 --net doodle --out doodle_15_things.onnx \
        --words "apple,baseball bat,basketball,clock,compass,cookie,donut,ladder,mountain,pizza,rabbit,soccer ball,spider,t-shirt,wheel"
    
  • doodle_9_shapes.onnx, from the 100 drawings of each word in quickdraw.js (read by load_real.py; scipy for the squeezed squares): python train_shapes9.py.

Training again gives a model of the same kind, not the same bytes: the files here are the ones funground pins.

Licence

  • The drawings are from Quick, Draw! by Google, CC BY 4.0. The models learnt from them are shared under the same licence (LICENSE.txt).
  • quickdraw.js is MIT (wagenaartje); its drawings are Google's.
  • The scripts are part of funground, under its licence (LGPL-2.1).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support