Detecting lung cancer from a CT scan.

A convolutional neural network — trained by transfer learning — that reads a chest-CT slice, separates cancer from healthy tissue, and identifies the tumour subtype. Then it shows you exactly where it looked.

cancer sensitivity
specificity
macro AUC
Chest CT slice
Axial chest-CT slice — the model's input, resized to 224×224.
01

The data

Real chest-CT slices across four diagnoses. The training set is balanced; the test set is left realistically imbalanced.

training images
validation
held-out test
4diagnostic classes
Representative chest-CT slices for each class.
Representative slices, two per class. Source: Chest CT-Scan images (HF mirror dorsar/lung-cancer, MIT-licensed; originally Kaggle mohamedhanyyy).
02

The method

Transfer learning lets a small dataset go a long way — we reuse features a network already learned from millions of images.

  1. Preprocess

    Resize each slice to 224×224, normalise with ImageNet statistics, and augment the training set (flips, rotation, jitter) to resist overfitting.

  2. Backbone

    Take MobileNetV2 pretrained on ImageNet and freeze its convolutional feature extractor.

  3. New head

    Train a fresh dropout + linear classifier for the four CT classes with Adam and cross-entropy.

  4. Export

    Convert to ONNX so the model runs in your browser — verified to match PyTorch to ~1e-5.

03

The results

The model is near-perfect at the screening question — is there cancer at all? — and more modest at telling the three cancer subtypes apart, which overlap heavily on a single slice.

4-class accuracy
macro F1
macro AUC
sensitivity · cancer caught
specificity · normal cleared

Confusion matrix

Rows = true class · columns = predicted. The diagonal is correct.

Per-class performance

Precision, recall and F1 for each diagnosis.

Training and validation loss and accuracy.
Training history — loss and accuracy per epoch.
One-vs-rest ROC curves.
One-vs-rest ROC curves with per-class AUC.
Sample test predictions.
Sample test predictions — green = correct, red = mistake.
04

Where it looks

A model can be right for the wrong reasons. Grad-CAM overlays the regions of the scan that most drove each prediction — warmer means more influential.

Grad-CAM heatmaps overlaid on CT scans.
Grad-CAM heatmaps for correctly-classified cancer cases.
05

Test the model

Drop in a chest-CT slice — or pick a sample. Everything runs locally in your browser via ONNX Runtime Web. No upload, no server.

Drop a CT image
or click to browse

Samples

Loading model…

Results appear here once you analyse a scan.

06

The authors

Azizbek Okbutayev

Azizbek Okbutayev

Coder

Nozima Sotiboldiyeva

Nozima Sotiboldiyeva

Researcher