/glyphnet-pytorch

Сracking Egyptologist's MNIST: PyTorch implementation of the Glyphnet model introduced in "A Deep Learning Approach to Ancient Egyptian Hieroglyphs Classification", Barucci et al., 2021.

Primary LanguagePythonMIT LicenseMIT

glyphnet-pytorch

Python 3x

This repository presents a custom (non-official) PyTorch-based implementation of the Glyphnet classifier introduced in the work A Deep Learning Approach to Ancient Egyptian Hieroglyphs Classification, 2021 and applies it to the data accompanying the work "Automatic Egyptian Hieroglyph Recognition by Retrieving Images as Texts", 2013 (NB! Glyphnet paper uses a larger dataset).

what a pretty bird you are
G17 G26 G25 G4 G5 G43

We hope that this implementation of the model will encourage the further research in this direction.

UPDATE April 2022: the original AUTHORS' CODE is now available.

Requirements

Please see requirements.txt.

Quickstart

TL;DR: run prepare_data.sh, then main.py.

Setting everything up

An entry point is the script prepare_data.sh that downloads the dataset and splits it into train/test parts in a 'stratified' manner, i.e. keeping all labels with just a single image in the training set, yet preserving similar label counts distributions in each part of the dataset.

It should print

DEBUG:root:Labels total: 172
DEBUG:root:Labels seen just once: 37

before shutting down.

Training

Training script main.py uses standard hydra configuration mechanism; the parameters one can modify at the CLI call can be found in configs/....

python3 main.py model.epochs=10

How to cite

If you use the GlyphNet model, please cite the original work:

@article{barucci2021deep,
  title={A Deep Learning Approach to Ancient Egyptian Hieroglyphs Classification},
  author={Barucci, Andrea and Cucci, Costanza and Franci, Massimiliano and Loschiavo, Marco and Argenti, Fabrizio},
  journal={IEEE Access},
  volume={9},
  pages={123438--123447},
  year={2021},
  publisher={IEEE}
}

If you use the dataset, please cite the original work:

@inproceedings{franken2013automatic,
  title={Automatic Egyptian hieroglyph recognition by retrieving images as texts},
  author={Franken, Morris and van Gemert, Jan C},
  booktitle={Proceedings of the 21st ACM international conference on Multimedia},
  pages={765--768},
  year={2013}
}

Citing this repository is also appreciated:

@misc{glyphnetpytorch2021alekseev,
  title     = {{alexeyev/glyphnet-pytorch: GlyphNet, PyTorch implementation}},
  author    = {Anton Alekseev}, 
  year      = {2021},
  url       = {https://github.com/alexeyev/glyphnet-pytorch},
  language  = {english}
}

TODO

  • Add a practical usage scenario using data augmentation
  • Add an end-to-end image-to-prediction inference script using a pre-trained GlyphNet model

Notes