Skip to content

Infinity027/Text_classification

Repository files navigation

Character Classification

Characters


[Content]

  1. Description
  2. Installation
  3. Model Training
  4. Model Testing
  5. Text Segmentation

[Description]

This project is a deep learning-based character classification model that recognizes 80 different types of characters using convolutional neural networks (CNNs). The model is trained on a dataset of characters and can predict the class of a given character image with high accuracy. Available Data for all classes(Training & Testing)

[Installation]

1.Clone the Repository

git clone https://github.com/Infinity027/Text_classification.git
cd Text_classification
  1. Install Dependencies
pip install -r requirements.txt

[Model Training]

To train the model on your dataset, run:

python3 train.py --data_dir "data" --batch_size 32 --epoch 100

Model Performance:

  1. Training data Accuracy: 96.43%
  2. Testing data Accuracy: 96%

Loss Graph | Accuracy Graph

[Model Testing]

To test the model run the test model, it will generate confusion matrix of testing data:

python3 testpy --test_dir "data/test" --batch_size 32 --model_path 'Modelv0_1.pth'

Confusion Matrix

[Text Segmentaion]

for character segmentation from text images, I used OpenCV. It involves preprocessing images, detecting text lines, segmenting words and characters, and using a trained deep learning model for recognition. run following code for character segmentation

python3 Segment.py --image_path "test/test.png" --c 4 --min_area 100 --draw_plot 0

Character Segmentation

Same 'character_recognition.py' python file extract the characters images from text image then sent it to model and predict the characters

python3 character_recognition.py --image_path "test/test.png" --c 4 --model_path 'modelv0_1.pth' --draw_plot 0

output: 'It was the best of times, it was the worst of times, it was tbe age of wisdom, it was the agc of foolishness '

About

Classify 80 different type of character from images

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages