Skip to main content

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,
)

Metadata

Release files for imRender 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 imRender 0.1.3
File Size Uploaded
imrender-0.1.3.tar.gz 11.2 kB Details

Built distribution (wheel)

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

Total release size: 23.3 kB

Release files / imrender-0.1.3.tar.gz

Download URL imrender-0.1.3.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e1f0c4c8e89b98b75839fd01957df72f34ef4092368d95b92474db6e154910f2
BLAKE2b-256 checksum
How to use checksums
fe2539f2fdb434f715b9ebc913d1944fcd5cad7c6c9cde5b7216307ee3d39b97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

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

Download URL imrender-0.1.3-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5258b3faacc39b1016b0b9b8a063758b50eebda4c89da93b21056d4dd097de9
BLAKE2b-256 checksum
How to use checksums
ec44c284087b374d93b5710e2316ff7ccf89efa9938815ee582b66ca8cc1be7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.0

2 release files

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