class_docstr: Bounding box head network of Feature Pyramid Networks.
  
  Args:
      n_class (int): The number of classes including background.
      scales (tuple of floats): The scales of feature maps.
class_docstr_tok: ["Bounding","box","head","network","of","Feature","Pyramid","Networks",".","Args",":","n_class","(","int",")",":","The","number","of","classes","including","background",".","scales","(","tuple","of","floats",")",":","The","scales","of","feature","maps","."]
docstr: Decodes back to coordinates of RoIs.
  
  This method decodes :obj:`locs` and :obj:`confs` returned
  by a FPN network back to :obj:`bboxes`,
  :obj:`labels` and :obj:`scores`.
  
  Args:
      rois (iterable of arrays): An iterable of arrays of
          shape :math:`(R_l, 4)`, where :math:`R_l` is the number
          of RoIs in the :math:`l`-th feature map.
      roi_indices (iterable of arrays): An iterable of arrays of
          shape :math:`(R_l,)`.
      locs (array): An array whose shape is :math:`(R, n\_class, 4)`,
          where :math:`R` is the total number of RoIs in the given batch.
      confs (array): An array whose shape is :math:`(R, n\_class)`.
      scales (list of floats): A list of floats returned
          by :meth:`~chainercv.links.model.fpn.faster_rcnn.prepare`
      sizes (list of tuples of two ints): A list of
          :math:`(H_n, W_n)`, where :math:`H_n` and :math:`W_n`
          are height and width of the :math:`n`-th image.
      nms_thresh (float): The threshold value
          for :func:`~chainercv.utils.non_maximum_suppression`.
      score_thresh (float): The threshold value for confidence score.
  
  Returns:
      tuple of three list of arrays:
      :obj:`bboxes`, :obj:`labels` and :obj:`scores`.
  
     * **bboxes**: A list of float arrays of shape :math:`(R'_n, 4)`,                where :math:`R'_n` is the number of bounding boxes in                the :math:`n`-th image.                Each bounding box is organized by                :math:`(y_{min}, x_{min}, y_{max}, x_{max})`                in the second axis.
     * **labels** : A list of integer arrays of shape :math:`(R'_n,)`.                Each value indicates the class of the bounding box.                Values are in range :math:`[0, L - 1]`, where :math:`L` is the                number of the foreground classes.
     * **scores** : A list of float arrays of shape :math:`(R'_n,)`.                Each value indicates how confident the prediction is.
