================================================================
drawyolo
================================================================
.. start-badges
|pypi badge| |testing badge| |coverage badge| |docs badge| |black badge|
.. |pypi badge| image:: https://img.shields.io/pypi/v/drawyolo
:target: https://pypi.org/project/drawyolo/
.. |testing badge| image:: https://github.com/rbturnbull/drawyolo/actions/workflows/testing.yml/badge.svg
:target: https://github.com/rbturnbull/drawyolo/actions
.. |docs badge| image:: https://github.com/rbturnbull/drawyolo/actions/workflows/docs.yml/badge.svg
:target: https://rbturnbull.github.io/drawyolo
.. |black badge| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |coverage badge| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/rbturnbull/4824a2c398904709e901d0b7e8269d4b/raw/coverage-badge.json
:target: https://rbturnbull.github.io/drawyolo/coverage/
.. end-badges
.. start-quickstart
Draws boxes on images from annotations in YOLO format.
Installation
==================================
Install using pip:
.. code-block:: bash
pip install drawyolo
Or directly from the repository:
.. code-block:: bash
pip install git+https://github.com/rbturnbull/drawyolo.git
Drawing boxes from labels
==================================
If you have a label file in YOLO format like this:
.. code-block:: text
class_id x_center y_center width height
For example:
.. code-block:: text
0 0.35 0.35 0.14 0.14
0 0.55 0.3 0.14 0.14
1 0.7 0.15 0.2 0.2
Then you can draw the boxes on an image like this:
.. code-block:: bash
drawyolo image.jpg output.jpg --labels labels.txt --classes class1,class2
To try it out on the image in the repository:
.. code-block:: bash
drawyolo tests/test-data/terrier.webp tests/test-data/output.jpg --labels tests/test-data/labels.txt --classes eye,ear
That will create an image like this:
.. image:: https://raw.githubusercontent.com/rbturnbull/drawyolo/main/tests/test-data/output.jpg
:alt: Output image
:align: center
To resize the image, use the ``--width`` and/or ``--height`` options.
The aspect ratio will be preserved if you do not set both ``--width`` and ``--height``.
For example:
.. code-block:: bash
drawyolo tests/test-data/terrier.webp tests/test-data/output-thumbnail.jpg --labels tests/test-data/labels.txt --classes eye,ear --width 240
.. image:: https://raw.githubusercontent.com/rbturnbull/drawyolo/main/tests/test-data/output-thumbnail.jpg
:alt: Output image thumbnail
:align: center
The thickness of the line will be set according to the final size of the image. You can change the thickness with the ``--line-thickness`` option.
Drawing boxes from a YOLO model
==================================
If you have a YOLO model with weights, you can draw the boxes on an image like this:
.. code-block:: bash
drawyolo image.jpg output.jpg --weights model.pt
You can also resize the image as before with the ``--width`` and ``--height`` options.
Advanced usage
==================================
For more options see the help
.. code-block:: bash
drawyolo --help
.. end-quickstart
Credits
==================================
.. start-credits
Robert Turnbull (Melbourne Data Analytics Platform) - `https://robturnbull.com <https://robturnbull.com>`_
.. end-credits
Raw data
{
"_id": null,
"home_page": "https://github.com/rbturnbull/drawyolo/",
"name": "drawyolo",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": null,
"keywords": "yolo, command-line interface",
"author": "Robert Turnbull",
"author_email": "robert.turnbull@unimelb.edu.au",
"download_url": "https://files.pythonhosted.org/packages/e1/ef/d78f0a408f42c3c9d2aae2a1a31f5c664f74f5a96e01deee76075aad23e7/drawyolo-0.1.2.tar.gz",
"platform": null,
"description": "================================================================\ndrawyolo\n================================================================\n\n.. start-badges\n\n|pypi badge| |testing badge| |coverage badge| |docs badge| |black badge|\n\n.. |pypi badge| image:: https://img.shields.io/pypi/v/drawyolo\n :target: https://pypi.org/project/drawyolo/\n\n.. |testing badge| image:: https://github.com/rbturnbull/drawyolo/actions/workflows/testing.yml/badge.svg\n :target: https://github.com/rbturnbull/drawyolo/actions\n\n.. |docs badge| image:: https://github.com/rbturnbull/drawyolo/actions/workflows/docs.yml/badge.svg\n :target: https://rbturnbull.github.io/drawyolo\n \n.. |black badge| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n :target: https://github.com/psf/black\n \n.. |coverage badge| image:: https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/rbturnbull/4824a2c398904709e901d0b7e8269d4b/raw/coverage-badge.json\n :target: https://rbturnbull.github.io/drawyolo/coverage/\n \n.. end-badges\n\n.. start-quickstart\n\nDraws boxes on images from annotations in YOLO format.\n\nInstallation\n==================================\n\nInstall using pip:\n\n.. code-block:: bash\n\n pip install drawyolo\n\nOr directly from the repository:\n\n.. code-block:: bash\n\n pip install git+https://github.com/rbturnbull/drawyolo.git\n\nDrawing boxes from labels\n==================================\n\nIf you have a label file in YOLO format like this:\n\n.. code-block:: text\n\n class_id x_center y_center width height\n\nFor example:\n\n.. code-block:: text\n\n 0 0.35 0.35 0.14 0.14\n 0 0.55 0.3 0.14 0.14\n 1 0.7 0.15 0.2 0.2\n \nThen you can draw the boxes on an image like this:\n\n.. code-block:: bash\n\n drawyolo image.jpg output.jpg --labels labels.txt --classes class1,class2\n\nTo try it out on the image in the repository:\n\n.. code-block:: bash\n\n drawyolo tests/test-data/terrier.webp tests/test-data/output.jpg --labels tests/test-data/labels.txt --classes eye,ear\n\nThat will create an image like this:\n\n.. image:: https://raw.githubusercontent.com/rbturnbull/drawyolo/main/tests/test-data/output.jpg\n :alt: Output image\n :align: center\n\nTo resize the image, use the ``--width`` and/or ``--height`` options. \nThe aspect ratio will be preserved if you do not set both ``--width`` and ``--height``.\n\nFor example:\n\n.. code-block:: bash\n\n drawyolo tests/test-data/terrier.webp tests/test-data/output-thumbnail.jpg --labels tests/test-data/labels.txt --classes eye,ear --width 240\n\n.. image:: https://raw.githubusercontent.com/rbturnbull/drawyolo/main/tests/test-data/output-thumbnail.jpg\n :alt: Output image thumbnail\n :align: center\n\nThe thickness of the line will be set according to the final size of the image. You can change the thickness with the ``--line-thickness`` option.\n\nDrawing boxes from a YOLO model\n==================================\n\nIf you have a YOLO model with weights, you can draw the boxes on an image like this:\n\n.. code-block:: bash\n\n drawyolo image.jpg output.jpg --weights model.pt\n\nYou can also resize the image as before with the ``--width`` and ``--height`` options.\n\nAdvanced usage\n==================================\n\nFor more options see the help\n\n.. code-block:: bash\n\n drawyolo --help\n\n\n.. end-quickstart\n\n\nCredits\n==================================\n\n.. start-credits\n\nRobert Turnbull (Melbourne Data Analytics Platform) - `https://robturnbull.com <https://robturnbull.com>`_\n\n.. end-credits\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Draws boxes on images from annotations in YOLO format",
"version": "0.1.2",
"project_urls": {
"Documentation": "https://rbturnbull.github.io/drawyolo",
"Homepage": "https://github.com/rbturnbull/drawyolo/",
"Repository": "https://github.com/rbturnbull/drawyolo/"
},
"split_keywords": [
"yolo",
" command-line interface"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "32eb513c58a3a5ea94549b1e7ccadf1706aec1d05f64c02855bcd621f53bdedb",
"md5": "92f030aa7c0ead3e437db464a93dc092",
"sha256": "724d860eb67b2b7fa77944810ca62c2a6defb5cb482308ff7a8afd921a59db90"
},
"downloads": -1,
"filename": "drawyolo-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "92f030aa7c0ead3e437db464a93dc092",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 9513,
"upload_time": "2025-01-17T01:44:16",
"upload_time_iso_8601": "2025-01-17T01:44:16.418773Z",
"url": "https://files.pythonhosted.org/packages/32/eb/513c58a3a5ea94549b1e7ccadf1706aec1d05f64c02855bcd621f53bdedb/drawyolo-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e1efd78f0a408f42c3c9d2aae2a1a31f5c664f74f5a96e01deee76075aad23e7",
"md5": "929f24758863c902d1203eeaa6edfc5e",
"sha256": "d64768235b30cbcaf47ae75bdf5392686f8752c9f59ea2f01a23094f327f9677"
},
"downloads": -1,
"filename": "drawyolo-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "929f24758863c902d1203eeaa6edfc5e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 8410,
"upload_time": "2025-01-17T01:44:18",
"upload_time_iso_8601": "2025-01-17T01:44:18.668643Z",
"url": "https://files.pythonhosted.org/packages/e1/ef/d78f0a408f42c3c9d2aae2a1a31f5c664f74f5a96e01deee76075aad23e7/drawyolo-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 01:44:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rbturnbull",
"github_project": "drawyolo",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "drawyolo"
}