项目作者: kmjawadurrahman

项目描述 :
An application to classify handwritten Bengali graphemes.
高级语言: Jupyter Notebook
项目地址: git://github.com/kmjawadurrahman/bengali-grapheme-classifier-app.git


Bengali Grapheme Classifier App

An application to classify handwritten Bengali graphemes.

Grapheme Components

Image source

Interact with the streamlit application here.

App preview:
App preview

This short YouTube video and this blog post describes the project.

Table of contents

Dataset

The dataset is introduced in this paper: A Large Multi-Target Dataset of Common Bengali Handwritten Graphemes.

The dataset is open-sourced as a part of a public Handwritten Grapheme Classification Challenge on Kaggle to benchmark vision algorithms for multi-target grapheme classification.

Link to Kaggle page: Bengali.AI Handwritten Grapheme Classification

You can read the paper summary here.

Model

A simple Convolutional Neural Network model has been used. The training code is mostly based on this Kaggle kernel with minor tweaks.

Project Structure

  1. .gitignore
  2. app.py
  3. packages.txt
  4. README.md
  5. requirements-dev.txt
  6. requirements.txt
  7. ├───assets
  8. app-preview.gif
  9. grapheme-components.png
  10. header.png
  11. ├───docs
  12. Grapheme-paper-review.docx
  13. Grapheme-paper-review.pdf
  14. ├───input
  15. class_map.csv
  16. ├───bengaliai-cv19
  17. class_map.csv
  18. class_map_corrected.csv
  19. sample_submission.csv
  20. test.csv
  21. test_image_data_0.parquet
  22. test_image_data_1.parquet
  23. test_image_data_2.parquet
  24. test_image_data_3.parquet
  25. train.csv
  26. train_image_data_0.parquet
  27. train_image_data_1.parquet
  28. train_image_data_2.parquet
  29. train_image_data_3.parquet
  30. train_multi_diacritics.csv
  31. ├───kalpurush-fonts
  32. kalpurush-2.ttf
  33. ├───sample-images
  34. └───upload-images
  35. ├───model
  36. model.png
  37. └───my_model
  38. saved_model.pb
  39. └───variables
  40. └───notebooks
  41. └───Bengali Graphemes Multi Output CNN.ipynb

app.py - The streamlit app code, including input image preparation and inference logic.

packages.txt - List of OS level dependencies. Required for deploying app via share.streamlit.io.

requirements-dev.txt - List of required Python packages for dev environment (for training model using Jupyter and running streamlit app locally).

requirements.txt - List of Python packages required for deploying app via share.streamlit.io.

docs - Folder containing paper summary document.

input/class_map.csv - Maps the class labels to the actual Bengali grapheme components.

input/bengaliai-cv19 (gitignored) - Data files obtained from Kaggle. See Setup and Installation.

input/sample-images - Sample images used by the streamlit app when input mode is set to “Use provided images”.

input/upload-images - Some samples of my own handwriting that you can upload when input mode is set to “Upload own character images”.

model - Folder containing saved model and an image of the model architecture.

notebooks - Folder containing the Jupyter Notebook for model training.

Setup and Installation

Prerequisite: Python 3.7

Install required packages in a Python virtual environment:

  1. $ pip install -r requirements-dev.txt

Next, to obtain the data from Kaggle, set up official Kaggle API from here.

After setting up the official Kaggle API, open terminal and run:

  1. $ kaggle competitions download -c bengaliai-cv19

Unzip the downloaded file and arrange the data in the input folder as shown in the Project Structure section.

Usage

To explore the dataset or train the model, run the Jupyter Notebook - notebooks/Bengali Graphemes Multi Output CNN.ipynb

To run the streamlit app using the provided pre-trained model, run:

  1. $ streamlit run app.py

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.