Skip to main content

.

Project description

imRender

Github: https://github.com/firstelfin/imRender

PYPI: https://pypi.org/project/imRender/

Image Display

  • Draw label annotations in labelme format onto the image.
  • Customize the display of flags attributes.

Quick Start

渲染逻辑是调用时通过just_flags参数控制是否优先使用shape内指定的flags信息渲染, 其次使用类别名查找渲染等级, 两种方式都需要使用flags_key_map转义关键字. 若都没有指定, 则使用默认配置default_report.

Install:

pip install imRender

Usage:

step1: 快速导入并实例化

from imRender import LabelmeChineseRenderer
# 自定义类别渲染
renderer = LabelmeChineseRenderer(
    font_path=Path.home() / ".config/elfin/fonts/Arial.Unicode.ttf",
    verbose=False,
    flags_key_map={
        "person": "critical",  # 指定渲染类别的等级
        "car": "high",
    }
)

# 使用标注实例中的flags自定义的渲染
renderer = LabelmeChineseRenderer(
    font_path=Path.home() / ".config/elfin/fonts/Arial.Unicode.ttf",
    verbose=False,
)

# 自定义默认渲染等级与渲染颜色
renderer = LabelmeChineseRenderer(
    font_path=Path.home() / ".config/elfin/fonts/Arial.Unicode.ttf",
    verbose=False,
    default_report=("critical", (0, 0, 255))  # 红色 - 关键/严重问题
)

step2: 调用渲染接口

# 调用单张图片渲染
renderer.render_image(
    image_path="path/to/image",  # 可以直接传图像数据ndarray
    json_path="path/to/json",    # 可以直接传labelme格式的标注字典
    output_path="path/to/save_image",
    just_flags=True,  # 只使用标注中的flags信息渲染, 未标记的实例不渲染
    show_score=True,  # 渲染时带上置信度
    ind=0,  # 当前图像的序号
)
# 批次调用
renderer.render_batch(
    images_dir=Path("path/to/images"),
    labels_dir=Path("path/to/labels") or None,
    output_dir=Path("render_images/"),
    just_flags=False,  # 未使用flags标记的标签也要渲染
    show_score=True,
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imrender-0.1.3.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imrender-0.1.3-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file imrender-0.1.3.tar.gz.

File metadata

  • Download URL: imrender-0.1.3.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for imrender-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e1f0c4c8e89b98b75839fd01957df72f34ef4092368d95b92474db6e154910f2
MD5 5bd9936a34044e9028c9c4c0bee57cc6
BLAKE2b-256 fe2539f2fdb434f715b9ebc913d1944fcd5cad7c6c9cde5b7216307ee3d39b97

See more details on using hashes here.

File details

Details for the file imrender-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: imrender-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for imrender-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c5258b3faacc39b1016b0b9b8a063758b50eebda4c89da93b21056d4dd097de9
MD5 0334485668a4edc3f72ceff07daf589f
BLAKE2b-256 ec44c284087b374d93b5710e2316ff7ccf89efa9938815ee582b66ca8cc1be7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page