{"id":25902943,"url":"https://github.com/prasunroy/stefann","last_synced_at":"2025-07-15T10:36:08.166Z","repository":{"id":44483671,"uuid":"255925824","full_name":"prasunroy/stefann","owner":"prasunroy","description":":fire: [CVPR 2020] STEFANN: Scene Text Editor using Font Adaptive Neural Network (official code).","archived":false,"fork":false,"pushed_at":"2024-04-30T15:14:56.000Z","size":16176,"stargazers_count":272,"open_issues_count":7,"forks_count":41,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-05-20T00:05:35.548Z","etag":null,"topics":["color-transfer","colornet","computer-vision","cvpr","cvpr2020","deep-learning","fannet","font-generation","scene-text-editor","stefann"],"latest_commit_sha":null,"homepage":"https://prasunroy.github.io/stefann","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prasunroy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-04-15T13:30:46.000Z","updated_at":"2025-05-16T09:15:02.000Z","dependencies_parsed_at":"2022-08-29T03:31:59.410Z","dependency_job_id":"de33a482-d6f1-4cee-b9eb-85ed2b03ea06","html_url":"https://github.com/prasunroy/stefann","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prasunroy/stefann","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasunroy%2Fstefann","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasunroy%2Fstefann/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasunroy%2Fstefann/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasunroy%2Fstefann/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prasunroy","download_url":"https://codeload.github.com/prasunroy/stefann/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prasunroy%2Fstefann/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265429059,"owners_count":23763678,"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":["color-transfer","colornet","computer-vision","cvpr","cvpr2020","deep-learning","fannet","font-generation","scene-text-editor","stefann"],"created_at":"2025-03-03T03:17:51.105Z","updated_at":"2025-07-15T10:36:08.133Z","avatar_url":"https://github.com/prasunroy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/prasunroy/stefann/master/docs/static/imgs/logo.png\"\u003e\n\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/build-passing-00c800?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/dependencies-up%20to%20date-00c800?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/contributions-welcome-ff40ff?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/license-Apache--2.0-6464ff?style=flat-square\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/accepted-CVPR%202020-6464ff?style=flat-square\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/prasunroy/stefann#getting-started\"\u003eGetting Started\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/prasunroy/stefann#training-networks\"\u003eTraining Networks\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/prasunroy/stefann#external-links\"\u003eExternal Links\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/prasunroy/stefann#citation\"\u003eCitation\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://github.com/prasunroy/stefann#license\"\u003eLicense\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/prasunroy/stefann/master/docs/static/imgs/teaser.jpg\"\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n  \u003cb\u003e\u003ci\u003eThe official GitHub repository for the paper on \u003ca href=\"https://prasunroy.github.io/stefann\"\u003eSTEFANN: Scene Text Editor using Font Adaptive Neural Network.\u003c/a\u003e\u003c/i\u003e\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## Getting Started\n### 1. Installing Dependencies\n| Package    | Source | Version | Tested version\u003cbr\u003e(Updated on April 14, 2020) |\n| :--------- | :----: | :-----: | :-------------------------------------------: |\n| Python     | Conda  | 3.7.7   | :heavy_check_mark: |\n| Pip        | Conda  | 20.0.2  | :heavy_check_mark: |\n| Numpy      | Conda  | 1.18.1  | :heavy_check_mark: |\n| Requests   | Conda  | 2.23.0  | :heavy_check_mark: |\n| TensorFlow | Conda  | 2.1.0   | :heavy_check_mark: |\n| Keras      | Conda  | 2.3.1   | :heavy_check_mark: |\n| Pillow     | Conda  | 7.0.0   | :heavy_check_mark: |\n| Colorama   | Conda  | 0.4.3   | :heavy_check_mark: |\n| OpenCV     | PyPI   | 4.2.0   | :heavy_check_mark: |\n| PyQt5      | PyPI   | 5.14.2  | :heavy_check_mark: |\n\n### :boom: Quick installation\n#### Step 1: Install [Git](https://git-scm.com/) and [Conda](https://docs.conda.io/) package manager (Miniconda / Anaconda)\n#### Step 2: Update and configure Conda\n```bash\nconda update conda\nconda config --set env_prompt \"({name}) \"\n```\n#### Step 3: Clone this repository and change directory to repository root\n```bash\ngit clone https://github.com/prasunroy/stefann.git\ncd stefann\n```\n#### Step 4: Create an environment and install depenpencies\n\n#### On Linux and Windows\n* To create **CPU** environment: `conda env create -f release/env_cpu.yml`\n* To create **GPU** environment: `conda env create -f release/env_gpu.yml`\n\n#### On macOS\n* To create **CPU** environment: `conda env create -f release/env_osx.yml`\n\n### :boom: Quick test\n#### Step 1: [Download](https://drive.google.com/open?id=16-mq3MOR1zmOsxNgegRmGDeVRyeyQ0_H) models and pretrained checkpoints into `release/models` directory\n#### Step 2: [Download](https://drive.google.com/uc?export=download\u0026id=1Gzb-VYeQJNXwDnkoEI4iAskOGYmWR6Rk) sample images and extract into `release/sample_images` directory\n```\nstefann/\n├── ...\n├── release/\n│   ├── models/\n│   │   ├── colornet.json\n│   │   ├── colornet_weights.h5\n│   │   ├── fannet.json\n│   │   └── fannet_weights.h5\n│   ├── sample_images/\n│   │   ├── 01.jpg\n│   │   ├── 02.jpg\n│   │   └── ...\n│   └── ...\n└── ...\n```\n#### Step 3: Activate environment\nTo activate **CPU** environment: `conda activate stefann-cpu`\n\u003cbr\u003e\nTo activate **GPU** environment: `conda activate stefann-gpu`\n#### Step 4: Change directory to `release` and run STEFANN\n```bash\ncd release\npython stefann.py\n```\n\n### 2. Editing Results :satisfied:\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/prasunroy/stefann/master/docs/static/imgs/results.jpg\"\u003e\n  \u003cbr\u003e\n  \u003cb\u003eEach image pair consists of the original image (Left) and the edited image (Right).\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## Training Networks\n### 1. Downloading Datasets\n#### [Download](https://drive.google.com/open?id=1dOl4_yk2x-LTHwgKBykxHQpmqDvqlkab) datasets and extract the archives into `datasets` directory under repository root.\n```\nstefann/\n├── ...\n├── datasets/\n│   ├── fannet/\n│   │   ├── pairs/\n│   │   ├── train/\n│   │   └── valid/\n│   └── colornet/\n│       ├── test/\n│       ├── train/\n│       └── valid/\n└── ...\n```\n\n#### :pushpin: Description of `datasets/fannet`\n\u003cp align=\"justify\"\u003e\n  This dataset is used to train \u003cb\u003eFANnet\u003c/b\u003e and it consists of 3 directories: \u003ccode\u003efannet/pairs\u003c/code\u003e, \u003ccode\u003efannet/train\u003c/code\u003e and \u003ccode\u003efannet/valid\u003c/code\u003e. The directories \u003ccode\u003efannet/train\u003c/code\u003e and \u003ccode\u003efannet/valid\u003c/code\u003e consist of 1015 and 300 sub-directories respectively, each corresponding to one specific font. Each font directory contains 64x64 grayscale images of 62 English alphanumeric characters (10 numerals + 26 upper-case letters + 26 lower-case letters). The filename format is \u003ccode\u003exx.jpg\u003c/code\u003e where \u003ccode\u003exx\u003c/code\u003e is the ASCII value of the corresponding character (e.g. \"48.jpg\" implies an image of character \"0\"). The directory \u003ccode\u003efannet/pairs\u003c/code\u003e contains 50 image pairs, each corresponding to a random font from \u003ccode\u003efannet/valid\u003c/code\u003e. Each image pair is horizontally concatenated to a dimension of 128x64. The filename format is \u003ccode\u003eid_xx_yy.jpg\u003c/code\u003e where \u003ccode\u003eid\u003c/code\u003e is the image identifier, \u003ccode\u003exx\u003c/code\u003e and \u003ccode\u003eyy\u003c/code\u003e are the ASCII values of source and target characters respectively (e.g. \"00_65_66.jpg\" implies a transformation from source character \"A\" to target character \"B\" for the image with identifier \"00\").\n\u003c/p\u003e\n\n#### :pushpin: Description of `datasets/colornet`\n\u003cp align=\"justify\"\u003e\n  This dataset is used to train \u003cb\u003eColornet\u003c/b\u003e and it consists of 3 directories: \u003ccode\u003ecolornet/test\u003c/code\u003e, \u003ccode\u003ecolornet/train\u003c/code\u003e and \u003ccode\u003ecolornet/valid\u003c/code\u003e. Each directory consists of 5 sub-directories: \u003ccode\u003e_color_filters\u003c/code\u003e, \u003ccode\u003e_mask_pairs\u003c/code\u003e, \u003ccode\u003einput_color\u003c/code\u003e, \u003ccode\u003einput_mask\u003c/code\u003e and \u003ccode\u003eoutput_color\u003c/code\u003e. The directory \u003ccode\u003e_color_filters\u003c/code\u003e contains synthetically generated color filters of dimension 64x64 including both solid and gradient colors. The directory \u003ccode\u003e_mask_pairs\u003c/code\u003e contains a set of 64x64 grayscale image pairs selected at random from 1315 available fonts in \u003ccode\u003edatasets/fannet\u003c/code\u003e. Each image pair is horizontally concatenated to a dimension of 128x64. For \u003ccode\u003ecolornet/train\u003c/code\u003e and \u003ccode\u003ecolornet/valid\u003c/code\u003e each color filter is applied on each mask pair. This results in 64x64 image triplets of color source image, binary target image and color target image in \u003ccode\u003einput_color\u003c/code\u003e, \u003ccode\u003einput_mask\u003c/code\u003e and \u003ccode\u003eoutput_color\u003c/code\u003e directories respectively. For \u003ccode\u003ecolornet/test\u003c/code\u003e one color filter is applied only on one mask pair to generate similar image triplets. With a fixed set of 100 mask pairs, 80000 \u003ccode\u003ecolornet/train\u003c/code\u003e and 20000 \u003ccode\u003ecolornet/valid\u003c/code\u003e samples are generated from 800 and 200 color filters respectively. With another set of 50 mask pairs, 50 \u003ccode\u003ecolornet/test\u003c/code\u003e samples are generated from 50 color filters.\n\u003c/p\u003e\n\n### 2. Training FANnet and Colornet\n#### Step 1: Activate environment\nTo activate **CPU** environment: `conda activate stefann-cpu`\n\u003cbr\u003e\nTo activate **GPU** environment: `conda activate stefann-gpu`\n#### Step 2: Change directory to project root\n```bash\ncd stefann\n```\n#### Step 3: Configure and train FANnet\nTo configure training options edit `configurations` section `(line 40-72)` of `fannet.py`\n\u003cbr\u003e\nTo start training: `python fannet.py`\n###### :cloud: Check [this notebook](https://www.kaggle.com/prasunroy/starter-1-font-generation-stefann-cvpr-2020) hosted at Kaggle for an interactive demonstration of FANnet.\n#### Step 4: Configure and train Colornet\nTo configure training options edit `configurations` section `(line 38-65)` of `colornet.py`\n\u003cbr\u003e\nTo start training: `python colornet.py`\n###### :cloud: Check [this notebook](https://www.kaggle.com/prasunroy/starter-2-color-transfer-stefann-cvpr-2020) hosted at Kaggle for an interactive demonstration of Colornet.\n\n\u003cbr\u003e\n\n## External Links\n\u003ch3 align=\"center\"\u003e\n  \u003ca href=\"https://prasunroy.github.io/stefann\"\u003eProject\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://prasunroy.github.io/stefann/static/docs/08915.pdf\"\u003ePaper\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://prasunroy.github.io/stefann/static/docs/08915-supp.pdf\"\u003eSupplementary Materials\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://drive.google.com/open?id=1dOl4_yk2x-LTHwgKBykxHQpmqDvqlkab\"\u003eDatasets\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://drive.google.com/open?id=16-mq3MOR1zmOsxNgegRmGDeVRyeyQ0_H\"\u003eModels\u003c/a\u003e\u0026nbsp;\u0026nbsp;\u0026bull;\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://drive.google.com/uc?export=download\u0026id=1Gzb-VYeQJNXwDnkoEI4iAskOGYmWR6Rk\"\u003eSample Images\u003c/a\u003e\n\u003c/h3\u003e\n\n\u003cbr\u003e\n\n## Citation\n```\n@InProceedings{Roy_2020_CVPR,\n  title     = {STEFANN: Scene Text Editor using Font Adaptive Neural Network},\n  author    = {Roy, Prasun and Bhattacharya, Saumik and Ghosh, Subhankar and Pal, Umapada},\n  booktitle = {The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n  month     = {June},\n  year      = {2020}\n}\n```\n\n\u003cbr\u003e\n\n## License\n```\nCopyright 2020 by the authors\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n\n\n\n##### Made with :heart: and :pizza: on Earth.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprasunroy%2Fstefann","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprasunroy%2Fstefann","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprasunroy%2Fstefann/lists"}