Back to projects
Machine Learning

Bangla Grapheme Prediction

Trained a multi-head SEResNeXt50 classifier in PyTorch to jointly predict grapheme root, vowel, and consonant diacritics for Bengali handwriting. Submitted to a Kaggle competition.

  • PyTorch
  • SEResNeXt
  • Computer Vision
  • Kaggle

Why grapheme recognition is a multi-label problem

Bengali handwriting doesn't reduce to single-character classification: each glyph is composed of a grapheme root, an optional vowel diacritic, and an optional consonant diacritic, combined into thousands of visually distinct graphemes from only 168 root, 11 vowel, and 7 consonant components. The Kaggle competition (Bengali.AI Handwritten Grapheme Classification) scores all three independently, so the model has to predict three labels per image, not one.

Input imageSEResNeXt50shared backboneGrapheme root168 classesVowel diacritic11 classesConsonant diacritic7 classes

Model and pipeline

  • A shared SEResNeXt50 (se_resnext50_32x4d) backbone with three linear classification heads, one per label, trained jointly.
  • Data loaded from feather files instead of the source Parquet: roughly 2s per shard vs. ~60s. That's the difference between iterating on augmentation choices in an afternoon vs. a day.
  • Augmentation stack: affine transforms (rotation, scale, shear, translation) plus albumentations (grid distortion, cutout, piecewise affine, brightness/contrast, blur and Gaussian noise), needed because the same grapheme is drawn with real variation in stroke weight and slant across writers.
  • Training loop built on pytorch-ignite (Engine/Events), Adam at lr 1e-3 with ReduceLROnPlateau, over 100 epochs.
  • Metric: macro recall per head, combined as a weighted average (root weighted 2x vowel and consonant, matching the competition's own scoring) rather than plain accuracy. Root prediction is both the harder problem (168-way) and the one the score cares about most.

Backbone and training-loop scaffolding adapted from the public SEResNeXt reference kernel for this competition; the multi-head classifier, augmentation tuning, and training runs are this submission's work.