Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: add heler classes for Tier4 #99

Merged
merged 3 commits into from
Feb 12, 2025
Merged

refactor: add heler classes for Tier4 #99

merged 3 commits into from
Feb 12, 2025

Conversation

ktro2828
Copy link
Collaborator

@ktro2828 ktro2828 commented Feb 12, 2025

What

This PR introduces following helper classes for Tier4:

  • TimeseriesHelper: This class performs aggregating annotation records in future or past.
  • RenderingHelper: This class performs rendering dataset records.

In RenderingHelper, we adopts async technique which allows to render records asynchronously following coroutine.
I compared the processing times for each rendering method between before and after this PR:

# d20b53bf-8b4e-4040-9d2c-6df22120177a
# === Before ===
# Method        Process Time[s]
# ----------  -----------------
# scene                 1.93103
# instance              1.07914
# pointcloud           24.691
# === After ====
# Method        Process Time[s]
# ----------  -----------------
# scene                  2.0949
# instance               1.0695
# pointcloud            24.9125

# 043f584e-dee3-4f29-997f-8a15e87284dd
# === Before ===
# Method        Process Time[s]
# ----------  -----------------
# scene                 5.11885
# instance              4.60405
# pointcloud          159.108

# === After ===
# Method        Process Time[s]
# ----------  -----------------
# scene                 4.91369
# instance              4.51894
# pointcloud          146.685
Script to measure processing times
from __future__ import annotations

import argparse
import time

from tabulate import tabulate

from t4_devkit import Tier4


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("data_root", type=str)
    args = parser.parse_args()

    t4 = Tier4("annotation", args.data_root, verbose=False)

    profile = []

    scene_token = t4.scene[0].token
    scene_start = time.perf_counter()
    t4.render_scene(scene_token, future_seconds=10)
    scene_time = time.perf_counter() - scene_start
    profile.append({"Method": "scene", "Process Time[s]": scene_time})

    instance_token = t4.instance[0].token
    instance_start = time.perf_counter()
    t4.render_instance(instance_token)
    instance_time = time.perf_counter() - instance_start
    profile.append({"Method": "instance", "Process Time[s]": instance_time})

    pointcloud_start = time.perf_counter()
    t4.render_pointcloud(scene_token)
    pointcloud_time = time.perf_counter() - pointcloud_start
    profile.append({"Method": "pointcloud", "Process Time[s]": pointcloud_time})

    print(tabulate(profile, headers="keys"))


if __name__ == "__main__":
    main()

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@github-actions github-actions bot added documentation Improvements or additions to documentation refactor Refactoring code or increasing performance labels Feb 12, 2025
Copy link

☂️ Python Coverage

current status: ❌

Overall Coverage

Lines Covered Coverage Threshold Status
2254 1505 67% 50% 🟢

New Files

File Coverage Status
t4_devkit/helper/init.py 100% 🟢
t4_devkit/helper/rendering.py 13% 🔴
t4_devkit/helper/timeseries.py 23% 🔴
TOTAL 45% 🔴

Modified Files

File Coverage Status
t4_devkit/tier4.py 12% 🔴
TOTAL 12% 🔴

updated for commit: 7bed916 by action🐍

@ktro2828 ktro2828 marked this pull request as ready for review February 12, 2025 15:54
@ktro2828 ktro2828 merged commit f863636 into main Feb 12, 2025
4 of 5 checks passed
@ktro2828 ktro2828 deleted the refactor/helper branch February 12, 2025 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation refactor Refactoring code or increasing performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant