Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
028fbbc
feat: refactor config
vividf Feb 2, 2026
e6956b3
chore: fix property
vividf Feb 2, 2026
2b5e99a
chore: clean code
vividf Feb 2, 2026
e389cea
chore: temp remove centerpoint files
vividf Feb 2, 2026
2afb7cb
chore: clean code
vividf Feb 10, 2026
eb3ffc8
feat: integrate centerpoint to deployment framework
vividf Feb 2, 2026
b895000
chore: centerpoint - clean or {}
vividf Feb 2, 2026
433979a
chore: centerpoint-clean code
vividf Feb 2, 2026
02aad01
chore: temp remove centerpoint files
vividf Feb 2, 2026
15f88f6
chore: add files back
vividf Feb 2, 2026
44e80ac
ci(pre-commit): autofix
pre-commit-ci[bot] Feb 16, 2026
f321332
chore: clean code
vividf Feb 16, 2026
b360e3e
chore: update threshold for centerpoint
vividf Feb 18, 2026
427cb16
chore: clean up code
vividf Feb 18, 2026
03c8291
chore: refactor base config - centerpoint
vividf Mar 5, 2026
49ff62c
chore: clean up code: device spec, remove unused fucntion .etc - cent…
vividf Mar 10, 2026
a752c2e
chore: fix Any
vividf Mar 10, 2026
73ca847
chore: add docstring
vividf Mar 10, 2026
d004bbb
chore: refactor export compenent - centerpoint
vividf Mar 10, 2026
5aeb986
chore: fix more Device spec - centerpoint
vividf Mar 10, 2026
9873050
chore: fix
vividf Mar 10, 2026
cc67613
chore: add more docstring
vividf Mar 10, 2026
a0bd1e9
chore: change file name
vividf Mar 10, 2026
7967aed
chore: remove redundant check
vividf Mar 10, 2026
4e3ef9e
chore: orangize directory
vividf Mar 11, 2026
0849300
chore: rename sample file
vividf Mar 11, 2026
6b2bb05
chore: remove init
vividf Mar 11, 2026
727b1eb
chore: add init back
vividf Mar 11, 2026
327ce53
chore: fix trt verification
vividf Mar 25, 2026
52b8bd2
chore: update deploy config
vividf Mar 25, 2026
a83e4ee
chore: fix more deploy config
vividf Mar 25, 2026
b74aeef
chore: update deploy config
vividf Mar 25, 2026
120e257
chore: for loop for clean code
vividf Mar 25, 2026
12c05e9
chore: remove duplicate code
vividf Mar 25, 2026
a577c7c
chore: clean up sample adapter
vividf Mar 25, 2026
7ebb162
clean code
vividf Mar 26, 2026
6292028
chore: clean up centerpoint
vividf Mar 27, 2026
0fddabf
chore: replace pring to logging
vividf Mar 27, 2026
4b78ff7
chore: remove conplex discover files logic, and directly use components
vividf Mar 29, 2026
ab4fbab
chore: centerpoint add -> None for __init__
vividf Apr 9, 2026
20f84fc
chore: remove task profile centerpoint
vividf Apr 9, 2026
982ce83
chore: fix output format
vividf Apr 9, 2026
be8b1b2
chore: clean gt loop
vividf Apr 10, 2026
eb2b6ef
chore: fix matrix report centerpoint
vividf Apr 10, 2026
5b303a8
chore: refactor metric utils
vividf Apr 10, 2026
90432cb
chore: clean metrics centerpoint
vividf Apr 10, 2026
32a854a
chore: fix sample adapter
vividf Apr 10, 2026
d23c92b
chore: clean up centerpoint pipeline
vividf Apr 10, 2026
75422a4
chore: update project registry centerpoint
vividf Apr 10, 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
2 changes: 1 addition & 1 deletion deployment/projects/centerpoint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Adjust at least:
- `components` — per-subgraph ONNX/engine names, I/O dtypes, dynamic axes, and TensorRT profiles (must match your model grid and voxel limits).
- `runtime_io` — sample `info_file` (relative to model config `data_root`) and `sample_idx`.

Required component keys: `pts_voxel_encoder`, `pts_backbone_neck_head` (validated in `entrypoint.py`).
Required component keys: `pts_voxel_encoder`, `pts_backbone_neck_head` (declared in project adapter metadata and validated by shared project validator).

