textbsr


Nametextbsr JSON
Version 0.1.12 PyPI version JSON
download
home_pagehttps://github.com/csxmli2016/MARCONet
Summarya simple version for blind text image super-resolution (current version is only for English and Chinese)
upload_time2023-06-05 13:29:19
maintainer
docs_urlNone
authorXiaoming Li
requires_python>=3.6
licenseS-Lab License 1.0
keywords blind text image super-resolution
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Update v0.1.12

- Support text region with different angle.
- Higher resolution. min(height, width) of output is 256 (128 in v0.24.0)

See our project page for more details: https://github.com/csxmli2016/textbsr

-----------

## This is a simple text image super-resolution package.
More details can be found in our Project Page: https://github.com/csxmli2016/textbsr

This package can post-process the text region with a simple command, i.e., 
```
textbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH]
```

> - [LR_TEXT_PATH] is the LR image path.
> - [BACKGROUND_SR_PATH] stores the results from any blind image super-resolution methods.
> - If the text image is degraded severely, this method may still fail to obtain a plausible result.

### Dependencies and Installation
- numpy
- cnstd
- torch>=1.8.1
- torchvision>=0.9

``` 
# Install with pip
pip install textbsr
```


### Basic Usage

```
# On the terminal command
textbsr -i [LR_TEXT_PATH]
```
or
```
# On the python environment
from textbsr import textbsr
textbsr.bsr(input_path='./testsets/LQs')
```

Parameter details:

| parameter name | default | description  |
| :-----  | :-----:  | :-----  |
| <span style="white-space:nowrap">-i, --input_path </span>| - | The lr text image path. It can store full images or text layouts only. |
| <span style="white-space:nowrap">-b, --bg_path</span> | None | The background sr path from other methods. If None, we only restore the text region detected by cnstd.|
| <span style="white-space:nowrap">-o, --output_path</span> | None | The save path for text sr result. If None, we save the results on the same path with the format of [input_path]\_TIMESTAMP.|
| <span style="white-space:nowrap">-a, --aligned </span>| False | action='store_true'. If True, the input text image contains only text region. If False, we use CnSTD to detect text regions and then restore them.|
| <span style="white-space:nowrap">-s, --save_text </span>| False | action='store_true'. If True, save the LR and SR text layout.|
| <span style="white-space:nowrap">-d, --device</span> | None | Device, use 'gpu' or 'cpu'. If None, we use torch.cuda.is_available to select the device. |

### Example for post-processing the text region
```
# On the terminal command
textbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH] -s
```
or
```
# On the python environment
from textbsr import textbsr
textbsr.bsr(input_path='./testsets/LQs', bg_path='./testsets/RealESRGANResults', save_text=True)
```
> When [BACKGROUND_SR_PATH] is None, we only restore the text region and paste it back to the LR input, with the background region unchanged.


---

### Example for restoring the aligned text region
```
# On the terminal command
textbsr -i [LR_TEXT_PATH] -a
```
or
```
# On the python environment
from textbsr import textbsr
textbsr.bsr(input_path='./testsets/LQs', aligned=True)
```



