← Back to portfolio
Case Study · 15 / 17
Computer Vision · Deep Learning · 2025

Sitting or standing —
a small CNN's whole job.

A tight image classifier: a convolutional network that decides whether a photo shows someone sitting or standing, trained with augmentation to survive a small dataset and evaluated with honest accuracy and loss curves. A study in getting a CNN to generalise from too little data.

Role
Solo — model & evaluation
Task
Binary image classification
Stack
TensorFlow · Keras · scikit-learn
Status
Open-source project
Fig. 15 · sitting vs standing
15
With a small dataset, augmentation isn't a tweak — it's the training set.
§ 01 — The problem

A small dataset invites overfitting.

Binary posture classification sounds trivial until you count the images. A modest labelled set of sitting and standing photos gives a CNN more than enough room to memorise the training examples — nailing them while learning nothing that transfers to a new photo.

So the real task wasn't "build a CNN"; it was "build a CNN that generalises from limited data," which turns the project into a study of regularisation and augmentation rather than architecture.

A model that aces training and flunks test hasn't learned — it's memorised.

§ 02 — Constraints

Guardrails against memorising.

§ 03 — Architecture

Load, augment, learn, judge.

Images and CSV labels are loaded and resized to 224×224, encoded to categorical, split train/test, then fed through three conv blocks into a dense classifier — trained on an augmenting data generator.

01 — Load
Images + CSV
Read filenames and labels, resize to 224×224, normalise pixels.
02 — Augment
Generator
Rotation, shift, and flip synthesise variety on every batch.
03 — Model
3-block CNN
Conv + pool stacks into a dense head with dropout and softmax.
04 — Evaluate
Curves + predict
Test accuracy, accuracy/loss plots, and a single-image predictor.

The predict_image helper closes the loop — load a new photo, normalise it the same way, and print the predicted class with a confidence score, so the trained model is usable, not just measurable.

§ 04 — What the curves showed

Augmentation bought the generalisation.

The training and validation curves are the whole story. Without augmentation the two lines split early — training accuracy climbing while validation stalls, the textbook shape of a network memorising its inputs. With augmentation the gap narrows, and the test accuracy becomes a number you can actually believe.

Plotting accuracy and loss side by side made that trade-off visible rather than assumed — which is exactly why the evaluation plots are part of the deliverable, not an afterthought.

2
Classes — sitting and standing
224²
Input resolution each image is resized to
3
Convolutional blocks before the dense head
§ 05 — Keeping it honest

The plots are the point.

It would have been easy to report a single test-accuracy figure and stop. Shipping the accuracy and loss curves instead admits where the model is weak and shows the augmentation earning its place — the difference between a result you can defend and a number you're hoping nobody probes.

§ 06 — What I'd do differently

Three things, next time.