An AI-powered computer vision system for detecting and segmenting ancient Egyptian hieroglyphs from archaeological images using YOLOv8 instance segmentation.
- Overview
- Features
- Model Performance
- Dataset
- Installation
- Usage
- Project Structure
- Results
- Future Work
- Contributors
- Acknowledgments
This project implements a deep learning solution for automatically detecting and segmenting individual hieroglyphs from images of ancient Egyptian inscriptions, temple walls, and artifacts. The system uses YOLOv8's instance segmentation architecture to identify hieroglyphs with pixel-level precision.
- 235,436 hieroglyph instances in training dataset
- 70.9% mAP@0.5 on validation set
- Real-time inference with user-friendly GUI
- Advanced preprocessing pipeline for archaeological images
- Instance Segmentation: Precise pixel-level masks for each hieroglyph
- Multi-scale Detection: Works on hieroglyphs of varying sizes
- Preprocessing Pipeline:
- CLAHE contrast enhancement
- Non-local means denoising
- Image normalization and resizing
- Interactive GUI: Tkinter-based interface for easy inference
- Visualization: Confidence scores and bounding boxes overlay
| Metric | Score |
|---|---|
| mAP@0.5 | 70.9% |
| mAP@0.5:0.95 | 42.5% |
| Precision | 100% @ conf=1.0 |
| Recall | 62% @ conf=0.0 |
| F1-Score | 75% @ conf=0.398 |
- Model: YOLOv8n-seg (nano variant)
- Epochs: 25
- Batch Size: 8
- Image Size: 640ร640
- Optimizer: SGD (lr=0.01)
- Device: CUDA (GPU accelerated)
The dataset consists of annotated images from various Egyptian archaeological sites including:
- Temple wall inscriptions
- Obelisk carvings
- Papyrus documents
- Stone tablets and stelae
Dataset Statistics:
- Total Instances: 235,436 hieroglyphs
- Train/Val/Test Split: Standard YOLO format
- Annotation Format: YOLO segmentation (polygon coordinates)
- Single Class: "hieroglyph" (unified approach)
- Python 3.8+
- CUDA-compatible GPU (recommended)
- 8GB+ RAM
- Clone the repository
git clone https://github.com/EngAdhamTamer/hieroglyph-detection.git
cd hieroglyph-detection- Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Download pre-trained weights
# Download from releases
# Place best.pt in runs/segment/hieroglyph_seg/weights/See DOWNLOAD_MODELS.md for detailed instructions.
Run the interactive GUI for easy image inference:
python gui2.pySteps:
- Click "Load Image"
- Select an image with hieroglyphs
- View detection results with masks and bounding boxes
python train_yolo.pyModify train_yolo.py to adjust:
- Number of epochs
- Batch size
- Learning rate
- Data augmentation parameters
Preprocess your dataset before training:
python preprocessing.pyThis applies:
- Resizing to 640ร640
- CLAHE contrast enhancement
- Denoising
- Normalization
Convert multi-class labels to single class:
python preprocessing_labels.pyhieroglyph-detection/
โโโ dataset/
โ โโโ train/
โ โ โโโ images/
โ โ โโโ labels/
โ โโโ valid/
โ โ โโโ images/
โ โ โโโ labels/
โ โโโ test/
โ โ โโโ images/
โ โ โโโ labels/
โ โโโ data.yaml
โโโ runs/
โ โโโ segment/
โ โโโ hieroglyph_seg/
โ โโโ weights/
โ โ โโโ best.pt
โ โโโ results/
โโโ preprocessing.py
โโโ preprocessing_labels.py
โโโ train_yolo.py
โโโ gui2.py
โโโ requirements.txt
โโโ args.yaml
โโโ README.md
The model successfully detects and segments 235K+ hieroglyph instances with precise pixel-level masks. Each detected hieroglyph is highlighted with a green segmentation mask and red bounding box, demonstrating the system's ability to identify individual symbols even in dense inscriptions.
The training curves show consistent improvement across all metrics over 25 epochs:
- Loss curves (top row): Steady decrease in box, segmentation, classification, and DFL losses for both training and validation sets
- Precision & Recall (middle row): High precision (~95%) and recall (~59%) on both bounding boxes and masks
- mAP scores (right columns): Achieved 70.9% mAP@0.5 and 42.5% mAP@0.5:0.95, indicating robust detection performance
The validation metrics closely track training metrics, demonstrating good generalization without overfitting.
- True Positives: 59,608 hieroglyphs correctly detected
- False Positives: 1,532 (2.5% error rate)
- Strong background discrimination
- Multi-class classification (different hieroglyph types)
- Hieroglyph recognition and translation
- Mobile app deployment
- Sequence analysis for reading order
- Integration with archaeological databases
- 3D surface reconstruction support
- Real-time video processing
This project was developed as a university Computer Vision course project by:
- Adham Tamer - LinkedIn | GitHub
- Ahmed Sherif - LinkedIn
- Ahmed Ramadan - LinkedIn
- Saif Mohamed - LinkedIn
- Muhab Mohamed - LinkedIn
- Mohamed Korayem - LinkedIn
- Nasser Aly - LinkedIn
- Ahmed Yahia - LinkedIn
- Mohamed El-Saeed - LinkedIn
- Mazen Ashraf - LinkedIn
- Ultralytics for the YOLOv8 framework
- Computer Vision Course instructors and teaching assistants
- Egyptian archaeology community for domain expertise
- Open-source computer vision community
This project is licensed under the MIT License - see the LICENSE file for details.
Adham Tamer
- Email: adhamt864@gmail.com
- LinkedIn: linkedin.com/in/adhamtamer
- GitHub: @EngAdhamTamer
- Project Link: https://github.com/EngAdhamTamer/hieroglyph-detection
If you find this project useful, please consider giving it a star! โญ
Built with โค๏ธ for preserving ancient Egyptian heritage through AI













