Skip to content

Commit a4c9753

Browse files
ktro2828Copilot
andauthored
perf: execute annotation rendering in parallel (#182)
* perf: execute annotation rendering in parallel Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * style(pre-commit): autofix --------- Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 0c8bcda commit a4c9753

1 file changed

Lines changed: 37 additions & 29 deletions

File tree

t4_devkit/helper/rendering.py

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,23 @@ def render_scene(
162162
first_camera_tokens=first_camera_tokens,
163163
max_timestamp_us=max_timestamp_us,
164164
)
165-
)
166-
167-
# TODO(ktro2828): speed up annotation rendering
168-
self._render_annotation3ds(
169-
viewer=viewer,
170-
first_sample_token=scene.first_sample_token,
171-
max_timestamp_us=max_timestamp_us,
172-
future_seconds=future_seconds,
173-
)
174-
self._render_annotation2ds(
175-
viewer=viewer,
176-
first_sample_token=scene.first_sample_token,
177-
max_timestamp_us=max_time_seconds,
165+
+ [
166+
self._executor.submit(
167+
self._render_annotation3ds(
168+
viewer=viewer,
169+
first_sample_token=scene.first_sample_token,
170+
max_timestamp_us=max_timestamp_us,
171+
future_seconds=future_seconds,
172+
)
173+
),
174+
self._executor.submit(
175+
self._render_annotation2ds(
176+
viewer=viewer,
177+
first_sample_token=scene.first_sample_token,
178+
max_timestamp_us=max_timestamp_us,
179+
)
180+
),
181+
]
178182
)
179183

180184
def render_instance(
@@ -261,22 +265,26 @@ def render_instance(
261265
viewer=viewer,
262266
first_camera_tokens=first_camera_tokens,
263267
max_timestamp_us=max_timestamp_us,
264-
),
265-
)
266-
267-
# TODO(ktro2828): speed up annotation rendering
268-
self._render_annotation3ds(
269-
viewer=viewer,
270-
first_sample_token=first_sample.token,
271-
max_timestamp_us=max_timestamp_us,
272-
future_seconds=future_seconds,
273-
instance_tokens=instance_tokens,
274-
)
275-
self._render_annotation2ds(
276-
viewer=viewer,
277-
first_sample_token=first_sample.token,
278-
max_timestamp_us=max_timestamp_us,
279-
instance_tokens=instance_tokens,
268+
)
269+
+ [
270+
self._executor.submit(
271+
self._render_annotation3ds(
272+
viewer=viewer,
273+
first_sample_token=first_sample.token,
274+
max_timestamp_us=max_timestamp_us,
275+
future_seconds=future_seconds,
276+
instance_tokens=instance_tokens,
277+
)
278+
),
279+
self._executor.submit(
280+
self._render_annotation2ds(
281+
viewer=viewer,
282+
first_sample_token=first_sample.token,
283+
max_timestamp_us=max_timestamp_us,
284+
instance_tokens=instance_tokens,
285+
)
286+
),
287+
],
280288
)
281289

282290
def render_pointcloud(

0 commit comments

Comments
 (0)