Skip to content
Back to projects

Colorectal Cancer Tissue Classification (Deep Learning)

A custom CNN that beat VGG16 transfer learning at classifying eight histopathology tissue types.

Role
Solo project / independent build
Stack
TensorFlow/Keras, scikit-learn, NumPy
Scope
5,000 histology images · 8 tissue types
Normalised confusion matrix for the custom CNN, with per-class accuracy from 87% to 99% across eight tissue types
Normalised confusion matrix for the custom CNN, with per-class accuracy from 87% to 99% across eight tissue types

Colorectal cancer diagnosis leans heavily on manual histopathology, which is slow, expertise-driven, and prone to variability between readers. I wanted to see how far a from-scratch deep-learning model could go at automating tissue classification, working with the TensorFlow colorectal_histology dataset: 5,000 images at 150×150 resolution across 8 tissue types (tumour, debris, stroma, lymphocytes, complex, mucosa, adipose, empty).

I designed a custom CNN with convolutional blocks scaling from 32 to 256 filters, using batch normalisation, max-pooling, and dropout to keep it stable and regularised. On held-out data it reached 0.94 accuracy and 0.94 macro-F1, which was strong and, importantly, even across all eight classes rather than carried by the easy ones.

To know whether that was actually good, I benchmarked it against the standard move: VGG16 transfer learning with ImageNet weights and fine-tuning. That reached 0.89 accuracy and 0.89 macro-F1, respectable but below my custom network. The takeaway I drew is the interesting part: on this task, domain-specific feature learning outperformed generic pretrained features. Transfer learning isn't automatically the right answer.

Grid of sample histopathology images from all eight tissue classes: tumour, debris, stroma, lymphocytes, complex, mucosa, adipose, and empty
Sample images from all 8 tissue classes the model learns to distinguish.
Loss and accuracy training curves comparing the custom CNN against VGG16 transfer learning
Training curves: custom CNN (Model 1) against VGG16 transfer learning (Model 2).
Normalised confusion matrix for the VGG16 transfer-learning model across eight tissue types
VGG16 confusion matrix: 0.89 accuracy, trailing the custom CNN's 0.94.
TensorFlow/Kerasscikit-learnNumPyView on GitHub