Skip to content
HasanAI
Log in Sign up
Kaggle Winners Archive / HMS - Harmful Brain Activity Classification
Tabular Healthcare 2024

HMS - Harmful Brain Activity Classification

Harvard Medical School
2767 teams
Kullback Leibler Divergence
50,000 Usd
Ended April 08, 2024
View on Kaggle

What the winners did

Compared from 3 published write-ups Β· AI summary, check the originals

The hard part: The competition required handling massive, noisy EEG data with ambiguous labels (indicated by vote counts), where distinguishing true signal from augmented duplicates and selecting the right representation (2D vs 1D, time vs frequency) was critical for generalization.

Lessons to take to your next competition All lessons & trends β†’

  1. Treating multichannel time-series data as 2D images (montages) can be more effective than treating channels independently, as it preserves spatial context for vision transformers/CNNs.
  2. Rigorous data cleaning is essential; identifying and separating original signals from augmented duplicates (e.g., via vote counts) significantly improves validation reliability and model performance.
  3. Ensembling diverse model architectures (e.g., 1D vs 2D, different backbones) generally yields better results than scaling a single architecture, but simple averaging may not capture optimal interactions, suggesting learned blending can be superior.
  4. Post-processing steps like adjusting class biases or learning ensemble weights can provide significant leaderboard jumps, sometimes rivaling the gains from adding new models.
  5. Avoiding information leakage is critical; batch-wise normalization and using long-duration spectrograms that dilute specific events can hurt performance compared to carefully normalized, shorter-segment features.

Shared by the top teams (the baseline)

  • Using a 'double banana' montage or 2D image structure to arrange 16 EEG channels, allowing 2D vision backbones to capture spatial relationships between left and right brain hemispheres. holiday, nvidia/DD
  • Filtering or weighting training data based on the number of votes (vote_num) to prioritize high-confidence labels and remove redundant augmented duplicates. holiday, nvidia/DD
  • Applying bandpass filtering (e.g., Butterworth or MNE) and amplitude clipping (e.g., to Β±1024) to clean the raw EEG signal before feature extraction. holiday, nvidia/DD
  • Utilizing pretrained vision backbones (2D or 3D CNNs) and employing cosine learning rate scheduling during training. holiday, nvidia/DD

What set each team apart (the edge)

  • holiday: Implemented a two-stage training process where the loss weight was initially proportional to the number of voters, then switched to a fixed weight for lower-confidence data, combined with a 'double-head' model concatenating features from 3D spectrum and 2D raw EEG models.
  • nvidia/DD: Combined 1D CNNs with Squeezeformer blocks alongside 2D Mixnet models, and used a lightweight neural network to learn optimal blend weights for the 23-model ensemble, plus added class-specific bias terms to logits.

Side by side

The same questions answered for each published solution
TeamValidationModelsEnsembling & post-processingDidn't work
#1 team Sony
The solution relied on a collective ensemble pipeline contributed by four distinct team members using Group K-fold validation.
  • Used Chris's method: normalize by summing labels with eeg_id and crop middle 10,000 frames.
  • Employed Group K-fold with a 5-fold split.
  • Required vote >=10 for validation.
not mentioned
  • Prediction pipeline combined contributions from yamash, suguuuuu, kfuji, and Muku.
not mentioned
#2 holiday
Concatenating 16-channel EEG into a 'double banana' montage image allows 2D/3D vision backbones to capture position-sensitive label information better than treating channels as separate images.
  • 10-fold cross-validation used for training.
  • Moved 1000 samples from validation to training, leaving 709 in val set.
  • Validation performed using samples with vote_num >= 6.
  • CV scores (e.g., 0.21+) correlated with public/private LB scores (e.g., 0.25/0.29).
  • X3D-L (3D-CNN) for spectrum features.
  • EfficientNet-B5 (2D-CNN) for raw EEG and spectrum images.
  • HGNet-B5 (2D-CNN) for raw EEG.
  • Double-head model concatenating X3D-L spectrum and EfficientNet-B5 EEG features.
  • Final ensemble of 6 models: 2 spectrum, 3 raw EEG, 1 mixed.
  • Combined MNE and scipy.signal filtered models for diversity.
  • Feeding bsx4xHxW input to 2D-CNN produced worse results than one-image method.
  • Ensembling 6 models improved score only slightly (0.28->0.27 private LB).
