Dominion Akinrotimi
Back to Projects
Python TensorFlow Computer Vision Explainable AI

PhytopathAI: Breast Histology Classification

The problem: telling a benign breast lesion from carcinoma in situ, or in situ from invasive cancer, changes treatment, and it depends on cell-level detail that busy pathology services can miss. PhytopathAI reads an H&E-stained microscopy image and sorts it into normal tissue, benign lesion, in situ carcinoma or invasive carcinoma, then shows exactly which parts of the image drove the answer.

Open the live app View GitHub Repo

Results on held-out images

Trained on 320 images from the BACH 2018 dataset and tested once on 80 images it had never seen, 20 per class.

MeasureResult
Four-class accuracy85.0% (95% interval 76–92%)
Carcinomas detected (in situ or invasive)40 of 40
Non-cancer images correctly cleared36 of 40
Macro F10.85
Cross-validated accuracy (320 images)81.6%
Confusion matrix on 80 test images: 17 of 20 normal, 15 of 20 benign, 19 of 20 in situ and 17 of 20 invasive classified correctly

What made the difference

I compared 20 designs fairly: five neural networks from 4 to 28 million parameters, each fed either the whole image shrunk to 224×224 pixels or 12 higher-resolution patches, with and without stain colour normalisation. Every design was scored by cross-validation, and only the winner touched the test images.

Cross-validated accuracy of 20 designs: patches beat the whole image for every network

Explanations you can trust

Because the final classifier is linear, its explanations are exact rather than approximate: an activation map shows where inside each patch the evidence sits, and a SHAP value for each of the 12 patches adds up exactly to the model's score. The app also refuses images that don't look like histology, because a classifier will otherwise label a photo of anything as cancer.

How I kept it honest

Auditing my own thesis: the original model reported 78.75%, but it had picked its best training epoch using the test images. Retrained correctly, it scored 68.75%. The rebuilt pipeline separates validation from test data and fixes the comparison rules before any result is seen.

Lesion grouping: an unsupervised grouping of lesion images mainly separates invasive from early lesions; I report it as that, not as new subtypes.

Plant compounds: each lesion group links to eight plant-derived compounds with published laboratory evidence, each with its mechanism, evidence tier and source. It's a literature map, not a treatment recommendation.

Research prototype from my BSc thesis. Not a medical device and not for diagnosis or treatment decisions.

Need an AI or machine learning system like this?

I build and deploy models that solve real problems, from clinical research to products in production.