Giter Site home page Giter Site logo

yarahisham61 / nn-project Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 2.0 267.37 MB

Arabic Font Recognition System. Given an image containing a paragraph written Arabic, the system classifies the paragraph into one of four fonts (from 0 to 3).

License: MIT License

Jupyter Notebook 97.82% Python 2.18%

nn-project's Introduction

Arabic-Font-Recognition

Table of Contents

Overview

Given an image containing a paragraph written in Arabic, the system classifies the paragraph into one of four fonts (from 0 to 3) with classical machine learning techniques.

Font Code Font Name
0 Scheherazade New
1 Times New Roman
2 Lemonada
3 IBM Plex Sans Arabic

Project Pipeline

image

Preprocessing Module

This preprocessing module is designed to enhance the quality of images containing text before further analysis or processing. Here's a breakdown of the module:

  1. Salt and Pepper Noise Detection and Removal:
  • The detect_salt_and_pepper function assesses if the image contains salt and pepper noise.
  • If detected, it applies a median filter (median_filter) to reduce the noise.
  1. Binarization:
  • The binarizeImage function converts the grayscale image to a binary image, making text clearer for extraction.
  • It ensures the image is in black text on a white background.
  1. Hough Line Transform:
  • The hough_transforms function detects lines in the binary image using the Hough line transform.
  • It rotates the image to align detected lines horizontally.
  1. Text Orientation Correction:
  • The pytesseract_orientation function uses Tesseract OCR to detect the text orientation.
  • It rotates the image based on the detected orientation for proper alignment.
  1. Image Preprocessing Pipeline:
  • The preprocess function orchestrates the entire preprocessing pipeline:
  • Loads the image.
  • Detects salt and pepper noise and removes it if present.
  • Binarizes the image.
  • Applies the Hough transform to align text horizontally.
  • Corrects the text orientation.
  • Saves the preprocessed image.
  1. Segmentation of Text
  • The find_contours function identifies contours within the thresholded and dilated image.
  • Contours represent the boundaries of distinct objects or regions within the image.
  • It filters out small or insignificant contours based on width and height thresholds.
  • For each valid contour, it creates a bounding box around the region of interest and saves it as a separate image file in a specified output directory
  • The function returns the count of extracted regions.

Feature Extraction/Selection Module

We tried the following approaches:

  • Horizontal and vertical Histogram
  • Entropy
  • HoG
  • SIFT
  • Local Phase Quantization (LPQ) After comparing results of the listed above approaches we decided to use LPQ as it yields the best results

Model Selection/Training Module

We tried the following approaches:

  • KNN
  • SVM
  • Decision Tree
  • Random Forest After comparing results of the listed above approaches we decided to use Random Forest as it yields the best results with LPQ

Performance Analysis Module

Testing the above classifiers we got the following results:

  • Total Accuracy of KNN = 91.54481842707052 %
  • Total Accuracy of Decision Tree = 93.34605637273302 %
  • Total Accuracy of SVM = 71.19171382008213 %
  • Total Accuracy of Random Forest = 98.80024797790851 %

Final Results

Our System scored an accuracy of 98% on test data.

Contributors

Ahmed Samy
Ahmed Samy
Kareem Samy
Kareem Samy
Nancy Ayman
Nancy Ayman
Yara Hisham
Yara Hisham

License

This software is licensed under MIT License, See License

nn-project's People

Contributors

yarahisham61 avatar nancyalgazzar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.