01Overview
↓
02Motivation
↓
03Approach
↓
04Implementation
↓
05Results
↓
06Challenges
↓
07What's Next
↓
← All Projects
Status Completed
Year 2023
Role Sole Researcher · Imperial College London
Stack Python · PyTorch · nnUNet · scikit-learn

02 / Project

Ovarian
Diagnosis

A fully automatic end-to-end pipeline for ovarian cancer diagnosis — combining VQ-UNet segmentation, blob analysis, and a random forest classifier to mirror the diagnostic workflow of radiologists.

Medical ImagingImage SegmentationDeep LearningCancer DiagnosisVector Quantisation
01

Overview

This MRes thesis proposes a fully automatic pipeline for diagnosing ovarian masses from transvaginal ultrasound scans. The system replicates the manual clinical workflow — segment, measure, classify — replacing each human step with a learned computational counterpart: nine VQ-UNet segmentation models, a blob analysis function that extracts geometric features, and a random forest classifier that outputs a benign or malignant diagnosis.

Ovarian cancer is the sixth most prevalent cancer among females in the UK, with approximately 7,500 new cases and over 4,000 deaths annually. The five-year survival rate exceeds 93% when caught at the earliest stage but falls to just 13% at late-stage diagnosis — making accurate, automated early detection a clinical priority. Ultrasound imaging is the preferred diagnostic modality, but its low signal-to-noise ratio and the subjectivity of manual interpretation create significant room for error.

The study was approved by the Queen Square Research Ethics Committee. All patient data was pseudonymised, with personal identifiers replaced by unique numeric codes prior to any analysis.

0.92F1 score of proposed pipeline — vs 0.79 for naive ResNet baseline
0.83AUC-ROC — 66% improvement over both ResNet baselines
252Dimensional feature vector fed to the random forest classifier
02

Motivation

Radiologists tasked with interpreting ovarian ultrasound scans invest substantial time analysing images with a characteristically low signal-to-noise ratio. The process is slow, subjective, and prone to misdiagnosis — particularly among less experienced sonographers. Existing automated approaches either operate end-to-end on raw pixel data without interpretable intermediate representations, or depend on hand-crafted risk models such as the IOTA ADNEX model that require manual feature entry by a clinician.

People should stop training radiologists now. It's just completely obvious within five years deep learning is going to do better than radiologists. — Geoffrey Hinton, 2016

The IOTA ADNEX model — the current standard for clinical risk stratification — classifies masses into four categories (benign, borderline, primary ovarian cancer, secondary metastatic) using nine inputs, six of which must be manually extracted from ultrasound scans. This process is both time-consuming and dependent on expert knowledge. The thesis asks whether a machine can replicate and exceed this process using only automatically extracted geometric and quantitative measurements.

Key research questions

  • Can vector quantisation improve the robustness of UNet-based segmentation on noisy ultrasound images?
  • Does binarising segmentation labels per-class outperform multi-class segmentation for this dataset?
  • Is diagnostic accuracy correlated with the quality of individual segmentation outputs, or does the high-dimensional feature representation provide resilience?
  • Can geometric and quantitative features alone — without textural or radiomics data — achieve competitive diagnostic accuracy against the state-of-the-art ODS radiomics model?
03

Approach

The proposed pipeline mirrors the traditional radiological workflow at every stage. Rather than training a single end-to-end model, the architecture decomposes the task into three interpretable components — segmentation, feature extraction, and classification — each optimised independently. Two naive baselines (a standard ResNet and a localised ResNet) are constructed to contextualise the proposed model's gains.

1
Data Collection and Preprocessing

Transvaginal ultrasound scans were collected under ethics approval, pseudonymised, and converted from nrrd/tif to nii.gz format. Border text was cropped from all images to prevent models learning from scan annotations. Labels were identically cropped to maintain pixel alignment. Data augmentation (zoom, crop, mirror, rotate) was applied and preprocessed via the nnUNet framework to expand the limited dataset.

2
Sub-experiments: VQ and Label Binarisation

Two preparatory experiments established the best model configuration before designing the full pipeline. Experiment one compared a standard UNet against a VQ-UNet on the same train/val/test split. Experiment two compared multi-class label training against per-label binary mask training. Both confirmed hypotheses: VQ improves segmentation (DSC 0.84 vs 0.79) and binarised labels outperform multi-class (DSC 0.85 vs 0.75).

