class_docstr: Implement FCOS in :paper:`fcos`.
class_docstr_tok: ["Implement","FCOS","in",":","paper",":","`","fcos","`","."]
docstr: Identical to :meth:`RetinaNet.inference_single_image.
docstr_tok: ["Identical","to",":","meth",":","`","RetinaNet.inference_single_image","."]
code: def inference_single_image(
      self,
      anchors: List[Boxes],
      box_cls: List[torch.Tensor],
      box_delta: List[torch.Tensor],
      image_size: Tuple[int, int],
  ):
      """
      Identical to :meth:`RetinaNet.inference_single_image.
      """
      pred = self._decode_multi_level_predictions(
          anchors,
          box_cls,
          box_delta,
          self.test_score_thresh,
          self.test_topk_candidates,
          image_size,
      )
      keep = batched_nms(
          pred.pred_boxes.tensor,
          pred.scores,
          pred.pred_classes,
          self.test_nms_thresh,
      )
      return pred[keep[: self.max_detections_per_image]]
  
imports: import logging
  from typing import List, Optional, Tuple
  import torch
  from fvcore.nn import sigmoid_focal_loss_jit
  from torch import nn
  from torch.nn import functional
  from detectron2.layers import ShapeSpec, batched_nms
  from detectron2.structures import Boxes, ImageList, Instances, pairwise_point_box_distance
  from detectron2.utils.events import get_event_storage
  from ..anchor_generator import DefaultAnchorGenerator
  from ..backbone import Backbone
  from ..box_regression import Box2BoxTransformLinear, _dense_box_regression_loss
  from .dense_detector import DenseDetector
  from .retinanet import RetinaNetHead
label_desc: Use image node_id 8 for calling the FCOS obj's underlying member method code with example usage: obj.inference_single_image(anchors, box_cls, box_delta, image_size) and returns: pred