> If you find this package helpful, please kindly consider citing our paper:
```
@InProceedings{li2023marconet,
author = {Li, Xiaoming and Zuo, Wangmeng and Loy, Chen Change},
title = {Learning Generative Structure Prior for Blind Text Image Super-resolution},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},
year = {2023}
}
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/csxmli2016/MARCONet",
    "name": "textbsr",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "blind text image super-resolution",
    "author": "Xiaoming Li",
    "author_email": "csxmli@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/83/c3/0810ba664432e956270810e935ed5bf7252c3a417bd333dbfbdac7eed3d1/textbsr-0.1.12.tar.gz",
    "platform": null,
    "description": "\n# Update v0.1.12\n\n- Support text region with different angle.\n- Higher resolution. min(height, width) of output is 256 (128 in v0.24.0)\n\nSee our project page for more details: https://github.com/csxmli2016/textbsr\n\n-----------\n\n## This is a simple text image super-resolution package.\nMore details can be found in our Project Page: https://github.com/csxmli2016/textbsr\n\nThis package can post-process the text region with a simple command, i.e., \n```\ntextbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH]\n```\n\n> - [LR_TEXT_PATH] is the LR image path.\n> - [BACKGROUND_SR_PATH] stores the results from any blind image super-resolution methods.\n> - If the text image is degraded severely, this method may still fail to obtain a plausible result.\n\n### Dependencies and Installation\n- numpy\n- cnstd\n- torch>=1.8.1\n- torchvision>=0.9\n\n``` \n# Install with pip\npip install textbsr\n```\n\n\n### Basic Usage\n\n```\n# On the terminal command\ntextbsr -i [LR_TEXT_PATH]\n```\nor\n```\n# On the python environment\nfrom textbsr import textbsr\ntextbsr.bsr(input_path='./testsets/LQs')\n```\n\nParameter details:\n\n| parameter name | default | description  |\n| :-----  | :-----:  | :-----  |\n| <span style=\"white-space:nowrap\">-i, --input_path </span>| - | The lr text image path. It can store full images or text layouts only. |\n| <span style=\"white-space:nowrap\">-b, --bg_path</span> | None | The background sr path from other methods. If None, we only restore the text region detected by cnstd.|\n| <span style=\"white-space:nowrap\">-o, --output_path</span> | None | The save path for text sr result. If None, we save the results on the same path with the format of [input_path]\\_TIMESTAMP.|\n| <span style=\"white-space:nowrap\">-a, --aligned </span>| False | action='store_true'. If True, the input text image contains only text region. If False, we use CnSTD to detect text regions and then restore them.|\n| <span style=\"white-space:nowrap\">-s, --save_text </span>| False | action='store_true'. If True, save the LR and SR text layout.|\n| <span style=\"white-space:nowrap\">-d, --device</span> | None | Device, use 'gpu' or 'cpu'. If None, we use torch.cuda.is_available to select the device. |\n\n### Example for post-processing the text region\n```\n# On the terminal command\ntextbsr -i [LR_TEXT_PATH] -b [BACKGROUND_SR_PATH] -s\n```\nor\n```\n# On the python environment\nfrom textbsr import textbsr\ntextbsr.bsr(input_path='./testsets/LQs', bg_path='./testsets/RealESRGANResults', save_text=True)\n```\n> When [BACKGROUND_SR_PATH] is None, we only restore the text region and paste it back to the LR input, with the background region unchanged.\n\n\n---\n\n### Example for restoring the aligned text region\n```\n# On the terminal command\ntextbsr -i [LR_TEXT_PATH] -a\n```\nor\n```\n# On the python environment\nfrom textbsr import textbsr\ntextbsr.bsr(input_path='./testsets/LQs', aligned=True)\n```\n\n\n\n> If you find this package helpful, please kindly consider citing our paper:\n```\n@InProceedings{li2023marconet,\nauthor = {Li, Xiaoming and Zuo, Wangmeng and Loy, Chen Change},\ntitle = {Learning Generative Structure Prior for Blind Text Image Super-resolution},\nbooktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},\nyear = {2023}\n}\n```\n\n\n",
    "bugtrack_url": null,
    "license": "S-Lab License 1.0",
    "summary": "a simple version for blind text image super-resolution (current version is only for English and Chinese)",
    "version": "0.1.12",
    "project_urls": {
        "Homepage": "https://github.com/csxmli2016/MARCONet"
    },
    "split_keywords": [
        "blind",
        "text",
        "image",
        "super-resolution"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "da0b267d3298fe0f84cc7ecf24746678ba69622fca629d160765fb21389404e2",
                "md5": "13d5636038ebdd66fda05ad4c4bc9648",
                "sha256": "adaa1799259b5a18b84efaded1523188ddc763928003cb639507ef756d5c19dd"
            },
            "downloads": -1,
            "filename": "textbsr-0.1.12-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "13d5636038ebdd66fda05ad4c4bc9648",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10875,
            "upload_time": "2023-06-05T13:29:18",
            "upload_time_iso_8601": "2023-06-05T13:29:18.235727Z",
            "url": "https://files.pythonhosted.org/packages/da/0b/267d3298fe0f84cc7ecf24746678ba69622fca629d160765fb21389404e2/textbsr-0.1.12-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83c30810ba664432e956270810e935ed5bf7252c3a417bd333dbfbdac7eed3d1",
                "md5": "0147b332cf040ef3ec7395c43cb6da6a",
                "sha256": "5dc71fec4119d5e6f656679f7adaf55b9d390ec8b4de508604461d3c050f92d8"
            },
            "downloads": -1,
            "filename": "textbsr-0.1.12.tar.gz",
            "has_sig": false,
            "md5_digest": "0147b332cf040ef3ec7395c43cb6da6a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10256,
            "upload_time": "2023-06-05T13:29:19",
            "upload_time_iso_8601": "2023-06-05T13:29:19.787464Z",
            "url": "https://files.pythonhosted.org/packages/83/c3/0810ba664432e956270810e935ed5bf7252c3a417bd333dbfbdac7eed3d1/textbsr-0.1.12.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-05 13:29:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "csxmli2016",
    "github_project": "MARCONet",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "textbsr"
}
        
Elapsed time: 0.09240s