rapid-layout


Namerapid-layout JSON
Version 0.0.19 PyPI version JSON
download
home_pagehttps://github.com/RapidAI/RapidStructure
SummaryTools for document layout analysis based ONNXRuntime.
upload_time2023-07-06 10:34:48
maintainer
docs_urlNone
authorSWHL
requires_python>=3.6,<3.12
licenseApache-2.0
keywords ppstructure layout rapidocr rapid_layout
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## rapid-layout
<p align="left">
    <a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>
    <a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>
    <a href="https://pypi.org/project/rapid-layout/"><img alt="PyPI" src="https://img.shields.io/pypi/v/rapid-layout"></a>
    <a href="https://pepy.tech/project/rapid-layout"><img src="https://static.pepy.tech/personalized-badge/rapid-layout?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads"></a>
</p>


### 1. Install package by pypi.
```bash
$ pip install rapid-layout
```

### 2. Run by script.
- RapidLayout has the default `model_path` value, you can set the different value of `model_path` to use different models, e.g. `layout_engine = RapidLayout(model_path='layout_publaynet.onnx')`
- See details, for [README_Layout](https://github.com/RapidAI/RapidStructure/blob/main/docs/README_Layout.md) .
- 📌 `layout.png` source: [link](https://github.com/RapidAI/RapidStructure/blob/main/test_images/layout.png)

```python
from rapid_layout import RapidLayout

layout_engine = RapidLayout()

with open('layout.png', 'rb') as f:
    img = f.read()

layout_res, elapse = layout_engine(img)
print(layout_res)
```

### 3. Run by command line.
- Usage:
    ```bash
    $ rapid_layout -h
    usage: rapid_layout [-h] [-v] -img IMG_PATH [-m MODEL_PATH]

    optional arguments:
    -h, --help            show this help message and exit
    -v, --vis             Wheter to visualize the layout results.
    -img IMG_PATH, --img_path IMG_PATH
                            Path to image for layout.
    -m MODEL_PATH, --model_path MODEL_PATH
                            The model path used for inference.
    ```
- Example:
    ```bash
    $ rapid_layout -v -img layout.png
    ```

### 4. Result.
- Return value.
    ```python
    [
        {'bbox': array([321.4160495, 91.53214898, 562.06141263, 199.85522603]), 'label': 'text'},
        {'bbox': array([58.67292211, 107.29000663, 300.25448676, 199.68142]), 'label': 'table_caption'}
    ]
    ```
- Visualize result.
    <div align="center">
        <img src="https://raw.githubusercontent.com/RapidAI/RapidOCR/947c6958d30f47c7c7b016f7dc308f235acec3ee/python/rapid_structure/test_images/layout_result.jpg" width="80%" height="80%">
    </div>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RapidAI/RapidStructure",
    "name": "rapid-layout",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6,<3.12",
    "maintainer_email": "",
    "keywords": "ppstructure,layout,rapidocr,rapid_layout",
    "author": "SWHL",
    "author_email": "liekkaskono@163.com",
    "download_url": "",
    "platform": "Any",
    "description": "## rapid-layout\n<p align=\"left\">\n    <a href=\"\"><img src=\"https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg\"></a>\n    <a href=\"\"><img src=\"https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg\"></a>\n    <a href=\"https://pypi.org/project/rapid-layout/\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/rapid-layout\"></a>\n    <a href=\"https://pepy.tech/project/rapid-layout\"><img src=\"https://static.pepy.tech/personalized-badge/rapid-layout?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=Downloads\"></a>\n</p>\n\n\n### 1. Install package by pypi.\n```bash\n$ pip install rapid-layout\n```\n\n### 2. Run by script.\n- RapidLayout has the default `model_path` value, you can set the different value of `model_path` to use different models, e.g. `layout_engine = RapidLayout(model_path='layout_publaynet.onnx')`\n- See details, for [README_Layout](https://github.com/RapidAI/RapidStructure/blob/main/docs/README_Layout.md) .\n- \ud83d\udccc `layout.png` source: [link](https://github.com/RapidAI/RapidStructure/blob/main/test_images/layout.png)\n\n```python\nfrom rapid_layout import RapidLayout\n\nlayout_engine = RapidLayout()\n\nwith open('layout.png', 'rb') as f:\n    img = f.read()\n\nlayout_res, elapse = layout_engine(img)\nprint(layout_res)\n```\n\n### 3. Run by command line.\n- Usage:\n    ```bash\n    $ rapid_layout -h\n    usage: rapid_layout [-h] [-v] -img IMG_PATH [-m MODEL_PATH]\n\n    optional arguments:\n    -h, --help            show this help message and exit\n    -v, --vis             Wheter to visualize the layout results.\n    -img IMG_PATH, --img_path IMG_PATH\n                            Path to image for layout.\n    -m MODEL_PATH, --model_path MODEL_PATH\n                            The model path used for inference.\n    ```\n- Example:\n    ```bash\n    $ rapid_layout -v -img layout.png\n    ```\n\n### 4. Result.\n- Return value.\n    ```python\n    [\n        {'bbox': array([321.4160495, 91.53214898, 562.06141263, 199.85522603]), 'label': 'text'},\n        {'bbox': array([58.67292211, 107.29000663, 300.25448676, 199.68142]), 'label': 'table_caption'}\n    ]\n    ```\n- Visualize result.\n    <div align=\"center\">\n        <img src=\"https://raw.githubusercontent.com/RapidAI/RapidOCR/947c6958d30f47c7c7b016f7dc308f235acec3ee/python/rapid_structure/test_images/layout_result.jpg\" width=\"80%\" height=\"80%\">\n    </div>\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Tools for document layout analysis based ONNXRuntime.",
    "version": "0.0.19",
    "project_urls": {
        "Homepage": "https://github.com/RapidAI/RapidStructure"
    },
    "split_keywords": [
        "ppstructure",
        "layout",
        "rapidocr",
        "rapid_layout"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9dd2f37837793ad360fdcdd0359038970633ae832a1b9d22ce00778a6a21798",
                "md5": "2ba04569df3276add5420494ca010491",
                "sha256": "90995ca68afb22f6c5db405f48d03b33f1d004372577c9f3545f4913dbe8fe1d"
            },
            "downloads": -1,
            "filename": "rapid_layout-0.0.19-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2ba04569df3276add5420494ca010491",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6,<3.12",
            "size": 6835753,
            "upload_time": "2023-07-06T10:34:48",
            "upload_time_iso_8601": "2023-07-06T10:34:48.034340Z",
            "url": "https://files.pythonhosted.org/packages/b9/dd/2f37837793ad360fdcdd0359038970633ae832a1b9d22ce00778a6a21798/rapid_layout-0.0.19-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-06 10:34:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RapidAI",
    "github_project": "RapidStructure",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "rapid-layout"
}
        
Elapsed time: 0.08912s