{"repo":"v-corra/TheLibrarianFromAlexandria","private":true,"description":null,"default_branch":"main","stars":0,"forks":0,"pushed_at":"2025-05-15T20:03:22Z","languages":{"Jupyter Notebook":543986},"files":10,"tree":["README.md","TheLibFromAlexandria.pdf","main.ipynb","main_not_tested.ipynb","model_results/confusion_matirx_18_35.png","model_results/precision_recall_f1_charts_18.png","model_results/training_and_accuracy_charts_18.png","model_results/training_results_18.xlsx","pages.csv","requirements.txt"],"sizes":{"README.md":4095,"TheLibFromAlexandria.pdf":11723198,"main.ipynb":271254,"main_not_tested.ipynb":272732,"model_results/confusion_matirx_18_35.png":61386,"model_results/precision_recall_f1_charts_18.png":74948,"model_results/training_and_accuracy_charts_18.png":47456,"model_results/training_results_18.xlsx":6971,"pages.csv":58276,"requirements.txt":84},"readme":"# Font Recognition System – \"The Librarian from Alexandria\"\r\n\r\n- In order to execute the code, install a virtual environment and the packages in the requirements.txt file. \r\n- pip install virtualenv\r\n- virtualenv venv\r\n- source venv/Scripts/activate\r\n- pip install -r requirements\r\n\r\n## 👥 Team Members\r\n- Corrado Valeri \r\n- Michele Baldo\r\n\r\n---\r\n\r\n## 📘 Introduction\r\n\r\nThis 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.\r\n\r\n---\r\n\r\n## 🧪 Methods\r\n\r\n### 🔧 Design Overview\r\nThe approach is divided into three core modules:\r\n1. **Image Preprocessing** – Clean and enhance the scanned images.\r\n2. **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).\r\n3. **Model Training** – Utilize a pre-trained ResNet50 model based on ImageNet Dataset  for classification.\r\n\r\n### 🛠 Environment\r\n- Python 3.10+\r\n- PyTorch, torchvision, pandas, scikit-learn, seaborn\r\n- Compatible with both GPU and CPU environments\r\n- Required setup: `conda` environment or `requirements.txt` listing all dependencies\r\n\r\n### 📊 Preprocessing Pipeline\r\nEach scanned image is:\r\n- Converted to grayscale\r\n- Binarized via a threshold\r\n- Denoised using a Median filter\r\n- Saved in `immagini_formattate`\r\n\r\n### 🧬 Data Augmentation\r\nFor every denoised image:\r\n- Affine transformations (translation, flip, brightness/contrast jitter)\r\n- Gaussian noise addition\r\n- Elastic distortion applied\r\n- Saved in `immagini_reteneurale`\r\n\r\nThis ensures better generalization and robustness of the trained model.\r\n\r\n---\r\n\r\n## 🧫 Experimental Design\r\n\r\n### 🎯 Purpose\r\nTo train a classifier capable of distinguishing 11 distinct font styles from historical scanned images.\r\n\r\n### 🔁 Baseline\r\nNo pretrained classifier was used as a benchmark; instead, the performance of the ResNet50 fine-tuned head was evaluated directly.\r\n\r\n### 🧮 Evaluation Metrics\r\n- **Accuracy**\r\n- **Precision**\r\n- **Recall**\r\n- **F1-Score**\r\n\r\nMetrics were computed per epoch for both training and testing sets.\r\n\r\n---\r\n\r\n## 📈 Results\r\n\r\n### 🔍 Main Findings\r\n- ResNet50 achieved high classification performance with accuracy surpassing 90% on the test set.\r\n- Model overfitting was mitigated using Early Stopping and Data Augmentation.\r\n- Precision/Recall/F1-Score metrics were stable across epochs.\r\n\r\n### 📉 Example Figures and Tables\r\n#### ✅ Training/Test Accuracy per Epoch\r\n![Training/Test Accuracy](model_results/training_and_accuracy_charts_18.png)\r\n\r\n#### 📊 Precision / Recall / F1 per Epoch\r\n![Metrics per Epoch](model_results/precision_recall_f1_charts_18.png)\r\n\r\n#### 📌 Confusion Matrix\r\n![Confusion Matrix](model_results/confusion_matirx_18_35.png)\r\n\r\n> Note: All visualizations are generated programmatically and saved in `model_results/`.\r\n\r\n---\r\n\r\n## 🧾 Conclusions\r\n\r\nThe model demonstrates the feasibility of using deep learning techniques to classify historical fonts with strong generalization across diverse document structures. \r\nThe data augmentation techniques were pivotal in compensating for the relatively small dataset.\r\n\r\n---\r\n\r\n### 🔮 Future Work\r\nIn 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.\r\n\r\n---\r\n\r\n## 📓 Notebook Structure\r\n\r\n`main.ipynb` includes:\r\n- Detailed textual explanations before each code cell\r\n- Comments on model design choices\r\n- Clear documentation of all outputs, including visual ","price_usd":"0.01","clone_checkout":"https://api.checkout402.com/c/chk_bCXOIuS3Ntun3Etq","rehearse_checkout":"https://api.checkout402.com/c/chk_bCXOIuS3Ntun3Etq/test","preview":"/r/v-corra/TheLibrarianFromAlexandria/f/<path> serves file CONTENTS for the seller's preview paths; other paths answer with the price","how_to_buy":"pay clone_checkout with x402 (pay402 does it in one call); the goods arrive as payload_base64, a tar.gz of the full repo. Rehearse first at rehearse_checkout: same flow, simulated money.","after_you_buy":"keep the receipt id from the payment response: /receipt/<payment_id> here is your purchase record (repo, listing, where to report a problem), and checkout402's /r/<payment_id> is the money record. Tell your human both URLs."}