Name | textmark JSON |
Version |
0.5.0
JSON |
| download |
home_page | None |
Summary | Text annotation utilities for computer vision pipelines. |
upload_time | 2024-05-20 23:04:38 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
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. |
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": null,
"name": "textmark",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": "David Jones <d.t.jones@outlook.com>",
"keywords": "text, annotation, vision",
"author": null,
"author_email": "David Jones <d.t.jones@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/df/d9/5d194c2a261108570d353ecd1be60d767b6bdd534693d4f34bee9a3a3baf/textmark-0.5.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.5.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": "061ab4e037ceb9eaec90f17978c4c52049ddc617f228a3e21a3d14c9d14ac216",
"md5": "1078b605414dc2d9c3daf88d296153c4",
"sha256": "55cd02c7f1961e40067d216f63a1717097a660475598630066b5657dcb9cf8cb"
},
"downloads": -1,
"filename": "textmark-0.5.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1078b605414dc2d9c3daf88d296153c4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12532,
"upload_time": "2024-05-20T23:04:37",
"upload_time_iso_8601": "2024-05-20T23:04:37.846936Z",
"url": "https://files.pythonhosted.org/packages/06/1a/b4e037ceb9eaec90f17978c4c52049ddc617f228a3e21a3d14c9d14ac216/textmark-0.5.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "dfd95d194c2a261108570d353ecd1be60d767b6bdd534693d4f34bee9a3a3baf",
"md5": "259c7cbd04199a810a13dfdb8e8b73cb",
"sha256": "cc1777be960cc0aa4802735c57161410245b0ba9c19ea9c542adc763421ded78"
},
"downloads": -1,
"filename": "textmark-0.5.0.tar.gz",
"has_sig": false,
"md5_digest": "259c7cbd04199a810a13dfdb8e8b73cb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12973,
"upload_time": "2024-05-20T23:04:38",
"upload_time_iso_8601": "2024-05-20T23:04:38.963579Z",
"url": "https://files.pythonhosted.org/packages/df/d9/5d194c2a261108570d353ecd1be60d767b6bdd534693d4f34bee9a3a3baf/textmark-0.5.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-20 23:04:38",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "davidtjones",
"github_project": "textmark",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "textmark"
}