#3 nvidia/DD
A robust solution combining 2D-CNNs on MelSpectrograms and 1D-CNNs with Squeezeformer, driven by rigorous data filtering and diverse augmentations.
  • Used 4-fold cross-validation split by patient ID to ensure generalization.
  • Filtered validation set to rows with >9 votes to remove redundancy.
  • Achieved strong correlation between cross-validation scores and leaderboard results.
  • Identified that filtering out augmented duplicate rows improved validation reliability.
  • 2D branch: Pretrained Mixnet backbones fed with concatenated 16-channel MelSpectrograms.
  • 1D branch: Lightweight CNN with grouped convolutions followed by Squeezeformer blocks.
  • 1D model used Conv2D to simulate Conv1D while interacting across all channels.
  • Replaced CBAM attention with 3 layers of Squeezeformer for better stability.
  • Combined 5 1D CNN models and 18 Mixnet 2D CNN models into an ensemble.
  • Used a simple neural network to learn optimal blend weights for the 23 models.
  • Added a bias term for each of the 6 classes to the logits.
  • Class bias adjustment jumped public leaderboard rank from 9th to 4th.
  • Pseudo-labeling was tried but did not help performance.
  • Stacking 16 signals next to each other caused unwanted neighbor interactions.
  • Increasing hidden dimension or depth in 1D Squeezeformer did not help.
  • Using 10-minute spectrograms did not significantly improve 2D model results.

Solution cards

Structured notes from each write-up β€” the original is linked
πŸ₯‡ team Sony 0.272332 The solution relied on a collective ensemble pipeline contributed by four distinct team members using Group K-fold validation.

Validation

  • Used Chris's method: normalize by summing labels with eeg_id and crop middle 10,000 frames.
  • Employed Group K-fold with a 5-fold split.
  • Required vote >=10 for validation.

Ensembling & post-processing

  • Prediction pipeline combined contributions from yamash, suguuuuu, kfuji, and Muku.
Read the full write-up on Kaggle β†’
πŸ₯ˆ holiday 0.273765 Concatenating 16-channel EEG into a 'double banana' montage image allows 2D/3D vision backbones to capture position-sensitive label information better than treating channels as separate images.

Validation

  • 10-fold cross-validation used for training.
  • Moved 1000 samples from validation to training, leaving 709 in val set.
  • Validation performed using samples with vote_num >= 6.
  • CV scores (e.g., 0.21+) correlated with public/private LB scores (e.g., 0.25/0.29).

Data & preprocessing

  • Raw EEG data shaped as bsx16x10000.
  • Filtered using MNE (0.5-20Hz) or scipy.signal (butter filter).
  • Amplitude clipped to range +-1024.
  • STFT applied with n_fft=512, win_length=128, hop_length 10 or 50.

Features

  • Double banana montage: 16 channels rearranged into a 2D image structure.
  • Spectrum images generated via STFT, clipped, and scaled by /1000.
  • Raw EEG reshaped to bsx3x160x1000 for 2D vision models.
  • Spectrum images duplicated 3 times to match RGB channel input.

Models

  • X3D-L (3D-CNN) for spectrum features.
  • EfficientNet-B5 (2D-CNN) for raw EEG and spectrum images.
  • HGNet-B5 (2D-CNN) for raw EEG.
  • Double-head model concatenating X3D-L spectrum and EfficientNet-B5 EEG features.

Training tricks

  • Stage 1: 15 epochs, loss weight voters_num/20, Adamw lr=0.001, cosine scheduler.
  • Stage 2: 5 epochs, loss weight=1, filter vote_num>=6, Adamw lr=0.0001, cosine scheduler.
  • Augmentations: mirror EEG, flip left/right brain data.
  • Random eeg_label_offset_seconds chosen per eegid for target averaging.
  • Pretrained weights used for all backbones.

Ensembling & post-processing

  • Final ensemble of 6 models: 2 spectrum, 3 raw EEG, 1 mixed.
  • Combined MNE and scipy.signal filtered models for diversity.

What didn't work

  • Feeding bsx4xHxW input to 2D-CNN produced worse results than one-image method.
  • Ensembling 6 models improved score only slightly (0.28->0.27 private LB).
Read the full write-up on Kaggle β†’
πŸ₯‰ nvidia/DD 0.274112 A robust solution combining 2D-CNNs on MelSpectrograms and 1D-CNNs with Squeezeformer, driven by rigorous data filtering and diverse augmentations.

Validation

  • Used 4-fold cross-validation split by patient ID to ensure generalization.
  • Filtered validation set to rows with >9 votes to remove redundancy.
  • Achieved strong correlation between cross-validation scores and leaderboard results.
  • Identified that filtering out augmented duplicate rows improved validation reliability.

