gitbuyer_

v-corra/TheLibrarianFromAlexandria

privatemain

README

Font Recognition System โ€“ "The Librarian from Alexandria"

  • In order to execute the code, install a virtual environment and the packages in the requirements.txt file.
  • pip install virtualenv
  • virtualenv venv
  • source venv/Scripts/activate
  • pip install -r requirements

๐Ÿ‘ฅ Team Members

  • Corrado Valeri
  • Michele Baldo

๐Ÿ“˜ Introduction

This project aims to create a deep learning-based font classification system for historical documents. The system processes a set of scanned text images and classifies them into one of 11 ancient font categories. The ultimate goal is to contribute a robust model that can aid in the automatic digitization and indexing of historical archives using machine learning.


๐Ÿงช Methods

๐Ÿ”ง Design Overview

The approach is divided into three core modules: 1. Image Preprocessing โ€“ Clean and enhance the scanned images. 2. Data Augmentation โ€“ Expand the dataset through synthetic variations (Due to computing limitation we only saved the last tranfomration not accomplishing the real goal of dataaugmentation but still giving varaitions that helped the training phase). 3. Model Training โ€“ Utilize a pre-trained ResNet50 model based on ImageNet Dataset for classification.

๐Ÿ›  Environment

  • Python 3.10+
  • PyTorch, torchvision, pandas, scikit-learn, seaborn
  • Compatible with both GPU and CPU environments
  • Required setup: conda environment or requirements.txt listing all dependencies

๐Ÿ“Š Preprocessing Pipeline

Each scanned image is: - Converted to grayscale - Binarized via a threshold - Denoised using a Median filter - Saved in immagini_formattate

๐Ÿงฌ Data Augmentation

For every denoised image: - Affine transformations (translation, flip, brightness/contrast jitter) - Gaussian noise addition - Elastic distortion applied - Saved in immagini_reteneurale

This ensures better generalization and robustness of the trained model.


๐Ÿงซ Experimental Design

๐ŸŽฏ Purpose

To train a classifier capable of distinguishing 11 distinct font styles from historical scanned images.

๐Ÿ” Baseline

No pretrained classifier was used as a benchmark; instead, the performance of the ResNet50 fine-tuned head was evaluated directly.

๐Ÿงฎ Evaluation Metrics

  • Accuracy
  • Precision
  • Recall
  • F1-Score

Metrics were computed per epoch for both training and testing sets.


๐Ÿ“ˆ Results

๐Ÿ” Main Findings

  • ResNet50 achieved high classification performance with accuracy surpassing 90% on the test set.
  • Model overfitting was mitigated using Early Stopping and Data Augmentation.
  • Precision/Recall/F1-Score metrics were stable across epochs.

๐Ÿ“‰ Example Figures and Tables

โœ… Training/Test Accuracy per Epoch

๐Ÿ“Š Precision / Recall / F1 per Epoch

๐Ÿ“Œ Confusion Matrix

Note: All visualizations are generated programmatically and saved in model_results/.


๐Ÿงพ Conclusions

The model demonstrates the feasibility of using deep learning techniques to classify historical fonts with strong generalization across diverse document structures. The data augmentation techniques were pivotal in compensating for the relatively small dataset.


๐Ÿ”ฎ Future Work

In the repository, there is an additional script that we were unable to test due to time constraints and limited computational resources. This alternative version includes all the data transformations and integrates the validation set into the model analysis for a more comprehensive evaluation.


๐Ÿ““ Notebook Structure

main.ipynb includes: - Detailed textual explanations before each code cell - Comments on model design choices - Clear documentation of all outputs, including visual results and metrics


10 files

file contents open where the seller allows a preview; the rest is what you are buying