def _compute_temporal_offset_loss(self, input_height, input_width, prediction_dict):
    'Computes the temporal offset loss for tracking.\n\n    Args:\n      input_height: An integer scalar tensor representing input image height.\n      input_width: An integer scalar tensor representing input image width.\n      prediction_dict: The dictionary returned from the predict() method.\n\n    Returns:\n      A dictionary with track/temporal_offset losses.\n    '
    gt_boxes_list = self.groundtruth_lists(fields.BoxListFields.boxes)
    gt_offsets_list = self.groundtruth_lists(fields.BoxListFields.temporal_offsets)
    gt_match_list = self.groundtruth_lists(fields.BoxListFields.track_match_flags)
    gt_weights_list = self.groundtruth_lists(fields.BoxListFields.weights)
    num_boxes = tf.cast(get_num_instances_from_weights(gt_weights_list), tf.float32)
    offset_predictions = prediction_dict[TEMPORAL_OFFSET]
    num_predictions = float(len(offset_predictions))
    assigner = self._target_assigner_dict[TEMPORALOFFSET_TASK]
    (batch_indices, batch_offset_targets, batch_weights) = assigner.assign_temporal_offset_targets(height=input_height, width=input_width, gt_boxes_list=gt_boxes_list, gt_offsets_list=gt_offsets_list, gt_match_list=gt_match_list, gt_weights_list=gt_weights_list)
    batch_weights = tf.expand_dims(batch_weights, (- 1))
    offset_loss_fn = self._temporal_offset_params.localization_loss
    loss_dict = {}
    offset_loss = 0
    for offset_pred in offset_predictions:
        offset_pred = cn_assigner.get_batch_predictions_from_indices(offset_pred, batch_indices)
        offset_loss += offset_loss_fn(offset_pred[:, None], batch_offset_targets[:, None], weights=batch_weights)
    offset_loss = (tf.reduce_sum(offset_loss) / (num_predictions * num_boxes))
    loss_dict[TEMPORAL_OFFSET] = offset_loss
    return loss_dict
Computes the temporal offset loss for tracking.

Args:
  input_height: An integer scalar tensor representing input image height.
  input_width: An integer scalar tensor representing input image width.
  prediction_dict: The dictionary returned from the predict() method.

Returns:
  A dictionary with track/temporal_offset losses.
def _compute_temporal_offset_loss(self, input_height, input_width, prediction_dict):
    'Computes the temporal offset loss for tracking.\n\n    Args:\n      input_height: An integer scalar tensor representing input image height.\n      input_width: An integer scalar tensor representing input image width.\n      prediction_dict: The dictionary returned from the predict() method.\n\n    Returns:\n      A dictionary with track/temporal_offset losses.\n    '
    gt_boxes_list = self.groundtruth_lists(fields.BoxListFields.boxes)
    gt_offsets_list = self.groundtruth_lists(fields.BoxListFields.temporal_offsets)
    gt_match_list = self.groundtruth_lists(fields.BoxListFields.track_match_flags)
    gt_weights_list = self.groundtruth_lists(fields.BoxListFields.weights)
    num_boxes = tf.cast(get_num_instances_from_weights(gt_weights_list), tf.float32)
    offset_predictions = prediction_dict[TEMPORAL_OFFSET]
    num_predictions = float(len(offset_predictions))
    assigner = self._target_assigner_dict[TEMPORALOFFSET_TASK]
    (batch_indices, batch_offset_targets, batch_weights) = assigner.assign_temporal_offset_targets(height=input_height, width=input_width, gt_boxes_list=gt_boxes_list, gt_offsets_list=gt_offsets_list, gt_match_list=gt_match_list, gt_weights_list=gt_weights_list)
    batch_weights = tf.expand_dims(batch_weights, (- 1))
    offset_loss_fn = self._temporal_offset_params.localization_loss
    loss_dict = {}
    offset_loss = 0
    for offset_pred in offset_predictions:
        offset_pred = cn_assigner.get_batch_predictions_from_indices(offset_pred, batch_indices)
        offset_loss += offset_loss_fn(offset_pred[:, None], batch_offset_targets[:, None], weights=batch_weights)
    offset_loss = (tf.reduce_sum(offset_loss) / (num_predictions * num_boxes))
    loss_dict[TEMPORAL_OFFSET] = offset_loss
    return loss_dict