docstr_tok: ["Decodes","back","to","coordinates","of","RoIs",".","This","method","decodes",":","obj",":","`","locs","`","and",":","obj",":","`","confs","`","returned","by","a","FPN","network","back","to",":","obj",":","`","bboxes","`",",",":","obj",":","`","labels","`","and",":","obj",":","`","scores","`",".","Args",":","rois","(","iterable","of","arrays",")",":","An","iterable","of","arrays","of","shape",":","math",":","`","(","R_l",",","4",")","`",",","where",":","math",":","`","R_l","`","is","the","number","of","RoIs","in","the",":","math",":","`","l","`","-th","feature","map",".","roi_indices","(","iterable","of","arrays",")",":","An","iterable","of","arrays","of","shape",":","math",":","`","(","R_l",",",")","`",".","locs","(","array",")",":","An","array","whose","shape","is",":","math",":","`","(","R",",","n\\_class",",","4",")","`",",","where",":","math",":","`","R","`","is","the","total","number","of","RoIs","in","the","given","batch",".","confs","(","array",")",":","An","array","whose","shape","is",":","math",":","`","(","R",",","n\\_class",")","`",".","scales","(","list","of","floats",")",":","A","list","of","floats","returned","by",":","meth",":","`","~chainercv.links.model.fpn.faster_rcnn.prepare","`","sizes","(","list","of","tuples","of","two","ints",")",":","A","list","of",":","math",":","`","(","H_n",",","W_n",")","`",",","where",":","math",":","`","H_n","`","and",":","math",":","`","W_n","`","are","height","and","width","of","the",":","math",":","`","n","`","-th","image",".","nms_thresh","(","float",")",":","The","threshold","value","for",":","func",":","`","~chainercv.utils.non_maximum_suppression","`",".","score_thresh","(","float",")",":","The","threshold","value","for","confidence","score",".","Returns",":","tuple","of","three","list","of","arrays",":",":","obj",":","`","bboxes","`",",",":","obj",":","`","labels","`","and",":","obj",":","`","scores","`",".","*","*","*","bboxes","*","*",":","A","list","of","float","arrays","of","shape",":","math",":","`","(","R'_n",",","4",")","`",",","where",":","math",":","`","R'_n","`","is","the","number","of","bounding","boxes","in","the",":","math",":","`","n","`","-th","image",".","Each","bounding","box","is","organized","by",":","math",":","`","(","y_","{","min","}",",","x_","{","min","}",",","y_","{","max","}",",","x_","{","max","}",")","`","in","the","second","axis",".","*","*","*","labels","*","*",":","A","list","of","integer","arrays","of","shape",":","math",":","`","(","R'_n",",",")","`",".","Each","value","indicates","the","class","of","the","bounding","box",".","Values","are","in","range",":","math",":","`","[","0",",","L","-","1","]","`",",","where",":","math",":","`","L","`","is","the","number","of","the","foreground","classes",".","*","*","*","scores","*","*",":","A","list","of","float","arrays","of","shape",":","math",":","`","(","R'_n",",",")","`",".","Each","value","indicates","how","confident","the","prediction","is","."]
code: def decode(
      self,
      rois,
      roi_indices,
      locs,
      confs,
      scales,
      sizes,
      nms_thresh,
      score_thresh,
  ):
      """Decodes back to coordinates of RoIs.
  
          This method decodes :obj:`locs` and :obj:`confs` returned
          by a FPN network back to :obj:`bboxes`,
          :obj:`labels` and :obj:`scores`.
  
          Args:
              rois (iterable of arrays): An iterable of arrays of
                  shape :math:`(R_l, 4)`, where :math:`R_l` is the number
                  of RoIs in the :math:`l`-th feature map.
              roi_indices (iterable of arrays): An iterable of arrays of
                  shape :math:`(R_l,)`.
              locs (array): An array whose shape is :math:`(R, n\_class, 4)`,
                  where :math:`R` is the total number of RoIs in the given batch.
              confs (array): An array whose shape is :math:`(R, n\_class)`.
              scales (list of floats): A list of floats returned
                  by :meth:`~chainercv.links.model.fpn.faster_rcnn.prepare`
              sizes (list of tuples of two ints): A list of
                  :math:`(H_n, W_n)`, where :math:`H_n` and :math:`W_n`
                  are height and width of the :math:`n`-th image.
              nms_thresh (float): The threshold value
                  for :func:`~chainercv.utils.non_maximum_suppression`.
              score_thresh (float): The threshold value for confidence score.
  
          Returns:
              tuple of three list of arrays:
              :obj:`bboxes`, :obj:`labels` and :obj:`scores`.
  
             * **bboxes**: A list of float arrays of shape :math:`(R'_n, 4)`, \
                 where :math:`R'_n` is the number of bounding boxes in \
                 the :math:`n`-th image. \
                 Each bounding box is organized by \
                 :math:`(y_{min}, x_{min}, y_{max}, x_{max})` \
                 in the second axis.
             * **labels** : A list of integer arrays of shape :math:`(R'_n,)`. \
                 Each value indicates the class of the bounding box. \
                 Values are in range :math:`[0, L - 1]`, where :math:`L` is the \
                 number of the foreground classes.
             * **scores** : A list of float arrays of shape :math:`(R'_n,)`. \
                 Each value indicates how confident the prediction is.
          """
  
      rois = self.xp.vstack(rois)
      roi_indices = self.xp.hstack(roi_indices)
      locs = locs.array
      confs = confs.array
  
      bboxes = []
      labels = []
      scores = []
      for i in range(len(scales)):
          mask = roi_indices == i
          roi = rois[mask]
          loc = locs[mask]
          conf = confs[mask]
  
          bbox = (
              self.xp.broadcast_to(roi[:, None], loc.shape) / scales[i]
          )
          # tlbr -> yxhw
          bbox[:, :, 2:] -= bbox[:, :, :2]
          bbox[:, :, :2] += bbox[:, :, 2:] / 2
          # offset
          bbox[:, :, :2] += loc[:, :, :2] * bbox[:, :, 2:] * self.std[0]
          bbox[:, :, 2:] *= self.xp.exp(
              self.xp.minimum(loc[:, :, 2:] * self.std[1], exp_clip)
          )
          # yxhw -> tlbr
          bbox[:, :, :2] -= bbox[:, :, 2:] / 2
          bbox[:, :, 2:] += bbox[:, :, :2]
          # clip
          bbox[:, :, :2] = self.xp.maximum(bbox[:, :, :2], 0)
          bbox[:, :, 2:] = self.xp.minimum(
              bbox[:, :, 2:], self.xp.array(sizes[i])
          )
  
          conf = self.xp.exp(conf)
          score = conf / self.xp.sum(conf, axis=1, keepdims=True)
  
          bbox, label, score = _suppress(
              bbox, score, nms_thresh, score_thresh
          )
  
          bboxes.append(bbox)
          labels.append(label)
          scores.append(score)
  
      return bboxes, labels, scores
  
imports: from __future__ import division
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.functions
  from chainer import initializers
  import chainer.links
  from chainercv.links.model.fpn.misc import argsort
  from chainercv.links.model.fpn.misc import choice
  from chainercv.links.model.fpn.misc import exp_clip
  from chainercv.links.model.fpn.misc import smooth_l1
  from chainercv import utils
label_desc: Use image node_id 4 for calling the BboxHead obj's underlying member method code with example usage: obj.decode(rois, roi_indices, locs, confs, scales, sizes, nms_thresh, score_thresh) and returns: bboxes,  labels,  scores