code: def fined_inference(
      model,
      coase_model,
      im,
      trans_info=None,
      is_slide=False,
      stride=None,
      crop_size=None,
  ):
      if hasattr(model, "data_format") and model.data_format == "NHWC":
          im = im.transpose((0, 2, 3, 1))
      pre_coase = coase_model(im)
      pre_coase = pre_coase[0]
      heatmap = pre_coase
      if not is_slide:
          logits = model(im, heatmap)
          if not isinstance(logits, collections.abc.Sequence):
              raise TypeError(
                  "The type of logits must be one of collections.abc.Sequence, e.g. list, tuple. But received {}".format(
                      type(logits)
                  )
              )
          logit = logits[0]
      else:
          logit = slide_inference(
              model, im, crop_size=crop_size, stride=stride
          )
      if hasattr(model, "data_format") and model.data_format == "NHWC":
          logit = logit.transpose((0, 3, 1, 2))
      if trans_info is not None:
          logit = reverse_transform(logit, trans_info, mode="bilinear")
          pred = paddle.argmax(
              logit, axis=1, keepdim=True, dtype="int32"
          )
          return pred, logit
      else:
          return logit
  
file_path: PaddleSeg/contrib/RSSegBenchmark/c2fnet/core/infer.py
imports: import collections.abc
  from itertools import combinations
  import numpy
  import cv2
  import paddle
  import paddle.nn.functional
label_desc: Use image node_id 6 for calling a global function with example usage: fined_inference(model, coase_model, im, trans_info, is_slide, stride, crop_size) and returns: pred,  logit, logit