3
VQ-UNet Segmentation (9 Models)

Nine VQ-UNet models were trained independently — one per anatomical label (entire lesion, locules, solid areas, papillations, and five cyst content variants). Each model was trained with binarised labels and individually tuned hyperparameters. The best-performing checkpoint per label was selected for the final pipeline.

4
Blob Analysis and Feature Extraction

Each of the nine segmentation masks was passed through a blob analysis function that extracts 28 geometric and numeric features per label — including area, perimeter, convexity, fitted ellipse parameters, fitted circle parameters, bounding rectangles, and extremal points. The nine 28-dimensional vectors were concatenated into a single 252-dimensional feature vector.

5
Random Forest Classification

The 252-dimensional feature vector served as the input to a random forest classifier trained to output a binary diagnosis: benign or malignant. The classifier's inherent feature selection and ensemble averaging provided robustness to individual segmentation errors. Its performance was benchmarked against two ResNet baselines and the state-of-the-art ODS radiomics model.

The Proposed Model — Dataset feeds into 9 VQ-UNet models (Label 1–9), each producing a segmentation mask. Masks pass through the Blob Analysis Function to produce Numeric Feature Arrays, which are concatenated and fed to a Random Forest Classifier outputting Benign or Malignant.

Fig. 1 — Architecture of the proposed pipeline. Nine independently trained VQ-UNet segmentation models produce per-label masks; blob analysis extracts 28 geometric features per label; a random forest classifier outputs the final diagnosis.

04

Implementation

The VQ-UNet architecture adds a vector quantisation block at the bottleneck of a standard UNet — strategically positioned between the encoder and decoder at the latent space. The codebook consists of learnable vectors with the same dimensionality as the latent feature map, initialised randomly and trained via a custom quantisation loss. The full model can be expressed as a composite function F = Fd ∘ Fq ∘ Fe, where Fe is the contracting encoder, Fq is the quantisation block, and Fd is the expanding decoder.

The quantisation process acts as a noise smoother: by mapping encoder outputs to the nearest codebook entry, high-frequency noise perturbations are discarded at the bottleneck before the decoder reconstructs the segmentation mask. This is the key reason VQ-UNet outperforms standard UNet on ultrasound data, which has a characteristically low signal-to-noise ratio.

Label #Anatomical RegionDSCHD (px)ASSD (px)
1Entire Lesion0.8535.549.59
2Locules0.8536.348.74
3Solid Areas0.6940.0712.05
4Papillations0.8246.338.91
5Cyst Contents: Anechoic0.8251.5813.03
6Cyst Contents: Low Level0.8244.919.76
7Cyst Contents: Ground Glass0.7057.7413.33
8Cyst Contents: Haemorrhage0.8048.5916.28
9Cyst Contents: Mixed0.6346.9317.70

Across all nine models, the average Dice score was 77.5%, average Hausdorff distance 45.3 pixels, and average ASSD 12.1 pixels. The average HD/ASSD ratio of 389% — ranging from 270% (label 9) to 520% (label 4) — indicates that failure cases tend to fail more severely than successful cases succeed, a pattern visible in the pronounced lower-bound whiskers of the DSC box plots. Misclassification primarily stems from textural overlap: dark noisy regions are misidentified as locules or anechoic cyst contents.

28 geometric and numeric features extracted per segmentation label

  • Shape features — Area, Perimeter, Convexity, Aspect Ratio, Extent, Solidity, Hull Area, Number of Blobs
  • Fitted Ellipse — Centre (x, y), Width, Height, Angle
  • Fitted Circle — Radius, Centre (x, y)
  • Rotated Bounding Rectangle — four corner coordinates (x1, y1, x2, y2)
  • Axis-aligned Bounding Rectangle — four corner coordinates (x1, y1, x2, y2)
  • Extremal points — Width, Height, Y of leftmost point, Y of rightmost point

A key empirical finding during training was that larger batch sizes did not correlate with better model performance — and in many cases smaller batch sizes produced superior results. This was attributed to the lack of visual similarity between different ground truth label instances, meaning the model gained little from batched gradient estimation. All models were therefore trained with reduced batch sizes, each treated as an individual learning example.

05

Results

