Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3bae850
feat(autoware_ml): add t4segmetric
amadeuszsz Mar 15, 2026
719a19d
fix(autoware_ml): missing init file
amadeuszsz Mar 15, 2026
ba93aeb
fix(FRNet): remove metric's prefix
amadeuszsz Mar 15, 2026
069646e
style(autoware_ml): cleanup
amadeuszsz Mar 16, 2026
b473c96
style(autoware_ml): imports
amadeuszsz Mar 16, 2026
10a0b3e
feat(autoware_ml): add per-class range-based metrics
amadeuszsz Mar 16, 2026
82c8e26
fix(PTv3): matplotlib agg
amadeuszsz Mar 17, 2026
a1e1152
ci(pre-commit): autofix
pre-commit-ci[bot] Mar 17, 2026
a9af54e
fix(PTv3): matplotlib agg
amadeuszsz Mar 17, 2026
b2d0011
fix(PTv3): unused imports
amadeuszsz Mar 17, 2026
ac2b6b8
fix(autoware_ml): matplotlib agg
amadeuszsz Mar 17, 2026
8901330
feat(PTv3): cache feats
amadeuszsz Mar 17, 2026
4e8ff9b
fix(autoware_ml): cat2label bounds
amadeuszsz Mar 17, 2026
d85f909
fix(autoware_ml): unused import & arg
amadeuszsz Mar 17, 2026
9a2c075
fix(PTv3): reduce distributed seg eval via confusion matrices
amadeuszsz Mar 17, 2026
9c3a877
fix(PTv3): reorder imports due to deployment issue caused by mmcv's i…
amadeuszsz Mar 17, 2026
9cea001
ci(pre-commit): autofix
pre-commit-ci[bot] Mar 17, 2026
9f91701
fix(PTv3): reorder imports due to deployment issue caused by mmcv's i…
amadeuszsz Mar 17, 2026
e45c323
feat(autoware_ml): unify metrics naming convention
amadeuszsz Mar 17, 2026
253248b
fix(segmentation3d): exclude ignore_index from confusion matrix in T4…
amadeuszsz Mar 23, 2026
8ded56d
refactor(segmentation3d): remove unused submission export from T4SegM…
amadeuszsz Mar 23, 2026
732e68e
Merge branch 'main' into feat/t4segmetric-v2
amadeuszsz Mar 23, 2026
a2a8c16
refactor(autoware_ml): dedicated logger hook
amadeuszsz Mar 25, 2026
eedb405
feat(segmentation3d): log warning & use dataclass
amadeuszsz Mar 25, 2026
d6ac2e5
Merge branch 'main' into feat/t4segmetric-v2
amadeuszsz Mar 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions autoware_ml/hooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
PytorchTrainingProfilerHook,
PytorchValidationProfilerHook,
)
from .t4_seg_logger_hook import T4SegLoggerHook
from .t4_seg_tensorboard_hook import T4SegTensorboardHook

__all__ = [
"MomentumInfoHook",
Expand All @@ -14,4 +16,6 @@
"PytorchValidationProfilerHook",
"LossScaleInfoHook",
"LoggerHook",
"T4SegLoggerHook",
"T4SegTensorboardHook",
]
13 changes: 13 additions & 0 deletions autoware_ml/hooks/t4_seg_logger_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from mmengine.registry import HOOKS

from .logger_hook import LoggerHook


@HOOKS.register_module()
class T4SegLoggerHook(LoggerHook):
"""Logger hook for T4 segmentation configs using custom TensorBoard metric tags."""

def after_val_epoch(self, runner, metrics=None) -> None:
"""Log validation results without the default TensorBoard scalar dump."""
_, log_str = runner.log_processor.get_log_after_epoch(runner, len(runner.val_dataloader), "val")
runner.logger.info(log_str)
63 changes: 63 additions & 0 deletions autoware_ml/hooks/t4_seg_tensorboard_hook.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import matplotlib.pyplot as plt
from mmengine.hooks import Hook
from mmengine.registry import HOOKS
from mmengine.visualization import Visualizer

