Sacha Ryszfeld
All projects
  • Computer vision
  • Deep learning
  • Imbalanced data

White blood cell classification

April 2026

Macro-F1 per fold for the fine-tuned network and for XGBoost on its embeddings.

Classifying microscope images of white blood cells into 13 very imbalanced classes, from a baseline on handcrafted features to a fine-tuned ConvNeXt-Tiny with XGBoost on its embeddings, validated by 5-fold stratified cross-validation.

Key result
0.726 macro-F1 of the fine-tuned ConvNeXt-Tiny in 5-fold cross-validation
Context
IMA205 Kaggle challenge, Télécom Paris

The problem

28,901 training images, from 13,015 segmented neutrophils down to 11 prolymphocytes. The metric is the macro-F1, so every class weighs the same and the rare ones decide the score. Several of them are successive maturation stages of the same cell line and look very much alike.

Baseline on handcrafted features

The cell is segmented by Otsu thresholding on the saturation channel, and 35 features describe its shape, color and texture. The best of four classifiers, an MLP, reaches a macro-F1 of 0.429. Its accuracy is 0.80, because the large classes are well recognized while most rare classes are almost never predicted.

Iterating on a single split

Step Change Validation macro-F1 Kaggle
V0 ResNet-18, no rebalancing 0.680
V6 Class-balanced sampler, no cell crop 0.680
V7 Weight decay 5e-4 0.688 0.653
V9 Squeeze-and-Excitation attention 0.650 0.674
V10 Cosine classification head 0.696 0.629
V11 ConvNeXt-Tiny backbone 0.676

The validation split and the leaderboard often disagreed: the cosine head had the best validation score and the worst submission. With some classes having only a few validation images, one split was too noisy to choose between models, which led to cross-validation.

Final pipeline and results

On each of 5 stratified folds: fine-tune ConvNeXt-Tiny with a class-balanced sampler and early stopping, extract its 768-dimensional embeddings, and train XGBoost on them. The test prediction averages the 5 folds; this final submission scored 0.696 on the official Kaggle leaderboard, the best of all submissions.

Mean macro-F1 Std Min Max
ConvNeXt-Tiny 0.7257 0.0138 0.7052 0.7435
XGBoost on its embeddings 0.6935 0.0375 0.6619 0.7566

The fine-tuned network alone is better and more stable. One likely reason: XGBoost learns on embeddings of the images the network was just fine-tuned on, which are better separated than those of unseen images. The submitted ensemble used XGBoost, so the better option was not the one submitted.

Limitations

The validation fold also drives early stopping, so these scores are slightly optimistic. The remaining errors are on rare and similar classes: in the best fold, 48 of the 78 band neutrophils are predicted as segmented neutrophils, their mature form.