ObjectDetection3DTracer Class
Keyword mmdet3d_mode (deprecated since v0.5.0)
On v0.4.x, pass mmdet3d_mode=True when the model runs on MMDetection3D (it can be
omitted when the model is declared with a ModelSpec). Since v0.5.0 the keyword is
not needed — passing it still works, with a deprecation warning. It is consumed when
the model's preset is resolved, so it does not appear in the __init__ signature
below. ObjectDetection3DLogger / ObjectDetection3DDataFilter behave the same way.
ml_debugger.training.object_detection_3d.object_detection_3d_torchtracer.ObjectDetection3DTrainingTorchTracer
Bases: BaseTrainingTracer, ObjectDetection3DTorchTracer
Base BaseTrainingTracer for 3D object detection tasks using PyTorch models.
Subclasses must implement the following abstract methods
- detect(model): Static method to check if this subclass handles the model.
- _get_n_class(model): Extract number of classes from the model.
- _register_model_hooks(model): Register forward hooks for logit capture.
- _parse_model_output(model_output): Convert model output to a standardized Detection3DOutput.
Optionally override
- _apply_nms_config(model, nms_config): Apply NMS parameters to the model.
__init__(model, model_name, version_name, target_layers=None, additional_fields=None, additional_label_fields=None, auto_sync=False, force_table_recreate=False, api_endpoint=None, api_key=None, n_class=None, score_thresh=None, iou_thresh=None, max_detections_per_image=None, pc_range=None, ground_truth_provider=None, max_detections_per_frame=None)
Initialize 3D object detection training tracer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Module
|
PyTorch model to trace. |
required |
|
str
|
Name of the ML model. |
required |
|
str
|
Version identifier for the ML model. |
required |
|
Optional[Dict[str, str]]
|
Mapping of layer aliases to module paths. |
None
|
|
Optional[List[dict]]
|
Extra fields for database schema. |
None
|
|
Optional[List[dict]]
|
Extra fields for groundtruth database schema. |
None
|
|
bool
|
Enable background syncing of logged data. |
False
|
|
bool
|
Whether to drop and recreate existing tables. |
False
|
|
Optional[str]
|
URL of the service API for data upload. |
None
|
|
Optional[str]
|
API key for authenticating with the service. |
None
|
|
Optional[int]
|
Number of classes. Auto-detected from model if None. |
None
|
|
Optional[float]
|
Minimum score threshold for detections. None to infer from the model's test_cfg. |
None
|
|
Optional[float]
|
BEV IoU threshold for NMS. None to infer from the model's test_cfg. |
None
|
|
Optional[int]
|
Maximum detections per frame after NMS. None to infer from the model's test_cfg. |
None
|
|
Optional[int]
|
The name earlier releases and existing scripts use
for |
None
|
|
Optional[List[float]]
|
Deprecated. Point cloud range [x_min, y_min, z_min, x_max, y_max, z_max]
recorded beside the ground truth. Declare it in the ModelSpec instead
( |
None
|
|
Optional[Any]
|
Optional provider implementing
|
None
|
__call__(model_input, ground_truth, input_ids, dataset_type='train', n_epoch=None, **kwargs)
Invoke the tracer on a single inference, recording I/O data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Any
|
Input data for the model. Can be a torch.Tensor (point cloud) or a dict (MMDetection3D format with points, img, img_metas). |
required |
|
Optional[Any]
|
Ground truth 3D bounding boxes and labels.
If omitted, |
required |
|
List[str]
|
Identifiers of each input data. |
required |
|
str
|
Identifier of input dataset. |
'train'
|
|
Optional[int]
|
Number identifier of training iteration. |
None
|
|
Any
|
Additional keyword arguments passed to _parse_and_save_io_data. |
{}
|
Returns:
| Type | Description |
|---|---|
Any
|
The raw output produced by the model. |
get_hooked_features(layer_name)
Retrieve the captured output for a given layer alias.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Alias of the layer whose activation was captured. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Any |
Any
|
Activation data stored for the specified layer. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If no activation has been captured for |
export(output_path=None, n_epoch=None)
Export extracted features and ground truth data into a ZIP archive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[str]
|
Path or directory for saving the ZIP file. If no .zip extension, the default filename is appended. Defaults to cwd. |
None
|
|
Optional[int]
|
Target epoch number. If None, exports all epochs. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[Path]
|
Path to the created ZIP file, or None on non-primary distributed ranks. A |
Optional[Path]
|
model with named outputs returns one path per output name instead. |
wait_for_save(n_epoch=None, interval=3, *, force=False, mode='merge')
Flush pending writes and upload extracted features and ground truth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[int]
|
Target epoch to upload. If |
None
|
|
int
|
Retained for backward compatibility; unused now that the background-sync path is disabled. |
3
|
|
bool
|
Upload even when nothing has been marked unsaved since the last upload. |
False
|
|
str
|
How the server merges this upload into previously uploaded data
for the same
The mode is honored by API server >= 0.4.2; older servers ignore it
and behave as |
'merge'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
upload(n_epoch=None, *, force=False, mode='merge')
Flush pending writes and upload extracted features and ground truth.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[int]
|
Target epoch to upload. If |
None
|
|
bool
|
Upload even when nothing has been marked unsaved since the last upload. |
False
|
|
str
|
How the server merges this upload into previously uploaded data
for the same
The mode is honored by API server >= 0.4.2; older servers ignore it
and behave as |
'merge'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
get_statistics()
Count what this instance has recorded locally, without returning any of it.
This is the supported way to confirm what was recorded: how many rows, how many distinct inputs and how many ground-truth rows each recorded group holds. It returns counts only, never recorded values. Writes still pending are completed first, so the counts include everything recorded so far. In a distributed run, each process counts the records it wrote itself.
Returns:
| Type | Description |
|---|---|
Any
|
A list with one entry per |
Any
|
local records, each of the form ``{"dataset_type": str, "n_epoch": |
Any
|
Optional[int], "rows": int, "inputs": int, "ground_truth_rows": int}`` -- |
Any
|
|
Any
|
distinct input ids, and |
Any
|
recorded. A model with named outputs returns |
drop_epoch_data(n_epoch)
Delete the locally recorded rows of one epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Optional[int]
|
The epoch whose rows are deleted. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, int]
|
Dict[str, int]: Number of deleted rows in the form
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If |
drop_version_data()
Drop all tables for the current (model, version) and recreate them empty.
Provides the same behavior as the existing force_table_recreate=True
path as an explicit method. Internally it re-invokes
__initialize_session(force_table_recreate=True) and starts a fresh
repository / async batch writer.
Note
Before re-init, fully stop async_batch_writer with flush() +
stop(), then re-initialize the session. Skipping this leaves a
daemon thread holding onto the old session.