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

feat(t4 devkit): add support of saving rendering result as .rrd #146

Merged
merged 5 commits into from
Aug 29, 2024

Conversation

ktro2828
Copy link
Contributor

@ktro2828 ktro2828 commented Aug 13, 2024

Description

After this PR, users can save rendering result as follows:

from t4_devkit import Tier4

t4 = Tier4("annotation", "<DATASET_PATH>")

# Rendering scene 
scene_token = t4.scene[0].token
t4.render_scene(scene_token, save_dir="<DIR_TO_SAVE>")
# -> Rendering result will be saved to `save_dir/<AppID>.rrd`

Also, we can suspend to spawn a viewer by specifying show=False as below:

t4.render_scene(scene_token, save_dir="<DIR_TO_SAVE>", show=False)

Note that, both save_dir and show are keyword-only arguments.

How to review

Check whether each rendering method works including render_scene(...)/render_instance(...)/render_point_cloud(...).

How to test

test data

TIER IV INTERNAL LINK

test command

from t4_devkit import Tier4

t4 = Tier4("annotation", "<DATASET_PATH>")

# Rendering scene 
scene_token = t4.scene[0].token
t4.render_scene(scene_token, save_dir="<DIR_TO_SAVE>")
# -> Rendering result will be saved to `save_dir/<AppID>.rrd`

# Other rendering methods
# ...

Reference

Notes for reviewer

This PR fixes rerun=0.17.0 because some breaking changes are contained in the release of v0.18.0: https://github.com/rerun-io/rerun/releases/tag/0.18.0.

Edited on Aug 20
Please update your dependency first as follows:

poetry update t4-devkit

@ktro2828 ktro2828 changed the title feat(t4 devkit): add support of saving rendering as .rrd feat(t4 devkit): add support of saving rendering result as .rrd Aug 13, 2024
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
…t exist

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@ktro2828 ktro2828 force-pushed the feat/t4-devkit/save-rrd branch from 847bd6c to 51d9c9a Compare August 19, 2024 07:13
@ktro2828 ktro2828 marked this pull request as ready for review August 19, 2024 07:13
@ktro2828 ktro2828 requested a review from kminoda August 19, 2024 07:13
@kminoda
Copy link
Collaborator

kminoda commented Aug 20, 2024

@ktro2828
I got this error when running

from t4_devkit import Tier4
path = "/home/minoda/ghq/github.com/tier4/autoware-ml/data/t4dataset/database_v1_3/2ea987cf-2900-4ea6-a6e5-d71290b13601/0/"
t4 = Tier4("annotation", path)
scene_token = t4.scene[0].token
t4.render_scene(scene_token, "/home/minoda/Downloads/hogehoge")

Which is

======
Loading T4 tables in `annotation`...
Reverse indexing...
Done reverse indexing in 0.002 seconds.
======
9 attribute
7 calibrated_sensor
6 category
1373 ego_pose
42 instance
1 log
1 map
20 sample
598 sample_annotation
1337 sample_data
4 visibility
7 sensor
1 scene
0 object_ann
0 surface_ann
0 keypoint
Done loading in 0.023 seconds.
======
[2024-08-20T06:01:48Z INFO  re_sdk::spawn] A process is already listening at this address. Assuming it's a Rerun Viewer. addr=0.0.0.0:9876
[2024-08-20T06:01:48Z INFO  re_sdk_comms::server] New SDK client connected: 127.0.0.1:50900
[2024-08-20T06:01:48Z INFO  re_sdk_comms::server] New SDK client connected: 127.0.0.1:50908
Traceback (most recent call last):
  File "/home/minoda/ghq/github.com/tier4/tier4_perception_dataset/tmp.py", line 10, in <module>
    t4.render_scene(scene_token, "/home/minoda/Downloads/hogehoge")
  File "/home/minoda/.local/lib/python3.10/site-packages/t4_devkit/tier4.py", line 688, in render_scene
    max_timestamp_us = first_lidar_sd_record.timestamp + sec2us(max_time_seconds)
  File "/home/minoda/.local/lib/python3.10/site-packages/t4_devkit/common/timestamp.py", line 29, in sec2us
    return 1e6 * timestamp
