Reading ultrasound is hard and the public dataset is small and imbalanced. Before reaching for deep learning I wanted a fair answer to a simple question: does it actually beat a well-built classic pipeline, and by how much?
EfficientNet-B0 (deep model)95.75%
Random Forest + PCA (baseline)58.2%
How I built it
01
Balance the data
A TensorFlow augmentation pipeline — flips, 90/180/270° rotations, random crops — generated 4,000 images per class.
02
Deep model
EfficientNet-B0 pretrained on ImageNet, head replaced for 3 classes; 224×224 input, Adam (lr 1e-4), 25 epochs.
03
Classic baseline
Images at 64×64, flattened, reduced to 100 PCA components, then a 100-tree Random Forest with balanced class weights.
04
Evaluate
Accuracy, weighted F1, AUC-ROC and a per-class report for both models on the same held-out images.
// how the data moves
ultrasound_pipeline — live
How it worksdata flows ↓
01
BUSI imagesbenign · malignant · normal
02
Balance classesaugmented to 4,000 per class
03
EfficientNet-B0pretrained, then fine-tuned
04
Evaluateaccuracy, F1 and AUC-ROC on held-out scans
[ DECISION LOG ]
What went wrong, and what I decided.
// 3 decisions
D1
The dataset was small and imbalanced.
what happened
Training on it directly would favour the biggest class.
decision
Augmented every class to 4,000 images.
result
A balanced 12,000-image set for both models.
D2
Full-size pixels were too many features for classic ML.
what happened
A Random Forest on 224×224×3 raw values is slow and noisy.
decision
Resized to 64×64 and kept 100 PCA components for the baseline.
result
A fair, tractable baseline: 58.2% accuracy.
D3
The baseline missed too many cancers.
what happened
It caught only 55% of malignant cases — not acceptable for screening.
decision
Used EfficientNet-B0 transfer learning on the same balanced data.