Egyptian Hieroglyphs Classification
This model classifies Egyptian hieroglyph symbols using deep learning. It uses transfer learning with VGG16 for accurate recognition.
Dataset
- Source: Egyptian Hieroglyphs Dataset on Kaggle
- Classes: 92
- Split: Balanced training and test sets
Training
- Epochs: 20
- Model: VGG16
- Transfer learning was used to improve accuracy
Performance
- MobileNetV2 and VGG16 achieved approximately 98% accuracy and high precision
VGG16
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing import image
import numpy as np
# 1. Hugging Face repo ID and model filename
repo_id = "your-username/your-repo" # Replace with your repo ID
filename = "hieroglyphics_modelMobileNetV2.keras" # Replace with your model filename
# 2. Download the model from Hugging Face Hub
model_path = hf_hub_download(repo_id=repo_id, filename=filename)
model = load_model(model_path)
# 3. Class names corresponding to model output indices
class_names = [
"100", "Her", "Woman", "among", "angry", "ankh", "aroura", "at", "bad", "bandage",
"bee", "belongs", "birth", "board", "book", "boy", "branch", "bread", "brewer", "builder",
"bury", "canal", "cloth", "cobra", "composite_bow", "cooked", "corpse", "dessert", "divide",
"duck", "elephant", "enclosed", "eye", "fabric", "face", "falcon", "fingre", "fish", "flail",
"folded", "foot", "galena", "giraffe", "he", "hit", "horn", "king", "leg", "length", "life",
"limits", "lion", "lizard", "loaf", "man", "mascot", "meet", "mother", "mouth", "musical",
"nile", "not", "now", "nurse", "nursing", "occur", "one", "owl", "pair", "papyrus", "pool",
"quailchick", "reed", "ring", "rope", "ruler", "sail", "sandal", "semen", "small", "snake",
"soldier", "star", "stick", "swallow", "this", "to", "turtle", "viper", "wall", "water", "you"
]
# 4. Function to prepare input image for prediction
def prepare_image(img_path, target_size=(224, 224)):
img = image.load_img(img_path, target_size=target_size) # Load and resize image
img_array = image.img_to_array(img) # Convert to array
img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
img_array = img_array / 255.0 # Normalize
return img_array
# 5. Provide the path to your test image here
img_path = "path/to/your/hieroglyph_image.jpg"
img = prepare_image(img_path)
# 6. Run prediction
predictions = model.predict(img)
predicted_index = np.argmax(predictions)
predicted_label = class_names[predicted_index]
print(f"Predicted Hieroglyph: {predicted_label}")
- Downloads last month
- 4
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support
