A custom SE-ResNet CNN that reads handwritten Bengali characters
with 95% validation accuracy across 84 character classes.
Overview
Bengali is spoken by 230M+ people worldwide. Digitizing handwritten Bengali text automatically is extremely challenging due to the complexity of 84 unique character classes including vowels, consonants, digits, and compound characters.
A custom SE-ResNet architecture with Depthwise Separable Convolutions and Squeeze-and-Excitation blocks, trained on 166K+ labeled images with advanced augmentation including Cutout regularization.
95% validation accuracy and 90% test accuracy across all 84 classes. The trained model is publicly available for download via GitHub Releases. A web-based demo is in progress.
Dataset
Architecture
Each block uses Depthwise Separable Convolutions (more efficient than standard Conv2D) combined with a Squeeze-and-Excitation (SE) attention mechanism that recalibrates channel-wise feature responses.
x → Conv2D(1×1) # pointwise expand → DepthwiseConv2D(3×3) # spatial filter → Conv2D(1×1) # pointwise compress → BatchNorm → ReLU → SE Block (ratio=16) # channel attention → Add(skip connection) # residual
Results
Live Output
import tensorflow as tf
import numpy as np
from PIL import Image
model = tf.keras.models.load_model(
"final_bangla_cnn_model.keras"
)
img = Image.open("char.png")\
.convert("L")\
.resize((32, 32))
x = np.array(img) / 255.0
x = x.reshape(1, 32, 32, 1)
pred = model.predict(x)
cls = np.argmax(pred)
conf = np.max(pred) * 100
print(f"Class: {cls} Conf: {conf:.2f}%")
Development
Tech Stack
Core language
Deep learning framework
Model API (Functional)
Array operations
Training visualization
Confusion matrix plot
Image preprocessing
T4 x2 training
Source code, trained model, and notebook all publicly available