Skip to main content

pypi badge testing badge coverage badge docs badge black badge

Draws boxes on images from annotations in YOLO format.

Installation

Install using pip:

pip install drawyolo

Or directly from the repository:

pip install git+https://github.com/rbturnbull/drawyolo.git

Drawing boxes from labels

If you have a label file in YOLO format like this:

class_id x_center y_center width height

For example:

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:

drawyolo image.jpg output.jpg --labels labels.txt --classes class1,class2

To try it out on the image in the repository:

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:

Output image

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:

drawyolo tests/test-data/terrier.webp tests/test-data/output-thumbnail.jpg --labels tests/test-data/labels.txt --classes eye,ear --width 240
Output image thumbnail

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:

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

drawyolo --help

Credits

Robert Turnbull (Melbourne Data Analytics Platform) - https://robturnbull.com

Metadata

Release files for drawyolo 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drawyolo 0.1.3
File Size Uploaded Provenance
drawyolo-0.1.3.tar.gz 8.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for drawyolo 0.1.3
File Interpreter ABI Platform
drawyolo-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / drawyolo-0.1.3.tar.gz

Download URL drawyolo-0.1.3.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9e46332cba6b8534059be3f9b58e2af0bd300571ef1ea6781cd448af7d4036b2
BLAKE2b-256 checksum
How to use checksums
00be533337e2dd042018966d6a4b6a0783eeb1459f798e64179369ebe24320e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.1 Darwin/24.4.0

Release files / drawyolo-0.1.3-py3-none-any.whl

Download URL drawyolo-0.1.3-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b84715551373be7dfdb4f4dcc96f7e18841987381ceb81ef3f227ef296b93450
BLAKE2b-256 checksum
How to use checksums
f3aede95816adec792270a9696070b4ddb2b583fd21272312d9359ae3704182a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.1 CPython/3.13.1 Darwin/24.4.0

Security for drawyolo 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page