code: def create_detection_losses(
      cls_score,
      label_targets,
      bbox_pred,
      rois,
      bbox_targets,
      bbox_inside_weights,
      cfg,
  ):
      # The losses are normalized by the batch size
      # classification loss
      p_cls_score = placeholder()
      p_label_targets = placeholder()
      cls_loss = cross_entropy_with_softmax(
          p_cls_score, p_label_targets, axis=1
      )
      cls_normalization_factor = 1.0 / cfg.NUM_ROI_PROPOSALS
      normalized_cls_loss = (
          reduce_sum(cls_loss) * cls_normalization_factor
      )
  
      reduced_cls_loss = cntk.as_block(
          normalized_cls_loss,
          [(p_cls_score, cls_score), (p_label_targets, label_targets)],
          "CrossEntropyWithSoftmax",
          "norm_cls_loss",
      )
  
      # regression loss
      p_bbox_pred = placeholder()
      p_bbox_targets = placeholder()
      p_bbox_inside_weights = placeholder()
      bbox_loss = SmoothL1Loss(
          cfg.SIGMA_DET_L1,
          p_bbox_pred,
          p_bbox_targets,
          p_bbox_inside_weights,
          1.0,
      )
      bbox_normalization_factor = 1.0 / cfg.NUM_ROI_PROPOSALS
      normalized_bbox_loss = (
          reduce_sum(bbox_loss) * bbox_normalization_factor
      )
  
      reduced_bbox_loss = cntk.as_block(
          normalized_bbox_loss,
          [
              (p_bbox_pred, bbox_pred),
              (p_bbox_targets, bbox_targets),
              (p_bbox_inside_weights, bbox_inside_weights),
          ],
          "SmoothL1Loss",
          "norm_bbox_loss",
      )
  
      detection_losses = plus(
          reduced_cls_loss, reduced_bbox_loss, name="detection_losses"
      )
  
      return detection_losses
  
imports: from __future__ import print_function
  import numpy
  import os, sys
  import argparse
  import easydict
  import cntk
  from cntk import Trainer, load_model, Axis, input_variable, parameter, times, combine, softmax, roipooling, plus, element_times, CloneMethod, alias, Communicator, reduce_sum
  from cntk.core import Value
  from cntk.initializer import normal
  from cntk.layers import placeholder, Constant, Sequential
  from cntk.learners import momentum_sgd, learning_parameter_schedule_per_sample, momentum_schedule
  from cntk.logging import log_number_of_parameters, ProgressPrinter
  from cntk.logging.graph import find_by_name, plot
  from cntk.losses import cross_entropy_with_softmax
  from cntk.metrics import classification_error
  from _cntk_py import force_deterministic_algorithms
  from utils.rpn.cntk_smoothL1_loss import SmoothL1Loss
  from utils.annotations.annotations_helper import parse_class_map_file
  from utils.od_mb_source import ObjectDetectionMinibatchSource
  from utils.proposal_helpers import ProposalProvider
label_desc: Use image node_id 7 for calling a global function with example usage: create_detection_losses(cls_score, label_targets, bbox_pred, rois, bbox_targets, bbox_inside_weights, cfg) and returns: detection_losses