## Layout

Expand Down
23 changes: 23 additions & 0 deletions deployment/projects/centerpoint/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""CenterPoint deployment bundle.

This package owns all CenterPoint deployment-specific code (runner/evaluator/loader/pipelines/export).
It registers a ProjectAdapter into the global `project_registry` so the unified CLI can invoke it.
"""

from __future__ import annotations

from deployment.projects.centerpoint.cli import add_args
from deployment.projects.centerpoint.entrypoint import run

# Trigger pipeline factory registration for this project.
from deployment.projects.centerpoint.pipelines.factory import CenterPointPipelineFactory # noqa: F401
from deployment.projects.registry import ProjectAdapter, project_registry

project_registry.register(
ProjectAdapter(
name="centerpoint",
add_args=add_args,
run=run,
required_components=("pts_voxel_encoder", "pts_backbone_neck_head"),
)
)
14 changes: 14 additions & 0 deletions deployment/projects/centerpoint/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
"""CenterPoint CLI extensions."""

from __future__ import annotations

import argparse


def add_args(parser: argparse.ArgumentParser) -> None:
"""Register CenterPoint-specific CLI flags onto a project subparser."""
parser.add_argument(
"--rot-y-axis-reference",
action="store_true",
help="Convert rotation to y-axis clockwise reference (CenterPoint ONNX-compatible format)",
)
55 changes: 34 additions & 21 deletions deployment/projects/centerpoint/config/deploy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
CenterPoint Deployment Configuration
"""

# ============================================================================
# Task type for pipeline building
# Options: 'detection2d', 'detection3d', 'classification', 'segmentation'
# ============================================================================
task_type = "detection3d"

# ============================================================================
# Checkpoint Path - Single source of truth for PyTorch model
# ============================================================================
checkpoint_path = "work_dirs/centerpoint/best_checkpoint.pth"

# Log file path (relative paths are under export.work_dir). Set to None to disable file logging.
deploy_log_path = "deployment.log"

# ============================================================================
# Device settings (shared by export, evaluation, verification)
# ============================================================================
Expand All @@ -21,33 +18,37 @@
cuda="cuda:0",
)

# Single literal for deployment output root (used before `export` exists).
_DEPLOY_WORK_DIR = "work_dirs/centerpoint_deployment"
_WORK_DIR = _DEPLOY_WORK_DIR.rstrip("/")
_ONNX_DIR = f"{_WORK_DIR}/onnx"
_TENSORRT_DIR = f"{_WORK_DIR}/tensorrt"

# ============================================================================
# Export Configuration
# mode: "onnx", "trt", "both", "none"
# work_dir: path to the deployment output root
# onnx_path: path to the ONNX output directory (if mode="trt" and ONNX already exists)
# ============================================================================
export = dict(
mode="both",
work_dir="work_dirs/centerpoint_deployment",
onnx_path=None,
work_dir=_DEPLOY_WORK_DIR,
onnx_path=_ONNX_DIR,
)

# Derived artifact directories
_WORK_DIR = str(export["work_dir"]).rstrip("/")
_ONNX_DIR = f"{_WORK_DIR}/onnx"
_TENSORRT_DIR = f"{_WORK_DIR}/tensorrt"

