BornoViT: A Novel Efficient Vision Transformer for Bengali Handwritten Basic Characters Classification
Organizations: Department of Computer Science and Engineering, Islamic University of Technology, Gazipur 1704, Bangladesh
Abstract
Handwritten character classification in the Bengali script is a significant challenge due to the complexity and variability of the characters. The models commonly used for classification are often computationally expensive and data-hungry, making them unsuitable for resource-limited languages such as Bengali. In this experiment, we propose a novel, efficient, and lightweight Vision Transformer model that effectively classifies Bengali handwritten basic characters and digits, addressing several shortcomings of traditional methods. The proposed solution utilizes a deep convolutional neural network (DCNN) in a more simplified manner compared to traditional DCNN architectures, with the aim of reducing computational burden. With only 0.65 million parameters, a model size of 0.62 MB, and 0.16 GFLOPs, our model, BornoViT, is significantly lighter than current state-of-the-art models, making it more suitable for resource-limited environments, which is essential for Bengali handwritten character classification. BornoViT was evaluated on the BanglaLekha Isolated dataset, achieving an accuracy of 95.77%, and demonstrating superior efficiency compared to existing state-of-the-art approaches. Furthermore, the model was evaluated on our self-collected dataset, Bornomala, consisting of approximately 222 samples from different age groups, where it achieved an accuracy of 91.51%.
Figures & tables
| Layer | Description | Input Shape | Output Shape | Parameters |
|---|---|---|---|---|
| PatchEmbedding | Conv2D layer to split image into patches and project them to embedding dimension | (B, 3, 224, 224) | (B, 196, 128) | 98,432 |
| Positional Embedding | Learnable positional embedding added to the input patches | (B, 197, 128) | (B, 197, 128) | 25,216 |
| CLS Token | Learnable CLS token for classification | (1, 1, 128) | (B, 1, 128) | 128 |
| Dropout | Dropout applied to the patch and position embeddings | (B, 197, 128) | (B, 197, 128) | 0 |
| Transformer Blocks (x4) | Sequence of 4 Transformer blocks | (B, 197, 128) | (B, 197, 128) | 4x132,096 (Table III ) |
| LayerNorm | Normalize embeddings | (B, 197, 128) | (B, 197, 128) | 256 |
| Sub-layer | Description | Input Shape | Output Shape | Parameters |
|---|---|---|---|---|
| LayerNorm 1 | Layer normalization | (B, 197, 128) | (B, 197, 128) | 256 |
| Multi-Head Attention | Self-attention mechanism with 2 attention heads | (B, 197, 128) | (B, 197, 128) | 49,152 (QKV), 16,384 (O) |
| LayerNorm 2 | Layer normalization | (B, 197, 128) | (B, 197, 128) | 256 |
| MLP | Two linear layers with GELU and dropout | (B, 197, 128) | (B, 197, 128) | 33,024 (fc1), 33,024 (fc2) |
| Total | 132,096 |