def loss(self, prediction_dict, true_image_shapes, scope=None):
    'Computes scalar loss tensors with respect to provided groundtruth.\n\n    This function implements the various CenterNet losses.\n\n    Args:\n      prediction_dict: a dictionary holding predicted tensors returned by\n        "predict" function.\n      true_image_shapes: int32 tensor of shape [batch, 3] where each row is of\n        the form [height, width, channels] indicating the shapes of true images\n        in the resized images, as resized images can be padded with zeros.\n      scope: Optional scope name.\n\n    Returns:\n      A dictionary mapping the keys [\n        \'Loss/object_center\',\n        \'Loss/box/scale\',  (optional)\n        \'Loss/box/offset\', (optional)\n        \'Loss/$TASK_NAME/keypoint/heatmap\', (optional)\n        \'Loss/$TASK_NAME/keypoint/offset\', (optional)\n        \'Loss/$TASK_NAME/keypoint/regression\', (optional)\n        \'Loss/segmentation/heatmap\', (optional)\n        \'Loss/densepose/heatmap\', (optional)\n        \'Loss/densepose/regression\', (optional)\n        \'Loss/track/reid\'] (optional)\n        \'Loss/track/offset\'] (optional)\n        scalar tensors corresponding to the losses for different tasks. Note the\n        $TASK_NAME is provided by the KeypointEstimation namedtuple used to\n        differentiate between different keypoint tasks.\n    '
    (_, input_height, input_width, _) = _get_shape(prediction_dict['preprocessed_inputs'], 4)
    (output_height, output_width) = ((input_height // self._stride), (input_width // self._stride))
    output_true_image_shapes = tf.ceil((tf.to_float(true_image_shapes) / self._stride))
    valid_anchor_weights = get_valid_anchor_weights_in_flattened_image(output_true_image_shapes, output_height, output_width)
    valid_anchor_weights = tf.expand_dims(valid_anchor_weights, 2)
    object_center_loss = self._compute_object_center_loss(object_center_predictions=prediction_dict[OBJECT_CENTER], input_height=input_height, input_width=input_width, per_pixel_weights=valid_anchor_weights)
    losses = {OBJECT_CENTER: (self._center_params.object_center_loss_weight * object_center_loss)}
    if (self._od_params is not None):
        od_losses = self._compute_object_detection_losses(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict, per_pixel_weights=valid_anchor_weights)
        for key in od_losses:
            od_losses[key] = (od_losses[key] * self._od_params.task_loss_weight)
        losses.update(od_losses)
    if (self._kp_params_dict is not None):
        for (task_name, params) in self._kp_params_dict.items():
            kp_losses = self._compute_keypoint_estimation_losses(task_name=task_name, input_height=input_height, input_width=input_width, prediction_dict=prediction_dict, per_pixel_weights=valid_anchor_weights)
            for key in kp_losses:
                kp_losses[key] = (kp_losses[key] * params.task_loss_weight)
            losses.update(kp_losses)
    if (self._mask_params is not None):
        seg_losses = self._compute_segmentation_losses(prediction_dict=prediction_dict, per_pixel_weights=valid_anchor_weights)
        for key in seg_losses:
            seg_losses[key] = (seg_losses[key] * self._mask_params.task_loss_weight)
        losses.update(seg_losses)
    if (self._densepose_params is not None):
        densepose_losses = self._compute_densepose_losses(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict)
        for key in densepose_losses:
            densepose_losses[key] = (densepose_losses[key] * self._densepose_params.task_loss_weight)
        losses.update(densepose_losses)
    if (self._track_params is not None):
        track_losses = self._compute_track_losses(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict)
        for key in track_losses:
            track_losses[key] = (track_losses[key] * self._track_params.task_loss_weight)
        losses.update(track_losses)
    if (self._temporal_offset_params is not None):
        offset_losses = self._compute_temporal_offset_loss(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict)
        for key in offset_losses:
            offset_losses[key] = (offset_losses[key] * self._temporal_offset_params.task_loss_weight)
        losses.update(offset_losses)
    return dict([(('%s/%s' % (LOSS_KEY_PREFIX, key)), val) for (key, val) in losses.items()])
Computes scalar loss tensors with respect to provided groundtruth.

This function implements the various CenterNet losses.

Args:
  prediction_dict: a dictionary holding predicted tensors returned by
    "predict" function.
  true_image_shapes: int32 tensor of shape [batch, 3] where each row is of
    the form [height, width, channels] indicating the shapes of true images
    in the resized images, as resized images can be padded with zeros.
  scope: Optional scope name.

Returns:
  A dictionary mapping the keys [
    'Loss/object_center',
    'Loss/box/scale',  (optional)
    'Loss/box/offset', (optional)
    'Loss/$TASK_NAME/keypoint/heatmap', (optional)
    'Loss/$TASK_NAME/keypoint/offset', (optional)
    'Loss/$TASK_NAME/keypoint/regression', (optional)
    'Loss/segmentation/heatmap', (optional)
    'Loss/densepose/heatmap', (optional)
    'Loss/densepose/regression', (optional)
    'Loss/track/reid'] (optional)
    'Loss/track/offset'] (optional)
    scalar tensors corresponding to the losses for different tasks. Note the
    $TASK_NAME is provided by the KeypointEstimation namedtuple used to
    differentiate between different keypoint tasks.
def loss(self, prediction_dict, true_image_shapes, scope=None):
    'Computes scalar loss tensors with respect to provided groundtruth.\n\n    This function implements the various CenterNet losses.\n\n    Args:\n      prediction_dict: a dictionary holding predicted tensors returned by\n        "predict" function.\n      true_image_shapes: int32 tensor of shape [batch, 3] where each row is of\n        the form [height, width, channels] indicating the shapes of true images\n        in the resized images, as resized images can be padded with zeros.\n      scope: Optional scope name.\n\n    Returns:\n      A dictionary mapping the keys [\n        \'Loss/object_center\',\n        \'Loss/box/scale\',  (optional)\n        \'Loss/box/offset\', (optional)\n        \'Loss/$TASK_NAME/keypoint/heatmap\', (optional)\n        \'Loss/$TASK_NAME/keypoint/offset\', (optional)\n        \'Loss/$TASK_NAME/keypoint/regression\', (optional)\n        \'Loss/segmentation/heatmap\', (optional)\n        \'Loss/densepose/heatmap\', (optional)\n        \'Loss/densepose/regression\', (optional)\n        \'Loss/track/reid\'] (optional)\n        \'Loss/track/offset\'] (optional)\n        scalar tensors corresponding to the losses for different tasks. Note the\n        $TASK_NAME is provided by the KeypointEstimation namedtuple used to\n        differentiate between different keypoint tasks.\n    '
    (_, input_height, input_width, _) = _get_shape(prediction_dict['preprocessed_inputs'], 4)
    (output_height, output_width) = ((input_height // self._stride), (input_width // self._stride))
    output_true_image_shapes = tf.ceil((tf.to_float(true_image_shapes) / self._stride))
    valid_anchor_weights = get_valid_anchor_weights_in_flattened_image(output_true_image_shapes, output_height, output_width)
    valid_anchor_weights = tf.expand_dims(valid_anchor_weights, 2)
    object_center_loss = self._compute_object_center_loss(object_center_predictions=prediction_dict[OBJECT_CENTER], input_height=input_height, input_width=input_width, per_pixel_weights=valid_anchor_weights)
    losses = {OBJECT_CENTER: (self._center_params.object_center_loss_weight * object_center_loss)}
    if (self._od_params is not None):
        od_losses = self._compute_object_detection_losses(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict, per_pixel_weights=valid_anchor_weights)
        for key in od_losses:
            od_losses[key] = (od_losses[key] * self._od_params.task_loss_weight)
        losses.update(od_losses)
    if (self._kp_params_dict is not None):
        for (task_name, params) in self._kp_params_dict.items():
            kp_losses = self._compute_keypoint_estimation_losses(task_name=task_name, input_height=input_height, input_width=input_width, prediction_dict=prediction_dict, per_pixel_weights=valid_anchor_weights)
            for key in kp_losses:
                kp_losses[key] = (kp_losses[key] * params.task_loss_weight)
            losses.update(kp_losses)
    if (self._mask_params is not None):
        seg_losses = self._compute_segmentation_losses(prediction_dict=prediction_dict, per_pixel_weights=valid_anchor_weights)
        for key in seg_losses:
            seg_losses[key] = (seg_losses[key] * self._mask_params.task_loss_weight)
        losses.update(seg_losses)
    if (self._densepose_params is not None):
        densepose_losses = self._compute_densepose_losses(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict)
        for key in densepose_losses:
            densepose_losses[key] = (densepose_losses[key] * self._densepose_params.task_loss_weight)
        losses.update(densepose_losses)
    if (self._track_params is not None):
        track_losses = self._compute_track_losses(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict)
        for key in track_losses:
            track_losses[key] = (track_losses[key] * self._track_params.task_loss_weight)
        losses.update(track_losses)
    if (self._temporal_offset_params is not None):
        offset_losses = self._compute_temporal_offset_loss(input_height=input_height, input_width=input_width, prediction_dict=prediction_dict)
        for key in offset_losses:
            offset_losses[key] = (offset_losses[key] * self._temporal_offset_params.task_loss_weight)
        losses.update(offset_losses)
    return dict([(('%s/%s' % (LOSS_KEY_PREFIX, key)), val) for (key, val) in losses.items()])