(self, hs, rois, roi_indices)
return locs, confs
Calculates RoIs.

        Args:
            hs (iterable of array): An iterable of feature maps.
            rois (list of arrays): A list 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 (list of arrays): A list of arrays of
                shape :math:`(R_l,)`.

        Returns:
            tuple of two arrays:
            :obj:`locs` and :obj:`confs`.

            * **locs**: An arrays whose shape is \
                :math:`(R, n\_class, 4)`, where :math:`R` is the total number \
                of RoIs in the batch.
            * **confs**: A list of array whose shape is :math:`(R, n\_class)`.
Calculates RoIs.
Calculates RoIs .
def forward(self, hs, rois, roi_indices):
        """Calculates RoIs.

        Args:
            hs (iterable of array): An iterable of feature maps.
            rois (list of arrays): A list 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 (list of arrays): A list of arrays of
                shape :math:`(R_l,)`.

        Returns:
            tuple of two arrays:
            :obj:`locs` and :obj:`confs`.

            * **locs**: An arrays whose shape is \
                :math:`(R, n\_class, 4)`, where :math:`R` is the total number \
                of RoIs in the batch.
            * **confs**: A list of array whose shape is :math:`(R, n\_class)`.
        """

        hs_ = []
        for l, h in enumerate(hs):
            if len(rois[l]) == 0:
                continue
            h = F.roi_average_align_2d(
                h, rois[l], roi_indices[l], self._roi_size,
                self._scales[l], self._roi_sample_ratio)
            hs_.append(h)
        hs = hs_

        if len(hs) == 0:
            locs = chainer.Variable(
                self.xp.empty((0, self._n_class, 4), dtype=np.float32))
            confs = chainer.Variable(
                self.xp.empty((0, self._n_class), dtype=np.float32))
            return locs, confs

        h = F.concat(hs, axis=0)
        h = F.reshape(h, (h.shape[0], -1))
        h = F.relu(self.fc1(h))
        h = F.relu(self.fc2(h))

        locs = self.loc(h)
        locs = F.reshape(locs, (locs.shape[0], -1, 4))
        confs = self.conf(h)
        return locs, confs
def forward ( self , hs , rois , roi_indices ) : hs_ = [ ] for l , h in enumerate ( hs ) : if len ( rois [ l ] ) == 0 : continue h = F . roi_average_align_2d ( h , rois [ l ] , roi_indices [ l ] , self . _roi_size , self . _scales [ l ] , self . _roi_sample_ratio ) hs_ . append ( h ) hs = hs_ if len ( hs ) == 0 : locs = chainer . Variable ( self . xp . empty ( ( 0 , self . _n_class , 4 ) , dtype = np . float32 ) ) confs = chainer . Variable ( self . xp . empty ( ( 0 , self . _n_class ) , dtype = np . float32 ) ) return locs , confs h = F . concat ( hs , axis = 0 ) h = F . reshape ( h , ( h . shape [ 0 ] , - 1 ) ) h = F . relu ( self . fc1 ( h ) ) h = F . relu ( self . fc2 ( h ) ) locs = self . loc ( h ) locs = F . reshape ( locs , ( locs . shape [ 0 ] , - 1 , 4 ) ) confs = self . conf ( h ) return locs , confs