Data & preprocessing

  • Filtered 106k training rows down to 6350 original 'true' data points.
  • Distinguished original EEG segments from augmented shifts using SPaRCNet paper insights.
  • Used high-quality (>8 votes) data for 2D models and lower-vote data for 1D models.
  • Discarded 10-minute spectrograms as they provided no significant benefit.
  • Avoided pseudo-labeling as it did not improve performance in experiments.

Features

  • Applied MelSpectrogram transformation on-the-fly using torchaudio GPU implementation.
  • Used 'double banana montage' ordering for 16 EEG channels to group left/right brain.
  • Applied Butter bandpass filter (order 2) with variable low/highpass frequencies.
  • Normalized signal via clipping to [-1024, 1024] and dividing by 32.
  • Avoided batch-wise or sample-wise normalization to prevent information leakage.

Models

  • 2D branch: Pretrained Mixnet backbones fed with concatenated 16-channel MelSpectrograms.
  • 1D branch: Lightweight CNN with grouped convolutions followed by Squeezeformer blocks.
  • 1D model used Conv2D to simulate Conv1D while interacting across all channels.
  • Replaced CBAM attention with 3 layers of Squeezeformer for better stability.
  • Added pointwise convolutions around depthwise convolutions in the 1D architecture.

Training tricks

  • 2D models: 12-16 epochs, cosine LR decay (init 0.0012), batch size 32, drop path 0.2.
  • 1D models: ~32 epochs, cosine LR decay (init 0.001), batch size 64 or 256.
  • Augmentations included zeroing melspec nodes, random bandpass shifts, and time shifts.
  • 1D-specific augmentations: left-right time flip and brain side switch (50% probability).
  • 2D-specific augmentations: random shift of 10s center within 50s window.
  • 1D training used decayed loss weights for low-vote data (3-8 and 1-2 votes).

Ensembling & post-processing

  • Combined 5 1D CNN models and 18 Mixnet 2D CNN models into an ensemble.
  • Used a simple neural network to learn optimal blend weights for the 23 models.
  • Added a bias term for each of the 6 classes to the logits.
  • Class bias adjustment jumped public leaderboard rank from 9th to 4th.
  • Mean blend with higher weighting on 2D models was the initial strategy.

What didn't work

  • Pseudo-labeling was tried but did not help performance.
  • Stacking 16 signals next to each other caused unwanted neighbor interactions.
  • Increasing hidden dimension or depth in 1D Squeezeformer did not help.
  • Using 10-minute spectrograms did not significantly improve 2D model results.
Read the full write-up on Kaggle β†’

No public write-up found for: #4 Aillis & GO & bilzard, #5 KTMUD.

Most Used Techniques

Aggregated across all top solutions
Augmentation 2
Ensemble 2
PyTorch 2
Cross Validation 1
EfficientNet 1
Blending 1
CNN 1
GPT 1
GRU 1
HuggingFace 1
Neural Network 1
Pseudo Labeling 1
ResNet 1
Stacking 1

Podium Solutions

Gold, Silver, and Bronze winning approaches
πŸ₯‡

team Sony

Score 0.272332
Cross Validation

Key idea: The solution relied on a collective ensemble pipeline contributed by four distinct team members using Group K-fold validation.

See the solution card β†’
πŸ₯ˆ

holiday

Score 0.273765
Augmentation EfficientNet Ensemble PyTorch

Key idea: Concatenating 16-channel EEG into a 'double banana' montage image allows 2D/3D vision backbones to capture position-sensitive label information better than treating channels as separate images.

See the solution card β†’
πŸ₯‰

nvidia/DD

Score 0.274112
Augmentation Blending CNN Ensemble GPT GRU HuggingFace Neural Network Pseudo Labeling PyTorch ResNet Stacking

Key idea: A robust solution combining 2D-CNNs on MelSpectrograms and 1D-CNNs with Squeezeformer, driven by rigorous data filtering and diverse augmentations.

See the solution card β†’

Full Solutions Leaderboard

5 solutions archived
Rank Team Score Techniques Write-up
πŸ₯‡
team Sony
0.272332
Cross Validation
πŸ₯ˆ
holiday
0.273765
Augmentation EfficientNet Ensemble PyTorch
πŸ₯‰
nvidia/DD
0.274112
Augmentation Blending CNN Ensemble GPT GRU HuggingFace Neural Network Pseudo Labeling PyTorch ResNet Stacking
#4
Aillis & GO & bilzard
0.276039
β€”
β€”
#5
KTMUD
0.276157
β€”
β€”

Related Competitions

Same type: Tabular