(self, bbox, anchor, img_size)
return loc, label
Assign ground truth supervision to sampled subset of anchors.

        Types of input arrays and output arrays are same.

        Here are notations.

        * :math:`S` is the number of anchors.
        * :math:`R` is the number of bounding boxes.

        Args:
            bbox (array): Coordinates of bounding boxes. Its shape is
                :math:`(R, 4)`.
            anchor (array): Coordinates of anchors. Its shape is
                :math:`(S, 4)`.
            img_size (tuple of ints): A tuple :obj:`H, W`, which
                is a tuple of height and width of an image.

        Returns:
            (array, array):

            * **loc**: Offsets and scales to match the anchors to \
                the ground truth bounding boxes. Its shape is :math:`(S, 4)`.
            * **label**: Labels of anchors with values \
                :obj:`(1=positive, 0=negative, -1=ignore)`. Its shape \
                is :math:`(S,)`.
Assign ground truth supervision to sampled subset of anchors.
Assign ground truth supervision to sampled subset of anchors .
def __call__(self, bbox, anchor, img_size):
        """Assign ground truth supervision to sampled subset of anchors.

        Types of input arrays and output arrays are same.

        Here are notations.

        * :math:`S` is the number of anchors.
        * :math:`R` is the number of bounding boxes.

        Args:
            bbox (array): Coordinates of bounding boxes. Its shape is
                :math:`(R, 4)`.
            anchor (array): Coordinates of anchors. Its shape is
                :math:`(S, 4)`.
            img_size (tuple of ints): A tuple :obj:`H, W`, which
                is a tuple of height and width of an image.

        Returns:
            (array, array):

            * **loc**: Offsets and scales to match the anchors to \
                the ground truth bounding boxes. Its shape is :math:`(S, 4)`.
            * **label**: Labels of anchors with values \
                :obj:`(1=positive, 0=negative, -1=ignore)`. Its shape \
                is :math:`(S,)`.

        """
        xp = cuda.get_array_module(bbox)
        bbox = cuda.to_cpu(bbox)
        anchor = cuda.to_cpu(anchor)

        img_H, img_W = img_size

        n_anchor = len(anchor)
        inside_index = _get_inside_index(anchor, img_H, img_W)
        anchor = anchor[inside_index]
        argmax_ious, label = self._create_label(
            inside_index, anchor, bbox)

        # compute bounding box regression targets
        loc = bbox2loc(anchor, bbox[argmax_ious])

        # map up to original set of anchors
        label = _unmap(label, n_anchor, inside_index, fill=-1)
        loc = _unmap(loc, n_anchor, inside_index, fill=0)

        if xp != np:
            loc = chainer.backends.cuda.to_gpu(loc)
            label = chainer.backends.cuda.to_gpu(label)
        return loc, label
def __call__ ( self , bbox , anchor , img_size ) : xp = cuda . get_array_module ( bbox ) bbox = cuda . to_cpu ( bbox ) anchor = cuda . to_cpu ( anchor ) img_H , img_W = img_size n_anchor = len ( anchor ) inside_index = _get_inside_index ( anchor , img_H , img_W ) anchor = anchor [ inside_index ] argmax_ious , label = self . _create_label ( inside_index , anchor , bbox ) # compute bounding box regression targets loc = bbox2loc ( anchor , bbox [ argmax_ious ] ) # map up to original set of anchors label = _unmap ( label , n_anchor , inside_index , fill = - 1 ) loc = _unmap ( loc , n_anchor , inside_index , fill = 0 ) if xp != np : loc = chainer . backends . cuda . to_gpu ( loc ) label = chainer . backends . cuda . to_gpu ( label ) return loc , label