training a CNN to classify my bad doodles
i built a CNN (convolutional neural network) for classifying doodles that can run in the browser. check it out the demo here.
the dataset
i started with Google's Quick, Draw! dataset and narrowed down our subset to 250,000 images, 25,000 for each of the 10 categories we chose:
Cat, Umbrella, Windmill, Tractor, Bicycle, Cruise Ship, Helicopter, Bowtie, House

i then applied data augmentation using random rotations, slight scaling, and small translations.

the model
the architecture is a standard CNN:
- input: 28x28 grayscale images
- conv layers: two blocks of Conv2D + MaxPooling + Dropout
- dense layers: flattened into fully connected layers with dropout
- output: softmax over the class categories
training
the model hit 95% validation accuracy after about 20 epochs with early stopping.

validation
i used a smaller dataset of 10,000 for validation.
| precision | recall | f1-score | support | |
|---|---|---|---|---|
| cat | 0.95 | 0.97 | 0.96 | 1000 |
| umbrella | 0.98 | 0.98 | 0.98 | 1000 |
| windmill | 0.93 | 0.97 | 0.95 | 1000 |
| octopus | 0.98 | 0.97 | 0.98 | 1000 |
| tractor | 0.93 | 0.93 | 0.93 | 1000 |
| bicycle | 0.95 | 0.96 | 0.95 | 1000 |
| cruise ship | 0.97 | 0.96 | 0.97 | 1000 |
| helicopter | 0.96 | 0.93 | 0.94 | 1000 |
| bowtie | 0.97 | 0.94 | 0.95 | 1000 |
| house | 0.98 | 0.99 | 0.98 | 1000 |
| accuracy | 0.96 | 10000 |
the confusion matrix. bicycles and tractors are the two things most often confused, followed by helicopters and windmills.

where it gets things wrong
the model was not perfect. out of 10,000 images, it got 399 of them wrong. i noticed there is a lot of bad data.


deploying to the browser
the final model gets converted to TensorFlow.js format and loaded client-side. the canvas captures your drawing, preprocesses it (resize to 28x28, normalize), and runs inference. the whole pipeline runs in under 100ms on most devices.
all incorrect predictions
all 399 incorrect predictions across 16 batches.
















all 10,000 predictions
every single prediction the model made on the test set.







































