{"id":13459556,"url":"https://github.com/madziejm/project-fontr","last_synced_at":"2025-03-24T18:30:38.846Z","repository":{"id":153711128,"uuid":"622283756","full_name":"madziejm/project-fontr","owner":"madziejm","description":"FontR - font recognition project. Stay hydrated.","archived":false,"fork":false,"pushed_at":"2023-06-21T18:12:12.000Z","size":6486,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-23T11:36:28.500Z","etag":null,"topics":["classification","kedro","pytorchlightning","wandb"],"latest_commit_sha":null,"homepage":"https://madziejm.github.io/project-fontr/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madziejm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-01T16:50:21.000Z","updated_at":"2024-10-18T15:25:14.000Z","dependencies_parsed_at":"2024-07-21T00:52:41.795Z","dependency_job_id":"2590f48a-c4aa-40f7-90bf-e0d42cf67ad7","html_url":"https://github.com/madziejm/project-fontr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madziejm%2Fproject-fontr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madziejm%2Fproject-fontr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madziejm%2Fproject-fontr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madziejm%2Fproject-fontr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madziejm","download_url":"https://codeload.github.com/madziejm/project-fontr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245328071,"owners_count":20597350,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","kedro","pytorchlightning","wandb"],"created_at":"2024-07-31T10:00:19.526Z","updated_at":"2025-03-24T18:30:38.438Z","avatar_url":"https://github.com/madziejm.png","language":"Python","funding_links":[],"categories":["Example projects"],"sub_categories":[],"readme":"# **FontR**\n\n# **Info about project**\n\nFontR is a font recognition project aimed at creating a solution for font recognition based on the idea proposed by one of the team members. The project is built on the foundation of Adobe's DeepFont research, which can be found in their paper here. https://arxiv.org/pdf/1507.03196v1.pdf\n\nTeam members:\n\n[@madziejm](https://github.com/madziejm)\n[@mleonowicz](https://github.com/mleonowicz)\n[@kjpolak](https://github.com/kjpolak)\n\n## **Running**\n\nTo run the project, follow the steps below:\n\nInstall the required dependencies:\n```\npoetry run pip install -r src/requirements.txt\n```\n\nBuild the project requirements:\n```\npoetry run kedro build-reqs\n```\n\nRun the project:\n```\npoetry run kedro run\n```\n\nYou can also run specific pipeline using `-p` flag if you want to skip reproducing steps.\nFor example to run the model training and evaluation part run:\n```\npoetry run kedro -p data_science\n```\n\nTo build our solution we used [`kedro`](https://kedro.org/) framework.\nKedro is a Python framework for building scalable, maintainable, and reproducible data pipelines\nIt provides a standardized project structure and features for data engineering, machine learning, and production deployment, simplifying the development of end-to-end data solutions.\n\nTo manage dependencies our solution uses [`poetry`](https://python-poetry.org/) which is a Python dependency manager, thanks to which a lock of dependencies can be generated, which increases reproducibility and replicability.\n\nTo store our data we use `s3` which is Amazon storage solution.\nTo use your own storage you need to change `filepath` parameters in `conf/base/catalog.yml` and values in `conf/base/parameters/bcf_preprocessing.yml`.\n\n## **Weights and Biases logging**\n\nWeights and Biases (W\u0026B) is a platform for tracking, visualizing, and optimizing machine learning experiments, which we use in our project.\nIt is required to run the project.\n\nTo use W\u0026B logging in this project create a file named credentials_wandb.yml in the `conf/local` directory. It should have one attribute called `api_key` that stores an API Key to your W\u0026B account.\n\nOnce you have set up the `credentials_wandb.yml` file, you can run the project and enjoy the benefits of W\u0026B logging. The project will automatically log relevant experiment metrics and provide visualizations through the W\u0026B platform.\n\n## **AdobeVFR Dataset**\n\nAdobeVFR dataset focuses on popular fonts and consists of synthetic and real-world data. The dataset is divided into four parts.\n\n1. **Synthetic Data**\n   - **VFR_syn_train:** This subset contains 1,000 images per class for training.\n   - **VFR_syn_val:** This subset includes 100 images per class for validation.\n   \n   To generate synthetic training data, the dataset creators render long English words sampled from a large corpus. The resulting text images are tightly cropped, grayscale, and size-normalized. Each of the 2,383 font classes in the dataset has 1,000 training images and 100 validation images.\n\n2. **Real-world Data**\n   - **VFR_real_test:** This subset consists of 4,384 real-world test images with reliable font labels. These images were collected from typography forums where users seek help in identifying fonts. The images are converted to grayscale, manually cropped, and normalized to a height of 105 pixels. These images exhibit larger appearance variations due to scaling, background clutter, lighting, noise, perspective distortions, and compression artifacts.\n   - **VFR_real_u:** This subset contains 197,396 unlabeled real-world images. These images were not annotated with font labels but were utilized to pre-train a \"shared-feature\" extraction subnetwork to reduce the domain gap.\n\nAlso a fontlist specifying the 2,383 font classes used in the dataset is provided, allowing to download the corresponding font files (.otf) and render synthetic images.\n\nFurthermore, the text mentions the availability of sample codes, provided in bcf format, for processing the dataset. These sample codes are intended for use with cuda-convenet and are not optimized for product-level usage.\n\nExamples:\n\n![Example 1](./img/1.png)\n![Example 2](./img/2.png)\n![Example 3](./img/3.png)\n\n## Architecture\n\nOur solution consists of three distinct `kedro` pipelines:\n\n### `bcf_preprocessing`\nThis pipeline focuses on the preprocessing steps necessary for the solution. It handles tasks such as downloading, preparing, and uploading images to the Amazon S3 storage. These images are essential for replicating the original DeepFont implementation.\n\n### `data_processing`\nThe data_processing pipeline is responsible for splitting the prepared dataset and feeding it into the models used in the solution.\n\n### `data_science`\nThe data_science pipeline represents the core component of our solution. It encompasses the training, evaluation, and serialization processes for both the encoder and classifier models. This pipeline is where the machine learning magic happens, as it leverages the provided data to train accurate models capable of font recognition.\n\nBy leveraging the capabilities of the kedro framework, we were able to develop a robust and efficient solution for font recognition, with clearly defined and modular pipelines that enable easy maintenance, reproducibility, and scalability\n\nVisualisation of the project using `kedro-viz` can be seen bellow:\n![Pipeline](./img/kedro-pipeline.png)\n\n## Results\n\nTODO:\n\n## Sources\n\nPublications on the problem of font recognition:\n\n- Convolution Neural Networks for Arabic Font Recognition\nAbstract: https://ieeexplore.ieee.org/document/9067875\nPaper: https://sci-hub.se/10.1109/SITIS.2019.00031\n\n- Large-Scale Visual Font Recognition (bardzo archaiczne, 2014)\nPaper: https://openaccess.thecvf.com/content_cvpr_2014/papers/Chen_Large-Scale_Visual_Font_2014_CVPR_paper.pdf\n\n- Font Recognition in Natural Images via Transfer Learning\nAbstract: https://www.researchgate.net/publication/322424375_Font_Recognition_in_Natural_Images_via_Transfer_Learning\nPaper: https://sci-hub.se/10.1007/978-3-319-73603-7_19\n\n- Farsi Font Recognition Using Holes of Letters and Horizontal Projection Profile (2011, bardziej jako ciekawostka)\nAbstract: https://link.springer.com/chapter/10.1007/978-3-642-27337-7_21\nPaper: https://sci-hub.se/10.1007/978-3-642-27337-7_21\n\n- HENet: Forcing a Network to Think More for Font Recognition\nAbstract: https://dl.acm.org/doi/10.1145/3503047.3503055\nPaper: https://arxiv.org/pdf/2110.10872.pdf\n\n- Convolutional Neural Networks for Font Classification\nPaper: https://arxiv.org/pdf/1708.03669.pdf\n\n## **Code layout and pipeline** - highlights\n\n```\nsrc/\n┣ fontr/\n┃ ┣ fontr/\n┃ ┃ ┣ autoencoder.py\n┃ ┃ ┣ classifier.py\n┃ ┃ ┣ logger.py\n┃ ┃ ┣ transforms.py\n┃ ┃ ┗ __init__.py\n┃ ┣ pipelines/\n┃ ┃ ┣ bcf_preprocessing/\n┃ ┃ ┣ data_processing/\n┃ ┃ ┣ data_science/\n┃ ┃ ┣ nodes.py\n┃ ┃ ┗ __init__.py\n┃ ┣ datasets.py\n┃ ┣ pipeline_registry.py\n┃ ┣ settings.py\n┃ ┣ __init__.py\n┃ ┗ __main__.py\n┣ tests/\n┃ ┣ pipelines/\n┃ ┃ ┗ __init__.py\n┃ ┣ conftest.py\n┃ ┣ test_autoencoder.py\n┃ ┣ test_classifier.py\n┃ ┣ test_run.py\n┃ ┗ __init__.py\n┣ requirements-test-only.txt\n┗ requirements.txt\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadziejm%2Fproject-fontr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadziejm%2Fproject-fontr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadziejm%2Fproject-fontr/lists"}