The problem
Differential blood counts are routine but labour-intensive, and some white-cell types differ only subtly. The questions were how much of each image actually carries signal, whether the rest could be discarded to make training and storage cheaper, and how to turn the notebook model into a service a lab could run.
Approach
- Data science: 17,092 images from Hospital Clínic de Barcelona across 8 classes. Extracted morphological features (cell area, perimeter, circularity) to understand the classes and flag outliers.
- Segmentation: compared a U-Net trained on 350 hand-annotated masks with an improved GrabCut initialisation. Masking the background and dropping outliers cut the corpus from 868 MB to 593 MB (−31.7%).
- Model: VGG16 with frozen ImageNet weights, GAP, Dense, Dropout and softmax(8) for transfer learning on the masked images.
- Serving: three FastAPI microservices (auth, preprocessing, prediction) behind a Streamlit/Flask frontend. The same GrabCut preprocessing runs at inference to avoid training/serving skew.
- MLOps: MLflow tracking with metric-gated model promotion, DVC data versioning, Airflow training pipeline, Jenkins CI with pytest, Docker, Kubernetes and Helm, Prometheus and Grafana monitoring, and Terraform for AWS (EKS, S3, ECR).
Result
94% accuracy across eight cell types, a 31.7% smaller dataset and 14 minutes faster training, with the segmented dataset published on Kaggle. The local Kubernetes deployment was demonstrated end to end, and the AWS roll-out was fully defined in Terraform (DataScientest capstone, team of three).
