class_docstr: EfficientDet keras network with train and test step.
code: def _calc_mAP(
      self, pred_boxes, pred_scores, pred_classes, gt_boxes, gt_classes
  ):
      def iou(box1, box2):
          l = max(box1[0], box2[0])
          t = max(box1[1], box2[1])
          r = min(box1[2], box2[2])
          b = min(box1[3], box2[3])
          i = max(0, r - l) * max(0, b - t)
          u = (
              (box1[2] - box1[0]) * (box1[3] - box1[1])
              + (box2[2] - box2[0]) * (box2[3] - box2[1])
              - i
          )
          return i / u
  
      batch_size = pred_boxes.shape[0]
      num_pred_boxes = 0
      num_gt_boxes = 0
      num_true_positives = 0
  
      stats = []
      for batch_idx in range(batch_size):
          pred_num_positives = tf.math.count_nonzero(
              pred_scores[batch_idx, :] > 0.25
          )
          gt_num = tf.math.count_nonzero(gt_classes > -1)
  
          gt_used_idx = []
          num_pred_boxes += pred_num_positives
          num_gt_boxes += gt_num
  
          # for pred_idx, (pred_box, pred_class) in enumerate(zip(pred_boxes, pred_classes)):
          for pred_idx in range(pred_num_positives):
              pred_box = pred_boxes[batch_idx, pred_idx]
              pred_class = pred_classes[batch_idx, pred_idx]
  
              found = False
              # for gt_idx, (gt_box, gt_class) in enumerate(zip(boxes, classes)):
              for gt_idx in range(gt_num):
                  if gt_idx in gt_used_idx:
                      continue
  
                  gt_box = gt_boxes[batch_idx, gt_idx]
                  gt_class = gt_classes[batch_idx, gt_idx]
  
                  if pred_class != gt_class:
                      continue
  
                  if iou(pred_box, gt_box) < 0.5:
                      continue
  
                  found = True
                  num_true_positives += 1
                  break
  
              stats.append((pred_scores[batch_idx, pred_idx], found))
  
      if num_pred_boxes == 0:
          return 0.0
  
      ap = 0.0
      max_prec = num_true_positives / num_pred_boxes
      for _, found in sorted(stats):
          if found:
              ap += max_prec / tf.cast(num_gt_boxes, dtype=tf.float64)
              num_true_positives -= 1
          num_pred_boxes -= 1
          if num_pred_boxes == 0:
              break
          max_prec = tf.math.maximum(
              max_prec, num_true_positives / num_pred_boxes
          )
  
      return ap
  
imports: import functools
  from absl import logging
  import tensorflow
  import hparams_config
  import utils
  from .backbone import efficientnet_builder
  from .utils import postprocess
  from .utils import layers
  from .utils import losses
  import re
label_desc: Use image node_id 6 for calling the EfficientDetNet obj's underlying member method code with example usage: obj._calc_mAP(pred_boxes, pred_scores, pred_classes, gt_boxes, gt_classes) and returns: ap, unknown, int