textmark


Nametextmark JSON
Version 0.4.0 PyPI version JSON
download
home_page
SummaryText annotation utilities for computer vision pipelines.
upload_time2024-03-13 18:20:25
maintainer
docs_urlNone
author
requires_python
licenseCopyright (c) 2024 David Jones Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords text annotation vision
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Text Annotation Utilities
This project supports buildling datasets for downstream tasks using many
open-source text-spotting datasets. It includes a number of classes and tools to
quickly and easily build text spotting datasets with many annotation types, 
including

* Dot
* 2-point bounding boxes
* Quadrilateral bounding boxes
* Polygons
* Bezier Curves

Additionally, this library makes converting between types extremely easy through an intuitive and extensible interface.

![example](./example/example.gif)

## Setup
Use pip to install: 
```
pip install textmark
```

## TextAnnotation
`TextAnnotation` is a base class that can be easily extended to support other annotation formats. This library includes several formats already. Of particular note is that TextAnnotation includes a class level conversion registry. Subclasses can be registered like so:

```python
# Add your subclass name:
TextAnnotation.register_name(name, "My_Class")
```

```python
# Add any relevant conversions
# you only need to convert to the "closest" next annotation type
TextAnnotation.register_conversion(BoxAnnotation, QuadAnnotation, BoxAnnotation.to_quad)
TextAnnotation.register_conversion(QuadAnnotation, BoxAnnotation, QuadAnnotation.to_box)
```

Now, a user can easily convert between Box and Quad annotations through the use of 
```python
my_quad_annotation.to("Box")
```

If there are additional registries, such as Quad <--> Polygon, the user can convert all the way from a Box to a Polygon annotation (or vice versa) in a single command:
```python
my_polygon_annotation.to("Box")
```

This system works by constructing a graph of all registered conversions. When a user calls the `.to` method, the graph is searched for the target class, and then applies all conversions on that path. This library implements the following simple conversions, which can be automatically chained together:

Polygon <--> Quad \
Quad <--> Box \
Box <--> Dot

Note that moving up through the chain is a lossy process!!

In addition, Bezier Curves can be converted to Polygons.

## Visualizing
This library also includes an easy visualization system. See the example below:
```python
from textmark import TextAnnotation, Visualizer

img_path = ...

my_annotation = TextAnnotation.factory(
    "Poly", scene_text, language, *list_of_points
)

my_second_annotation = TextAnnotation.factory(
    ...
)

# Can visualize an arbitrary number of annotations
vis = Visualizer(img_path, [my_annotation, my_second_annotation, ...])
visualization = vis.visualize()
visualize.show()  # uses PIL
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "textmark",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "David Jones <d.t.jones@outlook.com>",
    "keywords": "text,annotation,vision",
    "author": "",
    "author_email": "David Jones <d.t.jones@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/16/f8/545d35ee9936305b0f6c1ab70272551f0e54fb2147bd802da0ba5560547d/textmark-0.4.0.tar.gz",
    "platform": null,
    "description": "# Text Annotation Utilities\nThis project supports buildling datasets for downstream tasks using many\nopen-source text-spotting datasets. It includes a number of classes and tools to\nquickly and easily build text spotting datasets with many annotation types, \nincluding\n\n* Dot\n* 2-point bounding boxes\n* Quadrilateral bounding boxes\n* Polygons\n* Bezier Curves\n\nAdditionally, this library makes converting between types extremely easy through an intuitive and extensible interface.\n\n![example](./example/example.gif)\n\n## Setup\nUse pip to install: \n```\npip install textmark\n```\n\n## TextAnnotation\n`TextAnnotation` is a base class that can be easily extended to support other annotation formats. This library includes several formats already. Of particular note is that TextAnnotation includes a class level conversion registry. Subclasses can be registered like so:\n\n```python\n# Add your subclass name:\nTextAnnotation.register_name(name, \"My_Class\")\n```\n\n```python\n# Add any relevant conversions\n# you only need to convert to the \"closest\" next annotation type\nTextAnnotation.register_conversion(BoxAnnotation, QuadAnnotation, BoxAnnotation.to_quad)\nTextAnnotation.register_conversion(QuadAnnotation, BoxAnnotation, QuadAnnotation.to_box)\n```\n\nNow, a user can easily convert between Box and Quad annotations through the use of \n```python\nmy_quad_annotation.to(\"Box\")\n```\n\nIf there are additional registries, such as Quad <--> Polygon, the user can convert all the way from a Box to a Polygon annotation (or vice versa) in a single command:\n```python\nmy_polygon_annotation.to(\"Box\")\n```\n\nThis system works by constructing a graph of all registered conversions. When a user calls the `.to` method, the graph is searched for the target class, and then applies all conversions on that path. This library implements the following simple conversions, which can be automatically chained together:\n\nPolygon <--> Quad \\\nQuad <--> Box \\\nBox <--> Dot\n\nNote that moving up through the chain is a lossy process!!\n\nIn addition, Bezier Curves can be converted to Polygons.\n\n## Visualizing\nThis library also includes an easy visualization system. See the example below:\n```python\nfrom textmark import TextAnnotation, Visualizer\n\nimg_path = ...\n\nmy_annotation = TextAnnotation.factory(\n    \"Poly\", scene_text, language, *list_of_points\n)\n\nmy_second_annotation = TextAnnotation.factory(\n    ...\n)\n\n# Can visualize an arbitrary number of annotations\nvis = Visualizer(img_path, [my_annotation, my_second_annotation, ...])\nvisualization = vis.visualize()\nvisualize.show()  # uses PIL\n```\n\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2024 David Jones  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Text annotation utilities for computer vision pipelines.",
    "version": "0.4.0",
    "project_urls": {
        "homepage": "https://github.com/davidtjones/textmark",
        "repository": "https://github.com/davidtjones/textmark"
    },
    "split_keywords": [
        "text",
        "annotation",
        "vision"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ad53cae640cc8524e0e7fdc87de8447556f604cce3a8a2dd7eec218039a0f88c",
                "md5": "3381d5a7a3b3372aa23c37d7c8f01cb0",
                "sha256": "573385638ca06b06a46d84b7d12be715f1431c8cb4727effb867e53da6e2fb28"
            },
            "downloads": -1,
            "filename": "textmark-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3381d5a7a3b3372aa23c37d7c8f01cb0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 12452,
            "upload_time": "2024-03-13T18:20:23",
            "upload_time_iso_8601": "2024-03-13T18:20:23.763641Z",
            "url": "https://files.pythonhosted.org/packages/ad/53/cae640cc8524e0e7fdc87de8447556f604cce3a8a2dd7eec218039a0f88c/textmark-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "16f8545d35ee9936305b0f6c1ab70272551f0e54fb2147bd802da0ba5560547d",
                "md5": "828d290157cb27019f95dda192ec1d0a",
                "sha256": "5e67a255f8dcd0ee03e5ae6896442026560111d44994f87dabe136f9b7a026c0"
            },
            "downloads": -1,
            "filename": "textmark-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "828d290157cb27019f95dda192ec1d0a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 12886,
            "upload_time": "2024-03-13T18:20:25",
            "upload_time_iso_8601": "2024-03-13T18:20:25.428350Z",
            "url": "https://files.pythonhosted.org/packages/16/f8/545d35ee9936305b0f6c1ab70272551f0e54fb2147bd802da0ba5560547d/textmark-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-13 18:20:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "davidtjones",
    "github_project": "textmark",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "textmark"
}
        
Elapsed time: 0.20472s