{"id":18028476,"url":"https://github.com/interactivetech/synthtiger-bbox","last_synced_at":"2025-04-04T20:45:17.061Z","repository":{"id":175020676,"uuid":"652855367","full_name":"interactivetech/synthtiger-bbox","owner":"interactivetech","description":"Modify synthtiger to return bounding box coordinates","archived":false,"fork":false,"pushed_at":"2023-06-13T16:02:58.000Z","size":10660,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T05:24:59.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interactivetech.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":"2023-06-12T23:50:56.000Z","updated_at":"2023-06-13T16:00:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"dadfd366-034a-4454-bba0-065250b19c76","html_url":"https://github.com/interactivetech/synthtiger-bbox","commit_stats":null,"previous_names":["interactivetech/synthtiger-bbox"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Fsynthtiger-bbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Fsynthtiger-bbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Fsynthtiger-bbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interactivetech%2Fsynthtiger-bbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interactivetech","download_url":"https://codeload.github.com/interactivetech/synthtiger-bbox/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249601,"owners_count":20908211,"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":[],"created_at":"2024-10-30T08:42:18.223Z","updated_at":"2025-04-04T20:45:17.041Z","avatar_url":"https://github.com/interactivetech.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# SynthTIGER 🐯 : Synthetic Text Image Generator\n\n[![PyPI version](https://img.shields.io/pypi/v/synthtiger)](https://pypi.org/project/synthtiger/)\n[![CI](https://github.com/clovaai/synthtiger/actions/workflows/ci.yml/badge.svg)](https://github.com/clovaai/synthtiger/actions/workflows/ci.yml)\n[![Docs](https://github.com/clovaai/synthtiger/actions/workflows/docs.yml/badge.svg)](https://github.com/clovaai/synthtiger/actions/workflows/docs.yml)\n[![License](https://img.shields.io/github/license/clovaai/synthtiger)](LICENSE)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nSynthetic Text Image Generator for OCR Model | [Paper](https://arxiv.org/abs/2107.09313) | [Documentation](https://clovaai.github.io/synthtiger/) | [Datasets](#datasets)\n\n\u003c/div\u003e\n\n\u003cimg src=\"https://user-images.githubusercontent.com/12423224/153699080-29da7908-0662-4435-ba27-dd07c3bbb7f2.png\"/\u003e\n\n## Contents\n\n- [Documentation](#documentation)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Advanced Usage](#advanced-usage)\n- [Datasets](#datasets)\n- [Citation](#citation)\n- [License](#license)\n\n## Documentation\n\nThe documentation is available at \u003chttps://clovaai.github.io/synthtiger/\u003e.\n\nYou can check API reference in this documentation.\n\n## Installation\n\nSynthTIGER requires `python\u003e=3.6` and `libraqm`.\n\nTo install SynthTIGER from PyPI:\n\n```bash\n$ pip install synthtiger\n```\n\nIf you see a dependency error when you install or run SynthTIGER, install [dependencies](depends).\n\n## Usage\n\n```bash\n# Set environment variable (for macOS)\n$ export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES\n```\n\n```\nusage: synthtiger [-h] [-o DIR] [-c NUM] [-w NUM] [-s NUM] [-v] SCRIPT NAME [CONFIG]\n\npositional arguments:\n  SCRIPT                Script file path.\n  NAME                  Template class name.\n  CONFIG                Config file path.\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -o DIR, --output DIR  Directory path to save data.\n  -c NUM, --count NUM   Number of output data. [default: 100]\n  -w NUM, --worker NUM  Number of workers. If 0, It generates data in the main process. [default: 0]\n  -s NUM, --seed NUM    Random seed. [default: None]\n  -v, --verbose         Print error messages while generating data.\n```\n\n### Examples\n\n#### SynthTIGER text images\n\n```bash\n# horizontal\nsynthtiger -o results -w 4 -v examples/synthtiger/template.py SynthTiger examples/synthtiger/config_horizontal.yaml\n\n# vertical\nsynthtiger -o results -w 4 -v examples/synthtiger/template.py SynthTiger examples/synthtiger/config_vertical.yaml\n```\n\n\u003cp\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/12423224/153699084-1d5fbb15-0ca0-4a85-9639-6f2c4c1bf9ec.png\" width=\"50%\"/\u003e\n    \u003cimg src=\"https://user-images.githubusercontent.com/12423224/199258481-5706db59-127a-4453-a8ab-4a0bb9f266d5.png\" width=\"45%\"/\u003e\n\u003c/p\u003e\n\n- `images`: a directory containing images.\n- `gt.txt`: a file containing text labels.\n- `coords.txt`: a file containing bounding boxes of characters with text effect.\n- `glyph_coords.txt`: a file containing bounding boxes of characters without text effect.\n- `masks`: a directory containing mask images with text effect.\n- `glyph_masks`: a directory containing mask images without text effect.\n\n#### Multiline text images\n\n```bash\nsynthtiger -o results -w 4 -v examples/multiline/template.py Multiline examples/multiline/config.yaml\n```\n\n\u003cimg src=\"https://user-images.githubusercontent.com/12423224/153699088-cdeb3eb3-e117-4959-abf4-8454ad95d886.png\" width=\"75%\"/\u003e\n\n- `images`: a directory containing images.\n- `gt.txt`: a file containing text labels.\n\n## Advanced Usage\n\n### Non-Latin language data generation\n\n\u003cimg src=\"https://user-images.githubusercontent.com/12423224/167302532-dbd5fa60-bcba-4f77-92ee-58bb6efda51c.png\" width=\"40%\"/\u003e\n\n1. Prepare corpus\n\n   `txt` format, line by line ([example](resources/corpus/mjsynth.txt)).\n\n2. Prepare fonts\n\n   See [font customization](#font-customization) for more details.\n\n3. Edit corpus path and font path in config file ([example](examples/synthtiger/config_horizontal.yaml))\n\n4. Run synthtiger\n\n### Font customization\n\n1. Prepare fonts\n\n   `ttf`/`otf` format ([example](resources/font)).\n\n2. Extract renderable charsets\n\n   ```bash\n   python tools/extract_font_charset.py -w 4 fonts/\n   ```\n\n   This script extracts renderable charsets for all font files ([example](resources/font/Ubuntu-Regular.txt)).\n\n   Text files are generated in the input path with the same names as the fonts.\n\n3. Edit font path in config file ([example](examples/synthtiger/config_horizontal.yaml))\n\n4. Run synthtiger\n\n### Colormap customization\n\n1. Prepare images\n\n   `jpg`/`jpeg`/`png`/`bmp` format.\n\n2. Create colormaps\n\n   ```bash\n   python tools/create_colormap.py --max_k 3 -w 4 images/ colormap.txt\n   ```\n\n   This script creates colormaps for all image files ([example](resources/colormap/iiit5k_gray.txt)).\n\n3. Edit colormap path in config file ([example](examples/synthtiger/config_horizontal.yaml))\n\n4. Run synthtiger\n\n### Template customization\n\nYou can implement custom templates by inheriting the base template.\n\n```python\nfrom synthtiger import templates\n\n\nclass MyTemplate(templates.Template):\n    def __init__(self, config=None):\n        # initialize template.\n\n    def generate(self):\n        # generate data.\n\n    def init_save(self, root):\n        # initialize something before save.\n\n    def save(self, root, data, idx):\n        # save data to specific path.\n\n    def end_save(self, root):\n        # finalize something after save.\n```\n\n## Datasets\n\nSynthTIGER is available for download at [google drive](https://drive.google.com/drive/folders/1faHxo6gVeUmmFKJf8dxFZf_yRjamUL96?usp=sharing).\n\nDataset was split into several smaller files. Please download all files and run following command.\n\n```bash\n# for Linux, macOS\ncat synthtiger_v1.0.zip.* \u003e synthtiger_v1.0.zip\n\n# for Windows\ncopy /b synthtiger_v1.0.zip.* synthtiger_v1.0.zip\n```\n\n**synthtiger_v1.0.zip** (36G) (md5: 5b5365f4fe15de24e403a9256079be70)\n\n- Original paper version.\n  - Used MJ and ST label.\n\n**synthtiger_v1.1.zip** (38G) (md5: b2757a7e2b5040b14ed64c473533b592)\n\n- Used MJ and ST lexicon instead of MJ and ST label.\n  - [resources/corpus/mjsynth.txt](resources/corpus/mjsynth.txt)\n  - [resources/corpus/synthtext.txt](resources/corpus/synthtext.txt)\n- Fixed a bug that applies transformation twice on curved text.\n- Fixed a bug that incorrectly converts grayscale to RGB.\n\n| Version | IIIT5k | SVT | IC03 | IC13 | IC15 | SVTP | CUTE80 | Total |\n| ------- | ------ | --- | ---- | ---- | ---- | ---- | ------ | ----- |\n| 1.0 | 93.2 | 87.3 | 90.5 | 92.9 | 72.1 | 77.7 | 80.6 | 85.9 |\n| 1.1 | 93.4 | 87.6 | 91.4 | 93.2 | 73.9 | 77.8 | 80.6 | 86.6 |\n\n### Structure\n\nThe structure of the dataset is as follows. The dataset contains 10M images.\n\n```\ngt.txt\nimages/\n    0/\n        0.jpg\n        1.jpg\n        ...\n        9998.jpg\n        9999.jpg\n    1/\n    ...\n    998/\n    999/\n```\n\nThe format of `gt.txt` is as follows. Image path and label are separated by tab. (`\u003cimage_path\u003e\\t\u003clabel\u003e`)\n\n```\nimages/0/0.jpg\t10\nimages/0/1.jpg\tdate:\n...\nimages/999/9999998.jpg\tSTUFFIER\nimages/999/9999999.jpg\tRe:\n```\n\n## Citation\n\n```bibtex\n@inproceedings{yim2021synthtiger,\n  title={SynthTIGER: Synthetic Text Image GEneratoR Towards Better Text Recognition Models},\n  author={Yim, Moonbin and Kim, Yoonsik and Cho, Han-Cheol and Park, Sungrae},\n  booktitle={International Conference on Document Analysis and Recognition},\n  pages={109--124},\n  year={2021},\n  organization={Springer}\n}\n```\n\n## License\n\n```\nSynthTIGER\nCopyright (c) 2021-present NAVER Corp.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n\nThe following directories and their subdirectories are licensed the same as their origins. Please refer to [NOTICE](NOTICE)\n\n```\ndocs/\nresources/font/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractivetech%2Fsynthtiger-bbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finteractivetech%2Fsynthtiger-bbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finteractivetech%2Fsynthtiger-bbox/lists"}