{"id":13543183,"url":"https://github.com/YongWookHa/craft-text-detector","last_synced_at":"2025-04-02T12:31:47.093Z","repository":{"id":112076116,"uuid":"438460682","full_name":"YongWookHa/craft-text-detector","owner":"YongWookHa","description":"CRAFT text detector for high resolution image","archived":false,"fork":false,"pushed_at":"2021-12-17T00:52:13.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-03T10:32:06.426Z","etag":null,"topics":["craft","high-resolution","ocr","pytorch","pytorch-lightning","text-detector"],"latest_commit_sha":null,"homepage":"","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/YongWookHa.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}},"created_at":"2021-12-15T01:51:14.000Z","updated_at":"2024-07-24T17:45:00.000Z","dependencies_parsed_at":"2023-03-23T17:50:04.595Z","dependency_job_id":null,"html_url":"https://github.com/YongWookHa/craft-text-detector","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/YongWookHa%2Fcraft-text-detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YongWookHa%2Fcraft-text-detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YongWookHa%2Fcraft-text-detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/YongWookHa%2Fcraft-text-detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/YongWookHa","download_url":"https://codeload.github.com/YongWookHa/craft-text-detector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246815685,"owners_count":20838486,"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":["craft","high-resolution","ocr","pytorch","pytorch-lightning","text-detector"],"created_at":"2024-08-01T11:00:25.117Z","updated_at":"2025-04-02T12:31:42.085Z","avatar_url":"https://github.com/YongWookHa.png","language":"Python","funding_links":[],"categories":["Text detection and localization"],"sub_categories":["CRAFT [paper:2019](https://arxiv.org/pdf/1904.01941.pdf)"],"readme":"# Overview\n\nOriginal CRAFT text detector's input image size is `384x384`. Though CRAFT showed good performance for scene text detection, the input size is not enough for the high-resolution task, especially when it comes to document.\n\nThis repository of CRAFT, you can change input image size for improving model performance at training.\n\n# How to use\n\n## Prepare your data\n\nFirst of all, write your own Dataloader code.\n\nIn `datasets/craft_dataset.py`, you can find `CustomDataset`.\n\nMake your `CustomDataset` return `image, char_boxes, words, image_fn` by `__getitem__` method. Return data format should be same as below.\n\n- `image` : np.ndarray  \n- `char_boxes` : character level bounding box coord.\n    ```\n    [   [lx, ly], [rx, ly], [rx, ry], [lx, ry],\n        [lx, ly], [rx, ly], [rx, ry], [lx, ry],\n        ...]   \n    ```  \n- `words` : list of words. character annotation should be in order of bounding boxes.\n- `image_fn` : [pathlib](https://docs.python.org/3/library/pathlib.html) image path  \n\nThen, change setting in `settings/default.yaml`.\n\n```\ntrain_data_path: \u003cyour train data path\u003e\nval_data_path: \u003cyour validate data path\u003e\n```  \n\nThese two setting is all you need to edit.  \n\nNow you are ready to train your model. But the training might be very slow because of data processing time at making character and affinity heatmap.   \n\nWhen it comes to train detecting text in high resolution documents, the heatmap processing is very slow.\n\nIn fact, the same data processing repeats every epoch. So, it does not necessarily have to be done for every epoch. Therefore, let's preprocess it before we start training.\n\nRun `preprocess.py` like below.\n\n```bash\npython preprocess.py --setting settings/default.yaml --num_workers 16 --batch_size 4\n```\n\n## Train\n\n```bash\npython run.py --setting settings/default.yaml --version 0 --num_workers 16 -bs 4 --preprocessed\n```\n\nTo monitor the training progress, use tensorboard.\n\n```bash\ntensorboard --logdir tb_logs --bind_all\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYongWookHa%2Fcraft-text-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FYongWookHa%2Fcraft-text-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FYongWookHa%2Fcraft-text-detector/lists"}