docstr: forward pass of network.
  :param x: input image. shape (b, c, y, x, (z))
  :return: seg_logits: shape (b, n_classes, y, x, (z))
  :return: out_box_coords: list over n_classes. elements are arrays(b, n_rois, (y1, x1, y2, x2, (z1), (z2)))
  :return: out_max_scores: list over n_classes. elements are arrays(b, n_rois)
docstr_tok: ["forward","pass","of","network",".",":","param","x",":","input","image",".","shape","(","b",",","c",",","y",",","x",",","(","z",")",")",":","return",":","seg_logits",":","shape","(","b",",","n_classes",",","y",",","x",",","(","z",")",")",":","return",":","out_box_coords",":","list","over","n_classes",".","elements","are","arrays","(","b",",","n_rois",",","(","y1",",","x1",",","y2",",","x2",",","(","z1",")",",","(","z2",")",")",")",":","return",":","out_max_scores",":","list","over","n_classes",".","elements","are","arrays","(","b",",","n_rois",")"]
code: def forward(self, x):
      """
      forward pass of network.
      :param x: input image. shape (b, c, y, x, (z))
      :return: seg_logits: shape (b, n_classes, y, x, (z))
      :return: out_box_coords: list over n_classes. elements are arrays(b, n_rois, (y1, x1, y2, x2, (z1), (z2)))
      :return: out_max_scores: list over n_classes. elements are arrays(b, n_rois)
      """
  
      out_features = self.fpn(x)[0]
      seg_logits = self.conv_final(out_features)
      out_box_coords, out_max_scores = [], []
      smax = F.softmax(seg_logits, dim=1).detach().cpu().data.numpy()
  
      for cl in range(1, len(self.cf.class_dict.keys()) + 1):
          max_scores = [[] for _ in range(x.shape[0])]
          hard_mask = np.copy(smax).argmax(1)
          hard_mask[hard_mask != cl] = 0
          hard_mask[hard_mask == cl] = 1
          # perform connected component analysis on argmaxed predictions,
          # draw boxes around components and return coordinates.
          box_coords, rois = get_coords(
              hard_mask, self.cf.n_roi_candidates, self.cf.dim
          )
  
          # for each object, choose the highest softmax score (in the respective class)
          # of all pixels in the component as object score.
          for bix, broi in enumerate(rois):
              for nix, nroi in enumerate(broi):
                  component_score = (
                      np.max(smax[bix, cl][nroi > 0])
                      if self.cf.aggregation_operation == "max"
                      else np.median(smax[bix, cl][nroi > 0])
                  )
                  max_scores[bix].append(component_score)
          out_box_coords.append(box_coords)
          out_max_scores.append(max_scores)
      return seg_logits, out_box_coords, out_max_scores
  
file_path: medicaldetectiontoolkit/models/detection_unet.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from scipy.ndimage.measurements import label
  import numpy
  import utils.exp_utils
  import utils.model_utils
label_desc: Use image node_id 2 for calling the net obj's underlying member method code with example usage: obj.forward(x) and returns: seg_logits,  out_box_coords,  out_max_scores