Egyptian-Museum-Artifact-Detection

๐Ÿ›๏ธ Egyptian Museum Artifact Detection

![Project Banner](/Egyptian-Museum-Artifact-Detection/assets/banner.jpg) **AI-Powered Interactive Museum Companion for Egyptian Cultural Heritage** [![Next.js](https://img.shields.io/badge/Next.js-14.2-black?style=flat&logo=next.js)](https://nextjs.org/) [![FastAPI](https://img.shields.io/badge/FastAPI-0.104-009688?style=flat&logo=fastapi)](https://fastapi.tiangolo.com/) [![YOLOv8](https://img.shields.io/badge/YOLOv8-Ultralytics-blue?style=flat)](https://github.com/ultralytics/ultralytics) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Demo](https://img.shields.io/badge/demo-live-success)](https://your-demo-url.vercel.app) [Features](#-features) โ€ข [Demo](#-demo) โ€ข [Architecture](#-architecture) โ€ข [Installation](#-installation) โ€ข [Usage](#-usage) โ€ข [API](#-api-documentation) โ€ข [Contributing](#-contributing)

๐Ÿ“– Overview

Egyptian Museum Artifact Detection is an innovative AI-powered application that revolutionizes museum experiences by combining computer vision, natural language processing, and interactive learning. Built for the Egyptian Museums, this platform enables visitors to instantly identify and learn about 84 iconic Egyptian artifacts through smartphone camera scanning or text search.

๐ŸŽฏ Project Goals


โœจ Features

๐Ÿ” Intelligent Artifact Recognition

๐Ÿค– AI-Powered Cultural Analysis

๐Ÿ”Ž Advanced Search Capabilities

๐Ÿ“ฑ Modern User Experience


๐ŸŽฌ Demo

Artifact Scanning Flow

Scanning Demo Upload an image โ†’ AI detects artifact โ†’ Receive historical context

Search & Discovery

Search Demo Search Egyptian artifacts โ†’ Browse results โ†’ Explore cultural significance

Live Demo

๐ŸŒ Try the Live Application

Watch Video Demonstration


๐Ÿ—๏ธ Architecture

System Overview

System Architecture

Technology Stack

Frontend

Backend

AI & ML

External APIs

Data Flow

graph LR
    A[User] -->|Upload Image| B[Next.js Frontend]
    B -->|POST /api/detect| C[Next.js API Route]
    C -->|Forward Image| D[FastAPI Backend]
    D -->|YOLO Inference| E[YOLOv8 Model]
    E -->|Artifact ID| D
    D -->|Detection Result| C
    C -->|Fetch Context| F[Groq AI]
    F -->|Historical Analysis| C
    C -->|Combined Response| B
    B -->|Display Result| A

๐Ÿ“Š Model Performance

YOLOv8m Training Results

Metric Value
Model YOLOv8m
Classes 84 Egyptian artifacts
Training Images 5,000+ (augmented)
Validation mAP@0.5 89.3%
Validation mAP@0.5:0.95 72.1%
Inference Time (GPU) ~25ms
Inference Time (CPU) ~180ms
Model Size 52.9 MB

Detected Artifact Categories

๐Ÿ“œ View All 84 Artifacts (Click to expand) **Pharaohs & Royalty (22)** - Akhenaten - Amenhotep III (multiple variants) - Tutankhamun statues and mask - Ramesses II statues - Queen Hatshepsut - Nefertiti bust **Monuments & Architecture (8)** - Great Pyramids of Giza - Sphinx variants - Pyramid of Djoser - Bent Pyramid of King Sneferu **Deities & Religious (12)** - Isis with child - Osiris statues - Ptah representations - Ra-Horakhty - Sekhmet seated statues **Funerary Objects (6)** - Mask of Tutankhamun - Coffin of Ahmose I - Various sarcophagi **And 36 more iconic artifacts...**

๐Ÿš€ Installation

Prerequisites

Quick Start

1๏ธโƒฃ Clone Repository

git clone https://github.com/nouran25/Egyptian-Museum-Artifact-Detection.git
cd Egyptian-Museum-Artifact-Detection

2๏ธโƒฃ Setup Backend (FastAPI)

# Navigate to backend
cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Download model (or place your trained model)
# Place 'best.pt' in backend/ directory

# Start server
python main.py

Backend will run at: http://localhost:8000

3๏ธโƒฃ Setup Frontend (Next.js)

# Navigate to frontend (or project root)
cd ..

# Install dependencies
npm install

# Create environment file
cp .env.example .env.local

# Add your API keys
# Edit .env.local:
GROQ_API_KEY=your_groq_api_key_here
YOLO_BACKEND_URL=http://localhost:8000/detect-artifact
NEXT_PUBLIC_BASE_URL=http://localhost:3000

# Start development server
npm run dev

Frontend will run at: http://localhost:3000

๐Ÿ“ฆ Environment Variables

Frontend .env.local

GROQ_API_KEY=gsk_xxxxxxxxxxxxx
YOLO_BACKEND_URL=http://localhost:8000/detect-artifact
NEXT_PUBLIC_BASE_URL=http://localhost:3000

Backend (Optional)

MODEL_PATH=best.pt
CONFIDENCE_THRESHOLD=0.5

๐Ÿ’ป Usage

Scanning Artifacts

  1. Navigate to Scan Page: Click โ€œScan Artifactโ€ on homepage
  2. Upload Image: Take photo or upload from gallery
  3. Wait for Detection: AI processes image in real-time
  4. View Results: See artifact name, confidence, and historical context

Searching Artifacts

  1. Navigate to Search Page: Click โ€œSearch Artifactโ€ on homepage
  2. Enter Query: Type artifact name, culture, or keyword
  3. Browse Results: View matching artifacts from museum database
  4. Explore Details: Click any result for AI-generated analysis

Example API Request

# Detect artifact from image
curl -X POST http://localhost:8000/detect-artifact \
  -F "file=@/path/to/artifact-image.jpg"

# Response
{
  "artifact_id": "Mask of Tutankhamun",
  "confidence": 0.956,
  "class_id": 36,
  "detections_count": 1
}

๐Ÿ“š API Documentation

Backend Endpoints

POST /detect-artifact

Detect artifact in uploaded image

Request:

Content-Type: multipart/form-data
file: File (image/jpeg, image/png)

Response:

{
  "artifact_id": "Sphinx of Hatshepsut",
  "confidence": 0.923,
  "class_id": 16,
  "detections_count": 1
}

GET /model-info

Get model configuration and available classes

Response:

{
  "loaded": true,
  "num_classes": 84,
  "confidence_threshold": 0.5,
  "total_artifacts": 84
}

GET /artifacts

List all detectable artifacts

Response:

{
  "artifacts": [
    {"class_id": 0, "artifact_name": "Akhenaten"},
    {"class_id": 1, "artifact_name": "Amenhotep III"}
  ],
  "total": 84
}

Frontend API Routes

POST /api/detect

Combined detection and analysis

Request:

Content-Type: multipart/form-data
file: File

Response:

{
  "artifact_id": "Statue of Khufu",
  "confidence": 0.91,
  "analysis": "The Statue of Khufu represents...",
  "success": true
}

POST /api/analyse

Get AI-generated cultural analysis

Request:

{
  "artwork": {
    "title": "Sphinx of Hatshepsut",
    "culture": "Egyptian",
    "objectDate": "ca. 1479โ€“1458 B.C."
  }
}

Response:

{
  "data": "The Sphinx of Hatshepsut is a remarkable...",
  "success": true,
  "model_used": "llama-3.3-70b-versatile"
}

๐ŸŽจ Project Structure

Egyptian-Museum-Artifact-Detection/
โ”œโ”€โ”€ app/                          # Next.js app directory
โ”‚   โ”œโ”€โ”€ page.tsx                  # Homepage
โ”‚   โ”œโ”€โ”€ scan/
โ”‚   โ”‚   โ””โ”€โ”€ page.tsx             # Artifact scanning page
โ”‚   โ”œโ”€โ”€ search/
โ”‚   โ”‚   โ””โ”€โ”€ page.tsx             # Artifact search page
โ”‚   โ””โ”€โ”€ api/
โ”‚       โ”œโ”€โ”€ detect/route.ts      # Detection API route
โ”‚       โ””โ”€โ”€ analyse/route.ts     # AI analysis route
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py                  # FastAPI application
โ”‚   โ”œโ”€โ”€ best.pt                  # YOLOv8 trained model
โ”‚   โ””โ”€โ”€ requirements.txt         # Python dependencies
โ”œโ”€โ”€ components/                   # Reusable React components
โ”œโ”€โ”€ lib/                         # Utility functions
โ”‚   โ””โ”€โ”€ museumAPI/
โ”‚       โ”œโ”€โ”€ index.ts            # API client
โ”‚       โ””โ”€โ”€ types.ts            # TypeScript types
โ”œโ”€โ”€ public/                      # Static assets
โ”œโ”€โ”€ assets/                      # README assets (screenshots, diagrams)
โ”œโ”€โ”€ model_training/              # Training scripts and results
โ”œโ”€โ”€ .env.local                   # Environment variables (local)
โ”œโ”€โ”€ next.config.js              # Next.js configuration
โ”œโ”€โ”€ tailwind.config.js          # Tailwind CSS configuration
โ”œโ”€โ”€ package.json                # Node.js dependencies
โ””โ”€โ”€ README.md                   # This file

๐Ÿ”ฌ Model Training

Dataset Preparation

Our model was trained on a custom dataset of Egyptian artifacts:

  1. Data Collection: 5,000+ images from multiple sources
  2. Annotation: Labeled using Roboflow with bounding boxes
  3. Augmentation: Rotation, scaling, brightness adjustment
  4. Split: 70% training, 20% validation, 10% testing

Training Process

from ultralytics import YOLO

# Load pretrained model
model = YOLO('yolov8m.pt')

# Train on custom dataset
results = model.train(
    data='data.yaml',
    epochs=150,
    imgsz=640,
    batch=16,
    patience=50,
    name='egyptian_artifacts'
)

# Validate
metrics = model.val()

# Export
model.export(format='onnx')

Training Configuration (data.yaml)

path: ../dataset
train: train/images
val: valid/images
test: test/images

nc: 84  # number of classes
names: [
  'Akhenaten',
  'Amenhotep III',
  'Mask of Tutankhamun',
  # ... 81 more artifacts
]

๐Ÿšข Deployment

Frontend (Vercel)

Deploy with Vercel

# Install Vercel CLI
npm i -g vercel

# Deploy
vercel --prod

# Set environment variables in Vercel dashboard

Backend (Railway)

Deploy on Railway

# Install Railway CLI
npm i -g @railway/cli

# Deploy
railway up

# Configure environment
railway variables set MODEL_PATH=best.pt

Docker Deployment (Optional)

# Backend Dockerfile
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

๐Ÿงช Testing

Run Tests

# Frontend tests
npm test

# Backend tests
cd backend
pytest tests/

# End-to-end tests
npm run test:e2e

Manual Testing Checklist


๐Ÿค Contributing

We welcome contributions! Hereโ€™s how you can help:

๐Ÿ› Reporting Bugs

  1. Check existing Issues
  2. Create new issue with:
    • Clear description
    • Steps to reproduce
    • Expected vs actual behavior
    • Screenshots if applicable

โœจ Suggesting Features

  1. Open a Feature Request
  2. Describe the feature and use case
  3. Explain why it would be valuable

๐Ÿ”ง Submitting Pull Requests

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Make changes and commit: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open Pull Request with description

๐Ÿ“ Code Style


๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2024 Egyptian Museum Artifact Detection Team

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...

๐Ÿ™ Acknowledgments


๐Ÿ“ž Contact & Support


๐Ÿ—บ๏ธ Roadmap

โœ… Phase 1 (Completed)

๐Ÿšง Phase 2 (In Progress)

๐Ÿ”ฎ Phase 3 (Planned)


๐Ÿ“Š Statistics

![GitHub stars](https://img.shields.io/github/stars/nouran25/Egyptian-Museum-Artifact-Detection?style=social) ![GitHub forks](https://img.shields.io/github/forks/nouran25/Egyptian-Museum-Artifact-Detection?style=social) ![GitHub watchers](https://img.shields.io/github/watchers/nouran25/Egyptian-Museum-Artifact-Detection?style=social) **Made with โค๏ธ for Egyptian Cultural Heritage** [โฌ† Back to Top](#-egyptian-museum-artifact-detection)