The proposed pipeline substantially outperforms both ResNet baselines across all five evaluation metrics, and matches or exceeds the state-of-the-art ODS radiomics model on F1 score while achieving a higher accuracy. The most striking result is the AUC-ROC improvement: both ResNet baselines score approximately 0.5, equivalent to random chance, whereas the proposed model achieves 0.83 — a 66% relative improvement, demonstrating genuine discriminative ability.

ModelF1AccuracyAUC-ROCPrecisionRecall
Naive ResNet0.790.660.490.690.91
Localised ResNet0.810.690.500.691.00
Proposed Pipeline0.920.860.830.870.97
ODS Radiomics (SOTA)0.83—0.900.721.00

The proposed model's higher recall than precision is a deliberate and clinically desirable property. A system deployed for clinical triage should err on the side of sending benign patients for further examination rather than miss a patient with a malignant mass in urgent need of treatment. The imbalanced class distribution in the dataset partially explains the lower AUC-ROC relative to the ODS model, which was designed to prioritise robustness over point-estimate accuracy.

+13.6%F1 improvement over localised ResNet baseline
+24.6%Accuracy improvement over localised ResNet baseline
+66%AUC-ROC improvement over both ResNet baselines (0.50 → 0.83)

A sensitivity analysis was conducted to test whether diagnostic accuracy depended on any particular segmentation label. Both label-wise omission (removing all 28 features for one label at a time) and element-wise omission (removing one feature at a time) produced near-identical aggregate metrics — mean F1 of 0.92 with standard deviations of 0.0068 and 0.0024 respectively. Leave-one-out cross validation across the nine decision trees confirmed the same finding: mean F1 of 0.9038 with standard deviation 0.0053. No single label or feature dominates the diagnosis.

VariationF1AccuracyAUC-ROCPrecisionRecall
Proposed Pipeline0.920.860.830.870.97
Avg. Label-wise Omission0.920.860.840.870.97
Avg. Element-wise Omission0.920.870.840.880.97
06

Challenges

Three interlinked challenges constrained the scope and generalisability of the findings, each rooted in the practical realities of a single-researcher MRes project operating on a small, ethically restricted medical dataset.

Small and class-imbalanced dataset

Medical ultrasound data is expensive to collect, annotate, and ethically approve. The limited number of scans — with fewer samples representing rarer labels — created class imbalance that penalised the segmentation models for minority labels (notably label 9, Cyst Contents: Mixed, achieved only DSC 0.63). Data augmentation via zooming, cropping, mirroring, and rotation partially mitigated this, but could not fully substitute for more diverse real data.

Textural misclassification in segmentation

Several segmentation models incorrectly identified dark, shadowy regions as target labels — most visibly in labels 2, 5, and 7 — because the noisy ultrasound texture of those regions closely resembled the ground truth appearance of the targeted anatomy. The models lack embedded anatomical prior knowledge that a trained radiologist would use to disambiguate these regions spatially.

VQ incompatibility with multi-class segmentation

Vector quantisation, while highly effective for binary (per-label) segmentation, hurt performance in multi-class segmentation settings (DSC dropped from 0.75 to 0.75 without VQ in multi-class). The quantisation block appears to discard fine-grained class-boundary information when forced to represent multiple class semantics in a single shared codebook. Resolving this incompatibility — which would allow VQ-UNets to serve a broader range of tasks — was identified as the most significant open problem from this work.

07

What's Next

The thesis identifies four concrete extensions that would directly address the current limitations and significantly increase the clinical readiness of the proposed pipeline.

  • Resolve the VQ and multi-class segmentation incompatibility — investigating whether separate per-class codebooks, hierarchical quantisation, or modified commitment losses can preserve class-boundary information while retaining the noise-robustness benefits of VQ.
  • Embed anatomical prior knowledge into the segmentation models — moving towards a neural-symbolic approach that uses clinical logic as a guide to disambiguate texturally similar regions (e.g. preventing the model from labelling non-lesion dark regions as locules).
  • Expand automated feature extraction — leveraging the model's capacity for high-volume geometric feature generation to construct richer feature vectors, potentially incorporating textural and radiomics-style features alongside the current geometric set for a comprehensive comparison.
  • External and large-scale clinical validation — running the full pipeline on a larger, more diverse multicentre dataset in collaboration with clinical teams, and integrating the model into real diagnostic workflows to assess readiness for regulatory approval and clinical deployment.