lingvo.tasks.car.point_detector module

Base models for point-cloud based detection.

class lingvo.tasks.car.point_detector.PointDetectorBase(*args, **kwargs)[source]

Bases: lingvo.core.base_model.BaseTask

Base class for implementing point-based detectors.

Subclasses should implement _BBoxesAndLogits() to compute the bounding box and scores given an input batch, and specify an appropriate decoder implementation.

classmethod Params(num_classes)[source]

Returns the layer params.

CreateDecoderMetrics()[source]

Create decoder metrics.

_BBoxesAndLogits(input_batch, predictions)[source]

Fetch and return the bounding boxes and logits from an input.

Parameters
  • input_batch – The input batch from which to produce boxes and logits.

  • predictions – The output dictionary of ComputePredictions.

Returns

A .NestedMap containing

  • predicted_bboxes: A [batch_size, num_boxes, 7] floating point Tensor.

  • classification_logits: A [batch_size, num_boxes, num_classes] floating point Tensor.

_Placeholders()[source]

Return a NestedMap of placeholders to fill in for inference.

Runs the configured input pipeline to generate the expected shapes and types of the inputs.

Returns

A NestedMap of placeholders matching the input structure of

the inference model.

_BBoxDimensionErrors(gt_bboxes, pred_bboxes, regression_weights, epsilon=1e-06)[source]

Calculates the errors per bounding box dimension for assigned anchors.

Parameters
  • gt_bboxes – float Tensor of shape […, 7] with the ground truth bounding box for each anchor.

  • pred_bboxes – float Tensor of shape […, 7] with the predicted bounding box for each anchor.

  • regression_weights – float Tensor with 0/1 weights indicating whether the anchor had a positive assignment with same base shape as gt_bboxes and pred_bboxes excluding the last dimension.

  • epsilon – A float epsilon for the denominiator of our MaskedAverage.

Returns

A metrics dict with mean bounding box errors for all positive assigned anchor locations.

Inference()[source]

Builds the inference graph.

Default subgraph should return:

predicted_bboxes: A [batch_size, num_boxes, 7] float Tensor.

classification_scores: A [batch_size, num_boxes, num_classes] float Tensor.

Returns

A dictionary whose values are a tuple of fetches and feeds.

Decode(input_batch)[source]

Decode an input batch, computing predicted bboxes from residuals.

PostProcessDecodeOut(dec_out_dict, dec_metrics_dict)[source]

Post-processes decoder out and updates contents of decode_metrics_dict.

Parameters
  • decode_out_dict – A dictionary of Tensors fetched.

  • decode_metrics_dict – A dict mapping from string key to BaseMetric object as created by CreateDecoderMetrics.

Returns

output_key_value_pairs - a list of (key, value) pairs that can be saved (i.e. of type str, bytes, or unicode).

DecodeFinalize(decode_finalize_args)[source]

Finalize any work for decoding.

Parameters

decode_finalize_args – A DecodeFinalizeArgs namedtuple.