TypeError: can't multiply sequence by non-int of type 'float'

Still haven't investigated in depth, but did you encounter a similar issue?

@ktro2828
Copy link
Contributor Author

ktro2828 commented Aug 20, 2024

@ktro2828 I got this error when running

from t4_devkit import Tier4
path = "/home/minoda/ghq/github.com/tier4/autoware-ml/data/t4dataset/database_v1_3/2ea987cf-2900-4ea6-a6e5-d71290b13601/0/"
t4 = Tier4("annotation", path)
scene_token = t4.scene[0].token
t4.render_scene(scene_token, "/home/minoda/Downloads/hogehoge")

Which is

======
Loading T4 tables in `annotation`...
Reverse indexing...
Done reverse indexing in 0.002 seconds.
======
9 attribute
7 calibrated_sensor
6 category
1373 ego_pose
42 instance
1 log
1 map
20 sample
598 sample_annotation
1337 sample_data
4 visibility
7 sensor
1 scene
0 object_ann
0 surface_ann
0 keypoint
Done loading in 0.023 seconds.
======
[2024-08-20T06:01:48Z INFO  re_sdk::spawn] A process is already listening at this address. Assuming it's a Rerun Viewer. addr=0.0.0.0:9876
[2024-08-20T06:01:48Z INFO  re_sdk_comms::server] New SDK client connected: 127.0.0.1:50900
[2024-08-20T06:01:48Z INFO  re_sdk_comms::server] New SDK client connected: 127.0.0.1:50908
Traceback (most recent call last):
  File "/home/minoda/ghq/github.com/tier4/tier4_perception_dataset/tmp.py", line 10, in <module>
    t4.render_scene(scene_token, "/home/minoda/Downloads/hogehoge")
  File "/home/minoda/.local/lib/python3.10/site-packages/t4_devkit/tier4.py", line 688, in render_scene
    max_timestamp_us = first_lidar_sd_record.timestamp + sec2us(max_time_seconds)
  File "/home/minoda/.local/lib/python3.10/site-packages/t4_devkit/common/timestamp.py", line 29, in sec2us
    return 1e6 * timestamp
TypeError: can't multiply sequence by non-int of type 'float'

Still haven't investigated in depth, but did you encounter a similar issue?

@kminoda It seems to be caused by wrong usage of the method. render_scene expects following parameters:

def render_scene(
        self,
        scene_token: str,
        *,
        max_time_seconds: float = np.inf,
        save_dir: str | None = None,
        show: bool = True,
    ) -> None:

Then, you are specifying max_time_seconds="/home/minoda/Downloads/hogehoge".

However, from this PR, parameters below max_time_seconds... were key word-only arguments.

I'm sorry I've not noted that you need to update dependency first with poetry.
Could you try to run poetry update t4-devkit first?

After that, please try out:

...
t4.render_scene(<scene_token>, save_dir=<your_save_dir>)

@ktro2828 ktro2828 requested a review from Shin-kyoto August 26, 2024 02:06
Copy link
Collaborator

@kminoda kminoda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (sorry for not being able to review this for a while 🙏 )

@ktro2828 ktro2828 enabled auto-merge (squash) August 29, 2024 02:05
@ktro2828 ktro2828 merged commit ac556fd into main Aug 29, 2024
5 checks passed
@ktro2828 ktro2828 deleted the feat/t4-devkit/save-rrd branch August 29, 2024 02:13
nanoshimarobot pushed a commit to nanoshimarobot/tier4_perception_dataset that referenced this pull request Nov 24, 2024
…er4#146)

* fix: entity path of radar points

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>

* feat: add support of saving recording result

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>

* chore: fix rerun version to `0.17.0`

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>

* feat: update to make directory if the corresponding directory does not exist

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>

---------

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants