(self, x, rois, roi_indices, img_size, gt_roi_labels=None)
return roi_ag_seg_scores, roi_ag_locs, roi_cls_scores, \
            rois, roi_indices
Forward the chain.

        We assume that there are :math:`N` batches.

        Args:
            x (~chainer.Variable): 4D image variable.
            rois (array): A bounding box array containing coordinates of
                proposal boxes.  This is a concatenation of bounding box
                arrays from multiple images in the batch.
                Its shape is :math:`(R', 4)`. Given :math:`R_i` proposed
                RoIs from the :math:`i` th image,
                :math:`R' = \\sum _{i=1} ^ N R_i`.
            roi_indices (array): An array containing indices of images to
                which bounding boxes correspond to. Its shape is :math:`(R',)`.
            img_size (tuple of int): A tuple containing image size.
Forward the chain.
Forward the chain .
def forward(self, x, rois, roi_indices, img_size, gt_roi_labels=None):
        """Forward the chain.

        We assume that there are :math:`N` batches.

        Args:
            x (~chainer.Variable): 4D image variable.
            rois (array): A bounding box array containing coordinates of
                proposal boxes.  This is a concatenation of bounding box
                arrays from multiple images in the batch.
                Its shape is :math:`(R', 4)`. Given :math:`R_i` proposed
                RoIs from the :math:`i` th image,
                :math:`R' = \\sum _{i=1} ^ N R_i`.
            roi_indices (array): An array containing indices of images to
                which bounding boxes correspond to. Its shape is :math:`(R',)`.
            img_size (tuple of int): A tuple containing image size.

        """
        h = F.relu(self.conv1(x))
        h_cls_seg = self.cls_seg(h)
        h_ag_loc = self.ag_loc(h)

        # PSROI pooling and regression
        roi_ag_seg_scores, roi_ag_locs, roi_cls_scores = self._pool(
            h_cls_seg, h_ag_loc, rois, roi_indices, gt_roi_labels)
        if self.iter2:
            # 2nd Iteration
            # get rois2 for more precise prediction
            roi_ag_locs = roi_ag_locs.array
            mean = self.xp.array(self.loc_normalize_mean)
            std = self.xp.array(self.loc_normalize_std)
            roi_locs = roi_ag_locs[:, 1, :]
            roi_locs = (roi_locs * std + mean).astype(np.float32)
            rois2 = loc2bbox(rois, roi_locs)

            rois2[:, 0::2] = self.xp.clip(rois2[:, 0::2], 0, img_size[0])
            rois2[:, 1::2] = self.xp.clip(rois2[:, 1::2], 0, img_size[1])

            # PSROI pooling and regression
            roi_ag_seg_scores2, roi_ag_locs2, roi_cls_scores2 = self._pool(
                h_cls_seg, h_ag_loc, rois2, roi_indices, gt_roi_labels)

            # concat 1st and 2nd iteration results
            rois = self.xp.concatenate((rois, rois2))
            roi_indices = self.xp.concatenate((roi_indices, roi_indices))
            roi_ag_seg_scores = F.concat(
                (roi_ag_seg_scores, roi_ag_seg_scores2), axis=0)
            roi_ag_locs = F.concat(
                (roi_ag_locs, roi_ag_locs2), axis=0)
            roi_cls_scores = F.concat(
                (roi_cls_scores, roi_cls_scores2), axis=0)
        return roi_ag_seg_scores, roi_ag_locs, roi_cls_scores, \
            rois, roi_indices
def forward ( self , x , rois , roi_indices , img_size , gt_roi_labels = None ) : h = F . relu ( self . conv1 ( x ) ) h_cls_seg = self . cls_seg ( h ) h_ag_loc = self . ag_loc ( h ) # PSROI pooling and regression roi_ag_seg_scores , roi_ag_locs , roi_cls_scores = self . _pool ( h_cls_seg , h_ag_loc , rois , roi_indices , gt_roi_labels ) if self . iter2 : # 2nd Iteration # get rois2 for more precise prediction roi_ag_locs = roi_ag_locs . array mean = self . xp . array ( self . loc_normalize_mean ) std = self . xp . array ( self . loc_normalize_std ) roi_locs = roi_ag_locs [ : , 1 , : ] roi_locs = ( roi_locs * std + mean ) . astype ( np . float32 ) rois2 = loc2bbox ( rois , roi_locs ) rois2 [ : , 0 : : 2 ] = self . xp . clip ( rois2 [ : , 0 : : 2 ] , 0 , img_size [ 0 ] ) rois2 [ : , 1 : : 2 ] = self . xp . clip ( rois2 [ : , 1 : : 2 ] , 0 , img_size [ 1 ] ) # PSROI pooling and regression roi_ag_seg_scores2 , roi_ag_locs2 , roi_cls_scores2 = self . _pool ( h_cls_seg , h_ag_loc , rois2 , roi_indices , gt_roi_labels ) # concat 1st and 2nd iteration results rois = self . xp . concatenate ( ( rois , rois2 ) ) roi_indices = self . xp . concatenate ( ( roi_indices , roi_indices ) ) roi_ag_seg_scores = F . concat ( ( roi_ag_seg_scores , roi_ag_seg_scores2 ) , axis = 0 ) roi_ag_locs = F . concat ( ( roi_ag_locs , roi_ag_locs2 ) , axis = 0 ) roi_cls_scores = F . concat ( ( roi_cls_scores , roi_cls_scores2 ) , axis = 0 ) return roi_ag_seg_scores , roi_ag_locs , roi_cls_scores , rois , roi_indices