lingvo.tasks.car.pillars module

PointPillars implementation.

[1] PointPillars. https://arxiv.org/abs/1812.05784

lingvo.tasks.car.pillars.SparseToDense(grid_shape, locations, feats)[source]

Converts a sparse representation back to the dense grid.

Parameters
  • grid_shape – (nx, ny, nz). The shape of the grid.

  • locations – [b, p, 3]. Locations of the pillars.

  • feats – [b, p, fdims]. Extracted features for pillars.

Returns

grid_feats of shape [b, nx, ny, nz * fdims].

class lingvo.tasks.car.pillars.PointsToGridFeaturizer(*args, **kwargs)[source]

Bases: lingvo.core.base_layer.BaseLayer

Layer for processing points to grid outputs.

classmethod Params(num_laser_features, num_output_features=64)[source]

Returns the layer params.

FProp(theta, input_batch)[source]

Compute features for the pillars and convert them back to a dense grid.

Parameters
  • theta – A NestedMap object containing variable values of this task.

  • input_batch

    A NestedMap object containing input tensors. Following keys are required:

    • grid_num_points: Integer tensor with shape [batch size, nx, ny, nz], where nx, ny, nz corresponds to the grid sizes (i.e., number of voxels in each axis dimension).

    • pillar_points: Float tensor with shape [batch size, num_pillars, num_points_per_pillar, 3 + num_laser_features]

    • pillar_centers: Float tensor with shape [batch size, num_pillars, num_points_per_pillar, 3]

    • pillar_locations: Float tensor with shape [batch size, num_pillars, 3]

Returns

The dense features with shape [b, nx, ny, nz * fdims].

class lingvo.tasks.car.pillars.Builder[source]

Bases: lingvo.tasks.car.builder_lib.ModelBuilderBase

Builder for the Pillars model.

Featurizer(name, dims)[source]
_Deconv(name, filter_shape, stride)[source]
_Block(name, stride, repeats, idims, odims)[source]

[1]. Sec 2.2.

_TopDown(name, strides=(2, 2, 2), channel_multiplier=1)[source]

[1]. Sec 2.2.

_Upsample(name, stride, idims, odims)[source]

[1]. Sec 2.2.

Contract(down_strides=(2, 2, 2), channel_multiplier=1)[source]

Contracting part of [1] Sec 2.2.

Expand(odims, channel_multiplier=1)[source]

Expanding part of [1] Sec 2.2.

Backbone(odims, down_strides=(2, 2, 2), channel_multiplier=1)[source]

[1]. Sec 2.2.

Detector(name, idims, odims, conv_init_method=None, bias_params_init=None)[source]
class lingvo.tasks.car.pillars.LossNormType(value)[source]

Bases: enum.Enum

An enumeration.

NO_NORM = 0
NORM_BY_NUM_POSITIVES = 1
class lingvo.tasks.car.pillars.ModelV1(*args, **kwargs)[source]

Bases: lingvo.tasks.car.point_detector.PointDetectorBase

PointPillars model.

Base class implements common Decoder functions, though they can be overridden if desired.

NUM_OUTPUT_CHANNELS = 128
classmethod Params(grid_size_z=1, num_anchors=2, num_classes=1, num_laser_features=1)[source]

Returns the layer params.

ComputePredictions(theta, input_batch)[source]

Computes predictions for input_batch.

Parameters
  • theta – A NestedMap object containing variable values of this task.

  • input_batch – A NestedMap object containing input tensors to this tower.

Returns

A NestedMap contains

logits - [b, nx, ny, nz, na, 7 + num_classes]

_ComputeClassificationLoss(predictions, input_batch, class_weights)[source]

Compute classification loss for the given predictions.

Parameters
  • predictions – The output of ComputePredictions, contains: logits - [b, nx, ny, nz, na, 7 + num_classes]. na is the number of anchor boxes per cell. […, :7] are (dx, dy, dz, dw, dl, dh, dt).

  • input_batch – The input batch from which we accesses the groundtruth.

  • class_weights – Per-class weights to use in loss computation.

Returns

Classification loss.

ComputeLoss(theta, predictions, input_batch)[source]

Computes loss and other metrics for the given predictions.

Parameters
  • theta – A NestedMap object containing variable values of this task.

  • predictions – The output of ComputePredictions, contains: logits - [b, nx, ny, nz, na, 7 + num_classes]. na is the number of anchor boxes per cell. […, :7] are (dx, dy, dz, dw, dl, dh, dt).

  • input_batch – The input batch from which we accesses the groundtruth.

Returns

Two dicts defined as BaseTask.ComputeLoss.

_BBoxesAndLogits(input_batch, predictions)[source]

Decode an input batch, computing predicted bboxes from residuals.