from autoware_ml.segmentation3d.evaluation import (
T4SegMetric,
build_t4_seg_tb_scalars,
figure_to_numpy,
iter_t4_seg_confusion_matrix_figures,
)


@HOOKS.register_module()
class T4SegTensorboardHook(Hook):
"""Log shared T4 segmentation TensorBoard tags for MMEngine runners."""

priority = "LOW"

def after_val_epoch(self, runner, metrics=None):
self._log_stage(runner, stage="val", step=runner.iter)

def after_test_epoch(self, runner, metrics=None):
self._log_stage(runner, stage="test", step=0)

def _log_stage(self, runner, stage: str, step: int) -> None:
metric = self._get_metric(runner, stage)
if metric is None or metric.last_eval_result is None:
return

try:
vis = Visualizer.get_current_instance()
except Exception:
return

class_names = [metric.last_label2cat[i] for i in sorted(metric.last_label2cat)]
scalars = build_t4_seg_tb_scalars(
metrics=metric.last_eval_result.metrics,
class_names=class_names,
stage=stage,
distance_ranges=metric.distance_ranges,
)
if scalars:
vis.add_scalars(scalars, step=step)

for tag, fig in iter_t4_seg_confusion_matrix_figures(metric.last_eval_result, class_names, stage):
try:
vis.add_image(tag, figure_to_numpy(fig), step=step)
except Exception:
pass
finally:
plt.close(fig)

@staticmethod
def _get_metric(runner, stage: str):
loop = runner.val_loop if stage == "val" else runner.test_loop
evaluator = getattr(loop, "evaluator", None)
if evaluator is None:
return None
for metric in getattr(evaluator, "metrics", []):
if isinstance(metric, T4SegMetric):
return metric
return None
45 changes: 45 additions & 0 deletions autoware_ml/segmentation3d/evaluation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright (c) TIER IV, Inc. All rights reserved.
"""Segmentation evaluation: functional helpers + MMEngine metric adapter."""

from .functional.t4_seg_eval import (
SegEvalResult,
compute_bev_distance,
fast_hist,
figure_to_numpy,
get_acc,
get_acc_cls,
normalize_confusion_matrix,
per_class_f1,
per_class_iou,
per_class_precision,
per_class_recall,
plot_confusion_matrix,
range_label,
t4_seg_eval,
t4_seg_eval_from_hists,
update_seg_eval_histograms,
)
from .metrics.t4_seg_metric import T4SegMetric
from .tensorboard import build_t4_seg_tb_scalars, iter_t4_seg_confusion_matrix_figures

__all__ = [
"SegEvalResult",
"T4SegMetric",
"build_t4_seg_tb_scalars",
"compute_bev_distance",
"fast_hist",
"figure_to_numpy",
"get_acc",
"get_acc_cls",
"normalize_confusion_matrix",
"per_class_f1",
"per_class_iou",
"per_class_precision",
"per_class_recall",
"plot_confusion_matrix",
"range_label",
"t4_seg_eval",
"t4_seg_eval_from_hists",
"iter_t4_seg_confusion_matrix_figures",
"update_seg_eval_histograms",
]
34 changes: 34 additions & 0 deletions autoware_ml/segmentation3d/evaluation/functional/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright (c) TIER IV, Inc. All rights reserved.
from .t4_seg_eval import (
SegEvalResult,
compute_bev_distance,
fast_hist,
figure_to_numpy,
get_acc,
get_acc_cls,
normalize_confusion_matrix,
per_class_f1,
per_class_iou,
per_class_precision,
per_class_recall,
plot_confusion_matrix,
range_label,
t4_seg_eval,
)

__all__ = [
"SegEvalResult",
"compute_bev_distance",
"fast_hist",
"figure_to_numpy",
"get_acc",
"get_acc_cls",
"normalize_confusion_matrix",
"per_class_f1",
"per_class_iou",
"per_class_precision",
"per_class_recall",
"plot_confusion_matrix",
"range_label",
"t4_seg_eval",
]
Loading