class_docstr: Evaluation callback for arbitrary datasets.
      
class_docstr_tok: ["Evaluation","callback","for","arbitrary","datasets","."]
code: def on_epoch_end(self, epoch, logs=None):
      logs = logs or {}
  
      # run evaluation
      average_precisions, _ = evaluate(
          self.generator,
          self.model,
          iou_threshold=self.iou_threshold,
          score_threshold=self.score_threshold,
          max_detections=self.max_detections,
          save_path=self.save_path,
      )
  
      # compute per class average precision
      total_instances = []
      precisions = []
      for label, (
          average_precision,
          num_annotations,
      ) in average_precisions.items():
          if self.verbose == 1:
              print(
                  "{:.0f} instances of class".format(num_annotations),
                  self.generator.label_to_name(label),
                  "with average precision: {:.4f}".format(
                      average_precision
                  ),
              )
          total_instances.append(num_annotations)
          precisions.append(average_precision)
      if self.weighted_average:
          self.mean_ap = sum(
              [a * b for a, b in zip(total_instances, precisions)]
          ) / sum(total_instances)
      else:
          self.mean_ap = sum(precisions) / sum(
              x > 0 for x in total_instances
          )
  
      if self.tensorboard:
          import tensorflow as tf
  
          writer = tf.summary.create_file_writer(
              self.tensorboard.log_dir
          )
          with writer.as_default():
              tf.summary.scalar("mAP", self.mean_ap, step=epoch)
              if self.verbose == 1:
                  for label, (
                      average_precision,
                      num_annotations,
                  ) in average_precisions.items():
                      tf.summary.scalar(
                          "AP_" + self.generator.label_to_name(label),
                          average_precision,
                          step=epoch,
                      )
              writer.flush()
  
      logs["mAP"] = self.mean_ap
  
      if self.verbose == 1:
          print("mAP: {:.4f}".format(self.mean_ap))
  
imports: from tensorflow import keras
  from ..utils.eval import evaluate
label_desc: Use image node_id 2 for calling the Evaluate obj's underlying member method code with example usage: obj.on_epoch_end(epoch, logs) without return types