Skip to content
Project 04 / 04Computer VisionHistopathology · Deep Learning

Colorectal Cancer Tissue Classification (Deep Learning)

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

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

    Histology images

  • 8

    Tissue classes

  • 0.94

    Custom CNN accuracy & macro-F1

  • 0.89

    VGG16 transfer-learning baseline

The build

How it came together.

  1. 01

    The problem

    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).

  2. 02

    The model

    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.

  3. 03

    The benchmark

    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.

Visuals

What it produced.

03 figures

Fig. 01
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.
  • Fig. 02
    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).
  • Fig. 03
    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.
Tech stack
  • TensorFlow/Keras
  • scikit-learn
  • NumPy
View source on GitHub

What's next

Have a similar problem to solve?Let's talk it through.

I'm looking for a junior data analyst or analytics engineer role in Sydney. If something here looks like the work you need doing, get in touch.

Open to opportunitiesSydney, Australia