lingvo.tasks.car.tools.create_kitti_crop_dataset module

Creates KITTI Classification dataset out of the KITTI Object detection data.

Produces TFRecords with the following format:

Values:

num_points: Int64 scalar with the number of points in that box.

points: Float list of 3D locations (X, Y, Z) per point.

points_feature: Float list of per-point feature (reflectance scalar).

bbox_3d: Float list of the 7 box coordinates. bboxes_3d[0:3] is the absolute center location in meters. bboxes_3d[3:6] is the bbox dimensions in meters, and bboxes_3d[6] is the rotation in radians.

label: An Int64 scalar with the class label id.

text: A bytelist with the string name of the class.

difficulty: An Int64 scalar with the difficulty level of the object.

occlusion: An Int64 scalar with the occlusion level of the object.

scene_id: An Int64 scalar with the original scene id the object is from.

bbox_id: An Int64 scalar with which number bounding box the object is from.

Note: All scalars are wrapped in a list of len 1.

IMPORTANT: Depending on your model, you may or may not want to enable preprocessors to export for data augmentation. If unsure, do not run with preprocessors as that might add additional data augmentation steps.

To run:

bazel run -c opt

//lingvo/tasks/car/tools:create_kitti_crop_dataset –model_name=car.kitti.PillarsModelV1 –norun_preprocessors –input_file_pattern=/path/to/kitti/train_pattern –output_file_pattern=/path/to/output/gt_objects@100

lingvo.tasks.car.tools.create_kitti_crop_dataset._GetFilteredBoundingBoxData(kitti_data)[source]

Given a single batch element of data, process it for writing.

Parameters

kitti_data – A NestedMap of KITTI input generator returned data with a batch size of 1.

Returns

A NestedMap of all the output data we need to write per bounding box cropped pointclouds.

class lingvo.tasks.car.tools.create_kitti_crop_dataset._ProcessShard(model_name, split, run_preprocessors)[source]

Bases: apache_beam.transforms.core.DoFn

Process a given shard.

_create_graph()[source]
_ToTFExampleProto(filtered_data, bbox_idx)[source]
process(value)[source]

Method to use for processing elements.

This is invoked by DoFnRunner for each element of a input PCollection.

The following parameters can be used as default values on process arguments to indicate that a DoFn accepts the corresponding parameters. For example, a DoFn might accept the element and its timestamp with the following signature:

def process(element=DoFn.ElementParam, timestamp=DoFn.TimestampParam):
  ...

The full set of parameters is:

  • DoFn.ElementParam: element to be processed, should not be mutated.

  • DoFn.SideInputParam: a side input that may be used when processing.

  • DoFn.TimestampParam: timestamp of the input element.

  • DoFn.WindowParam: Window the input element belongs to.

  • DoFn.TimerParam: a userstate.RuntimeTimer object defined by the spec of the parameter.

  • DoFn.StateParam: a userstate.RuntimeState object defined by the spec of the parameter.

  • DoFn.KeyParam: key associated with the element.

  • DoFn.RestrictionParam: an iobase.RestrictionTracker will be provided here to allow treatment as a Splittable DoFn. The restriction tracker will be derived from the restriction provider in the parameter.

  • DoFn.WatermarkEstimatorParam: a function that can be used to track output watermark of Splittable DoFn implementations.

Parameters
  • element – The element to be processed

  • *args – side inputs

  • **kwargs – other keyword arguments.

Returns

An Iterable of output elements or None.

lingvo.tasks.car.tools.create_kitti_crop_dataset.main(_)[source]