Giter VIP home page Giter VIP logo

ayahai's Introduction

AyahAi VER 1.0,

Quran Ayah Detection and Annotation using YOLOv5

By Mushafalummah©

English: ENGLISH DOC

Arabic: عربي

Turkish: TURKISH

Malaysian: MALAYSIAN

This document provides a detailed tutorial on how to use a Python project that detects and annotates ayahs in images of Quran pages using the YOLOv5 object detection model. The project comprises multiple files, including base_utils.py, global_info.py, line.py, page.py, and ayahai.py.

Requirements

To use this project, you need to have the following installed:

  • Python 3.10
  • OpenCV (opencv-python)
  • Pillow
  • PyTorch
  • Torchvision
  • Tkinter
  • Pandas

Install the Tkinter manually pip install tkinter and , You can install the rest required packages using the following command:

pip install -r https://raw.githubusercontent.com/ultralytics/yolov5/master/requirements.txt

Additionally, you will need the pre-trained YOLOv5 with Pytorch format model weights within a file named model1.pt.

Setting up the development environment

I recommend using PyCharm for the development environment. To set up the project in PyCharm, follow these steps:

  • Download and install PyCharm.
  • Create a new PyCharm project with a virtual environment using Python 3.10 as the interpreter.
  • Open the terminal in PyCharm and run the following command to install the required packages:

pip install -r https://raw.githubusercontent.com/ultralytics/yolov5/master/requirements.txt

Project Structure

The project is organized into the following files:

  • base_utils.py: Contains utility functions for the project.
  • global_info.py: Defines a class that keeps track of the surah and ayah numbers throughout the processing.
  • line.py: Defines a class representing a single line in a Quran page.
  • page.py: Defines a class representing an entire Quran page.
  • ayahai.py: The main script that ties everything together and processes images.

Usage

To use the project, follow these steps:

  • Prepare a folder containing images of Quran pages in JPEG, JPG, or PNG format.
  • Run ayahai.py in PyCharm.
  • When prompted, select the folder containing the images.
  • Enter the number of lines on each page, the first page, and the last page when prompted.

The script will process each image, detect and annotate ayahs, and save the annotated images in an output_full folder within the selected folder.

Sneak Peek and Explanation of Each File

  • Base_utils.py

This file contains utility functions to be used in the project.

  • Global_info.py

This file defines the GlobalInfo class, which is responsible for maintaining the surah and ayah numbers throughout the processing of the images.

  • line.py

This file defines the Line class, which represents a single line in a Quran page. It contains methods to skip a line, sort ayahs within a line

  • Page.py

This file defines the Page class, which represents an entire Quran page. It contains methods to sort ayahs into lines and generate bounding boxes for the detected ayahs, This class initializes a Page object with the given number of lines, predictions, image path, and global information object. It then creates the lines, sorts the predictions into the appropriate lines, and generates bounding boxes for the ayahs detected on the page.

  • ayahai.py

This file is the main entry point of the Quran Ayah detection and numbering application. It loads the model, processes the images, and generates the output images with the detected ayahs and their numbers.

We hope you find this tool helpful in your Quranic studies. If you need any assistance or have any questions, please don't hesitate to contact us. We are always happy to help and support your journey.

May Allah bless you and guide you on the right path.

Best regards,

Bllfoad, Mushafalummah

ayahai's People

Contributors

bllfoad avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ayahai's Issues

Incorrect Detection of Rubʻ Marker as Ayah Marker Leads to Inaccurate Ayah Count

Assalam Alaykum,

I would like to express my gratitude for the effort put into developing this Quran Mushaf AI model. Your dedication to this project is commendable, Jazak Allah Khaira.

After installing the necessary requirements, I ran main.py using these provided Mushaf pages and reviewed the results. I discovered that the model incorrectly identifies a Rubʻ marker as an Ayah marker, causing the Ayah count to be incremented by 1 (right after Ayah #43 in the following sample).

6

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.