{"id":13543178,"url":"https://github.com/fcakyon/craft-text-detector","last_synced_at":"2025-04-02T12:31:45.055Z","repository":{"id":39864728,"uuid":"255583401","full_name":"fcakyon/craft-text-detector","owner":"fcakyon","description":"Packaged, Pytorch-based, easy to use, cross-platform version of the CRAFT text detector","archived":true,"fork":false,"pushed_at":"2022-05-09T10:55:28.000Z","size":1553,"stargazers_count":252,"open_issues_count":3,"forks_count":91,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-11-03T10:32:05.528Z","etag":null,"topics":["actions","anaconda","computer-vision","craft","deep-learning","document","hacktoberfest","linux","macos","neural-network","ocr","pypi","python","pytorch","text","text-detection","vision","windows","workflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/fcakyon.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}},"created_at":"2020-04-14T10:52:26.000Z","updated_at":"2024-09-23T12:51:53.000Z","dependencies_parsed_at":"2022-08-09T15:35:29.123Z","dependency_job_id":null,"html_url":"https://github.com/fcakyon/craft-text-detector","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fcraft-text-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fcraft-text-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fcraft-text-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fcakyon%2Fcraft-text-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fcakyon","download_url":"https://codeload.github.com/fcakyon/craft-text-detector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246815676,"owners_count":20838485,"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":["actions","anaconda","computer-vision","craft","deep-learning","document","hacktoberfest","linux","macos","neural-network","ocr","pypi","python","pytorch","text","text-detection","vision","windows","workflow"],"created_at":"2024-08-01T11:00:24.947Z","updated_at":"2025-04-02T12:31:40.045Z","avatar_url":"https://github.com/fcakyon.png","language":"Python","funding_links":[],"categories":["Text detection and localization"],"sub_categories":["CRAFT [paper:2019](https://arxiv.org/pdf/1904.01941.pdf)"],"readme":"# CRAFT: Character-Region Awareness For Text detection\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://pepy.tech/project/craft-text-detector\"\u003e\u003cimg src=\"https://pepy.tech/badge/craft-text-detector\" alt=\"downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/craft-text-detector\"\u003e\u003cimg src=\"https://img.shields.io/pypi/pyversions/craft-text-detector\" alt=\"downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://twitter.com/fcakyon\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/fcakyon?color=blue\u0026logo=twitter\u0026style=flat\" alt=\"fcakyon twitter\"\u003e\n\u003cbr\u003e\n\u003ca href=\"https://github.com/fcakyon/craft-text-detector/actions\"\u003e\u003cimg alt=\"Build status\" src=\"https://github.com/fcakyon/craft-text-detector/actions/workflows/ci.yml/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://badge.fury.io/py/craft-text-detector\"\u003e\u003cimg src=\"https://badge.fury.io/py/craft-text-detector.svg\" alt=\"PyPI version\" height=\"20\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/fcakyon/craft-text-detector/blob/main/LICENSE\"\u003e\u003cimg alt=\"License: MIT\" src=\"https://img.shields.io/pypi/l/craft-text-detector\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nPackaged, Pytorch-based, easy to use, cross-platform version of the CRAFT text detector | [Paper](https://arxiv.org/abs/1904.01941) |\n\n## Overview\n\nPyTorch implementation for CRAFT text detector that effectively detect text area by exploring each character region and affinity between characters. The bounding box of texts are obtained by simply finding minimum bounding rectangles on binary map after thresholding character region and affinity scores.\n\n\u003cimg width=\"1000\" alt=\"teaser\" src=\"./figures/craft_example.gif\"\u003e\n\n## Getting started\n\n### Installation\n\n- Install using pip:\n\n```console\npip install craft-text-detector\n```\n\n### Basic Usage\n\n```python\n# import Craft class\nfrom craft_text_detector import Craft\n\n# set image path and export folder directory\nimage = 'figures/idcard.png' # can be filepath, PIL image or numpy array\noutput_dir = 'outputs/'\n\n# create a craft instance\ncraft = Craft(output_dir=output_dir, crop_type=\"poly\", cuda=False)\n\n# apply craft text detection and export detected regions to output directory\nprediction_result = craft.detect_text(image)\n\n# unload models from ram/gpu\ncraft.unload_craftnet_model()\ncraft.unload_refinenet_model()\n```\n\n### Advanced Usage\n\n```python\n# import craft functions\nfrom craft_text_detector import (\n    read_image,\n    load_craftnet_model,\n    load_refinenet_model,\n    get_prediction,\n    export_detected_regions,\n    export_extra_results,\n    empty_cuda_cache\n)\n\n# set image path and export folder directory\nimage = 'figures/idcard.png' # can be filepath, PIL image or numpy array\noutput_dir = 'outputs/'\n\n# read image\nimage = read_image(image)\n\n# load models\nrefine_net = load_refinenet_model(cuda=True)\ncraft_net = load_craftnet_model(cuda=True)\n\n# perform prediction\nprediction_result = get_prediction(\n    image=image,\n    craft_net=craft_net,\n    refine_net=refine_net,\n    text_threshold=0.7,\n    link_threshold=0.4,\n    low_text=0.4,\n    cuda=True,\n    long_size=1280\n)\n\n# export detected text regions\nexported_file_paths = export_detected_regions(\n    image=image,\n    regions=prediction_result[\"boxes\"],\n    output_dir=output_dir,\n    rectify=True\n)\n\n# export heatmap, detection points, box visualization\nexport_extra_results(\n    image=image,\n    regions=prediction_result[\"boxes\"],\n    heatmaps=prediction_result[\"heatmaps\"],\n    output_dir=output_dir\n)\n\n# unload models from gpu\nempty_cuda_cache()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcakyon%2Fcraft-text-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffcakyon%2Fcraft-text-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffcakyon%2Fcraft-text-detector/lists"}