This guide will walk you through the process of setting up the Arabic OCR Correction System on your machine.
- Python 3.9 or higher
- pip (Python package installer)
- Git (optional, for cloning the repository)
- Poppler (required for PDF processing)
If you haven't already downloaded the project:
git clone https://github.com/Marwan-Adawi/Graduation_Proj.gitCreating a virtual environment helps isolate the project dependencies:
# Create a virtual environment
python -m venv .venv
# Activate the virtual environment
# On Windows:
.venv\Scripts\activate
# On macOS/Linux:
source .venv/bin/activateThe project dependencies are listed in the requirements.txt file. Install them using pip:
pip install -r requirements.txtThis will install all the required libraries, including:
- torch and transformers (for deep learning models)
- opencv-python and scikit-image (for image processing)
- pdf2image (for PDF processing)
- numpy (for numerical operations)
- ultralytics (for object detection)
- and other dependencies
Poppler is required for PDF processing:
MacOS
brew install popplerLinux
sudo apt-get install poppler-utilsWindows Download and install Poppler from the official website: https://poppler.freedesktop.org/
If you encounter warnings about urllib3 or ipywidgets:
# Fix ipywidgets warning
pip install ipywidgets --upgrade
# Fix LibreSSL warning (if on macOS)
pip install urllib3==1.26.15The system includes a command-line script for processing PDF files with Arabic OCR:
python ocr_script.py --input your_file.pdf --output results.txt --transform --verbose--input,-i: Input PDF file path (default: test_OCR_2025.pdf)--output,-o: Output file path (auto-generated if not specified)--transform,-t: Apply scan transformation to images before OCR--format: Output format (txt or json, default: txt)--verbose,-v: Enable detailed progress output
- ocr_script.py: Main script for processing PDFs with Arabic OCR
- ocr_functions.py: Utility functions for PDF processing and image transformation
- Qariv03.py: Arabic OCR implementation using deep learning models
- Memory Issues: If you encounter memory errors when loading models, try using a smaller model or enabling model offloading.
- CUDA Errors: If using NVIDIA GPUs and encountering CUDA errors, ensure you have compatible CUDA drivers installed.
- MPS Issues: On Apple Silicon Macs, ensure you have the latest version of PyTorch that supports MPS acceleration.
For more detailed information, refer to the documentation of each library or open an issue in the project repository.