class_docstr: YOLOv3.
  
  This is a model of YOLOv3 [#]_.
  This model uses :class:`~chainercv.links.model.yolo.Darknet53Extractor` as
  its feature extractor.
  
  .. [#] Joseph Redmon, Ali Farhadi.
     YOLOv3: An Incremental Improvement. arXiv 2018.
  
  Args:
     n_fg_class (int): The number of classes excluding the background.
     pretrained_model (string): The weight file to be loaded.
         This can take :obj:`'voc0712'`, `filepath` or :obj:`None`.
         The default value is :obj:`None`.
  
          * :obj:`'voc0712'`: Load weights trained on trainval split of                 PASCAL VOC 2007 and 2012.                 The weight file is downloaded and cached automatically.                 :obj:`n_fg_class` must be :obj:`20` or :obj:`None`.                 These weights were converted from the darknet model.                 The conversion code is                 `chainercv/examples/yolo/darknet2npz.py`.
          * `filepath`: A path of npz file. In this case, :obj:`n_fg_class`                 must be specified properly.
          * :obj:`None`: Do not load weights.
class_docstr_tok: ["YOLOv3",".","This","is","a","model","of","YOLOv3","[","#","]","_",".","This","model","uses",":","class",":","`","~chainercv.links.model.yolo.Darknet53Extractor","`","as","its","feature","extractor",".","..","[","#","]","Joseph","Redmon",",","Ali","Farhadi",".","YOLOv3",":","An","Incremental","Improvement",".","arXiv","2018",".","Args",":","n_fg_class","(","int",")",":","The","number","of","classes","excluding","the","background",".","pretrained_model","(","string",")",":","The","weight","file","to","be","loaded",".","This","can","take",":","obj",":","`","'voc0712","'","`",",","`","filepath","`","or",":","obj",":","`","None","`",".","The","default","value","is",":","obj",":","`","None","`",".","*",":","obj",":","`","'voc0712","'","`",":","Load","weights","trained","on","trainval","split","of","PASCAL","VOC","2007","and","2012",".","The","weight","file","is","downloaded","and","cached","automatically",".",":","obj",":","`","n_fg_class","`","must","be",":","obj",":","`","20","`","or",":","obj",":","`","None","`",".","These","weights","were","converted","from","the","darknet","model",".","The","conversion","code","is","`","chainercv\/examples\/yolo\/darknet2npz.py","`",".","*","`","filepath","`",":","A","path","of","npz","file",".","In","this","case",",",":","obj",":","`","n_fg_class","`","must","be","specified","properly",".","*",":","obj",":","`","None","`",":","Do","not","load","weights","."]
docstr: Compute localization, objectness, and classification from a batch of images.
  
  This method computes three variables, :obj:`locs`, :obj:`objs`,
  and :obj:`confs`.
  :meth:`self._decode` converts these variables to bounding box
  coordinates and confidence scores.
  These variables are also used in training YOLOv3.
  
  Args:
      x (chainer.Variable): A variable holding a batch of images.
  
  Returns:
      tuple of chainer.Variable:
      This method returns three variables, :obj:`locs`,
      :obj:`objs`, and :obj:`confs`.
  
      * **locs**: A variable of float arrays of shape                 :math:`(B, K, 4)`,                 where :math:`B` is the number of samples in the batch and                 :math:`K` is the number of default bounding boxes.
      * **objs**: A variable of float arrays of shape                 :math:`(B, K)`.
      * **confs**: A variable of float arrays of shape                 :math:`(B, K, n\_fg\_class)`.
docstr_tok: ["Compute","localization",",","objectness",",","and","classification","from","a","batch","of","images",".","This","method","computes","three","variables",",",":","obj",":","`","locs","`",",",":","obj",":","`","objs","`",",","and",":","obj",":","`","confs","`",".",":","meth",":","`","self._decode","`","converts","these","variables","to","bounding","box","coordinates","and","confidence","scores",".","These","variables","are","also","used","in","training","YOLOv3",".","Args",":","x","(","chainer.Variable",")",":","A","variable","holding","a","batch","of","images",".","Returns",":","tuple","of","chainer.Variable",":","This","method","returns","three","variables",",",":","obj",":","`","locs","`",",",":","obj",":","`","objs","`",",","and",":","obj",":","`","confs","`",".","*","*","*","locs","*","*",":","A","variable","of","float","arrays","of","shape",":","math",":","`","(","B",",","K",",","4",")","`",",","where",":","math",":","`","B","`","is","the","number","of","samples","in","the","batch","and",":","math",":","`","K","`","is","the","number","of","default","bounding","boxes",".","*","*","*","objs","*","*",":","A","variable","of","float","arrays","of","shape",":","math",":","`","(","B",",","K",")","`",".","*","*","*","confs","*","*",":","A","variable","of","float","arrays","of","shape",":","math",":","`","(","B",",","K",",","n\\_fg\\_class",")","`","."]
code: def forward(self, x):
      """Compute localization, objectness, and classification from a batch of images.
  
          This method computes three variables, :obj:`locs`, :obj:`objs`,
          and :obj:`confs`.
          :meth:`self._decode` converts these variables to bounding box
          coordinates and confidence scores.
          These variables are also used in training YOLOv3.
  
          Args:
              x (chainer.Variable): A variable holding a batch of images.
  
          Returns:
              tuple of chainer.Variable:
              This method returns three variables, :obj:`locs`,
              :obj:`objs`, and :obj:`confs`.
  
              * **locs**: A variable of float arrays of shape \
                  :math:`(B, K, 4)`, \
                  where :math:`B` is the number of samples in the batch and \
                  :math:`K` is the number of default bounding boxes.
              * **objs**: A variable of float arrays of shape \
                  :math:`(B, K)`.
              * **confs**: A variable of float arrays of shape \
                  :math:`(B, K, n\_fg\_class)`.
          """
  
      ys = []
      for i, h in enumerate(self.extractor(x)):
          h = self.subnet[i](h)
          h = F.transpose(h, (0, 2, 3, 1))
          h = F.reshape(h, (h.shape[0], -1, 4 + 1 + self.n_fg_class))
          ys.append(h)
      y = F.concat(ys)
      locs = y[:, :, :4]
      objs = y[:, :, 4]
      confs = y[:, :, 5:]
      return locs, objs, confs
  
imports: from __future__ import division
  import itertools
  import numpy
  import chainer
  from chainer.backends import cuda
  import chainer.functions
  from chainer.links import Convolution2D
  from chainercv.links import Conv2DBNActiv
  from chainercv import utils
  from chainercv.links.model.yolo.yolo_base import YOLOBase
label_desc: Use image node_id 4 for calling the YOLOv3 obj's underlying member method code with example usage: obj.forward(x) and returns: locs,  objs,  confs