# ============================================================================
# Unified Component Configuration (Single Source of Truth)
#
# Component key is the unique identifier (used for config lookup, filenames, logs).
# Each component defines:
# - name: Component identifier used in export
# - onnx_file: Output ONNX filename
# - engine_file: Output TensorRT engine filename
# - io: Input/output specification for ONNX export
# - tensorrt_profile: TensorRT optimization profile (min/opt/max shapes)
# ============================================================================
components = dict(
voxel_encoder=dict(
name="pts_voxel_encoder",
pts_voxel_encoder=dict(
onnx_file="pts_voxel_encoder.onnx",
engine_file="pts_voxel_encoder.engine",
io=dict(
Expand All @@ -64,14 +65,14 @@
),
tensorrt_profile=dict(
input_features=dict(
# Make sure to match the shape of the input to the model
min_shape=[1000, 32, 11],
opt_shape=[20000, 32, 11],
max_shape=[64000, 32, 11],
max_shape=[96000, 32, 11],
),
),
),
backbone_head=dict(
name="pts_backbone_neck_head",
pts_backbone_neck_head=dict(
onnx_file="pts_backbone_neck_head.onnx",
engine_file="pts_backbone_neck_head.engine",
io=dict(
Expand All @@ -98,6 +99,8 @@
),
tensorrt_profile=dict(
spatial_features=dict(
# Make sure to match the shape of the input to the model
# check grid size in the model config
min_shape=[1, 32, 1020, 1020],
opt_shape=[1, 32, 1020, 1020],
max_shape=[1, 32, 1020, 1020],
Expand All @@ -111,8 +114,8 @@
# ============================================================================
runtime_io = dict(
# This should be a path relative to `data_root` in the model config.
info_file="info/t4dataset_j6gen2_infos_val.pkl",
sample_idx=1,
info_file="info/t4dataset_j6gen2_base_infos_test.pkl",
sample_idx=5,
)

# ============================================================================
Expand All @@ -128,6 +131,7 @@

# ============================================================================
# TensorRT Build Settings (shared across all components)
# Supports `auto`, `fp16`, `fp32_tf32`, and `strongly_typed`
# ============================================================================
tensorrt_config = dict(
precision_policy="auto",
Expand Down Expand Up @@ -161,10 +165,19 @@

# ============================================================================
# Verification Configuration
#
# Tolerance is backend- and machine-dependent:
# - The same scenario can show very different max/mean diffs on different machines: GPU
# architecture, driver, ORT/CUDA/TRT versions, and ORT's CUDA graph partitioning (CPU
# fallback nodes for small ops) all change numerics. ONNX on CPU, ONNX on CUDA, and
# TensorRT on CUDA are not directly comparable to each other as "one true" references.
# - Additionally, the verification configuration should use a precision-aware tolerance,
# especially when FP16 is enabled.
# ============================================================================
verification = dict(
enabled=False,
tolerance=1e-1,
# TODO(vividf): double check the tolerance value
tolerance=1,
num_verify_samples=1,
devices=devices,
scenarios=dict(
Expand Down
70 changes: 70 additions & 0 deletions deployment/projects/centerpoint/entrypoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
"""CenterPoint deployment entrypoint invoked by the unified CLI."""

from __future__ import annotations

import argparse
import logging

from mmengine.config import Config

from deployment.cli.args import add_deployment_file_logging, setup_logging
from deployment.configs.base import BaseDeploymentConfig
from deployment.core.contexts import CenterPointExportContext
from deployment.projects.centerpoint.eval.evaluator import CenterPointEvaluator
from deployment.projects.centerpoint.eval.metrics_utils import extract_t4metric_v2_config
from deployment.projects.centerpoint.io.data_loader import CenterPointDataLoader
from deployment.projects.centerpoint.runner import CenterPointDeploymentRunner
from deployment.projects.registry import project_registry


def run(args: argparse.Namespace) -> int:
"""Run the CenterPoint deployment workflow for the unified CLI.

Args:
args: Parsed command-line arguments containing deploy_cfg and model_cfg paths.

Returns:
Exit code (0 for success).
"""
logger = setup_logging(args.log_level)

deploy_cfg = Config.fromfile(args.deploy_cfg)
model_cfg = Config.fromfile(args.model_cfg)
config = BaseDeploymentConfig(deploy_cfg)

log_file = config.resolved_deploy_log_file
if log_file:
add_deployment_file_logging(log_file)
logger.info("Deployment log file: %s", log_file)

project_registry.validate_required_components("centerpoint", config.components_cfg)

logger.info("=" * 80)
logger.info("CenterPoint Deployment Pipeline")
logger.info("=" * 80)

data_loader = CenterPointDataLoader(
info_file=config.runtime_config.info_file,
model_cfg=model_cfg,
)
logger.info(f"Loaded {data_loader.num_samples} samples")

metrics_config = extract_t4metric_v2_config(model_cfg, logger=logger)

evaluator = CenterPointEvaluator(
model_cfg=model_cfg,
metrics_config=metrics_config,
components_cfg=config.components_cfg,
)

runner = CenterPointDeploymentRunner(
data_loader=data_loader,
evaluator=evaluator,
config=config,
model_cfg=model_cfg,
logger=logger,
)

context = CenterPointExportContext(rot_y_axis_reference=bool(getattr(args, "rot_y_axis_reference", False)))
runner.run(context=context)
return 0
Empty file.
Loading