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.2.tar.gz (11.0 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.2-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: imrender-0.1.2.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for imrender-0.1.2.tar.gz
Algorithm Hash digest
SHA256 747eae1bfcbc346ed23ace2e08e62959755df916b788219540b87ab1b9471d10
MD5 207151dd19dda00c7de739b69f219395
BLAKE2b-256 a6d427f1030c688c1a34809fd0e18e4957af393311ccef0f6d3c0ca1fb03ad69

See more details on using hashes here.

File details

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

File metadata

  • Download URL: imrender-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for imrender-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a9301efe58749b233b143391851f5970003f9a0b6da82772b39530d6bbeb68d
MD5 af1772e67d94a3409661f9d284726efc
BLAKE2b-256 42d14237ca0f7171e93168842bc972a1c6af4168717081dbc5f9b36650836cf1

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