Cat or Fish: a small CNN for 28x28 drawings
Trained in Google Colab as a classroom example.
Input
- 28x28 grayscale drawing, white strokes (255) on a black background (0)
- 784 pixels row by row, divided by 255 before the model
- Full details in
config.json
Output
Softmax over two classes: 0 = Cat, 1 = Fish
Architecture
Augmentation (shift, rotate, zoom; training only) -> stroke thickening (3x3 max filter) -> 3 x Conv2D (32/64/64) with max pooling -> global max pooling -> Dropout(0.3) -> Dense(64) -> Dense(2, softmax). Trained with balanced class weights.
Results
- Test accuracy: 82.4% (74 drawings never used during training)
- Validation accuracy: 87.8% (74 drawings, used to choose the stopping epoch)
- Training: early stopping on validation loss; best epoch 40 of 50
Limitations
Small dataset of student drawings; expect mistakes on unusual drawings.