(self, sizes)
return anchors
Calculates anchor boxes.

        Args:
            sizes (iterable of tuples of two ints): An iterable of
                :math:`(H_l, W_l)`, where :math:`H_l` and :math:`W_l`
                are height and width of the :math:`l`-th feature map.

        Returns:
            list of arrays:
            The shape of the :math:`l`-th array is :math:`(H_l * W_l * A, 4)`,
            where :math:`A` is the number of anchor ratios.
Calculates anchor boxes.
Calculates anchor boxes .
def anchors(self, sizes):
        """Calculates anchor boxes.

        Args:
            sizes (iterable of tuples of two ints): An iterable of
                :math:`(H_l, W_l)`, where :math:`H_l` and :math:`W_l`
                are height and width of the :math:`l`-th feature map.

        Returns:
            list of arrays:
            The shape of the :math:`l`-th array is :math:`(H_l * W_l * A, 4)`,
            where :math:`A` is the number of anchor ratios.

        """
        anchors = []
        for l, (H, W) in enumerate(sizes):
            v, u, ar = np.meshgrid(
                np.arange(W), np.arange(H), self._anchor_ratios)
            w = np.round(1 / np.sqrt(ar) / self._scales[l])
            h = np.round(w * ar)
            anchor = np.stack((u, v, h, w)).reshape((4, -1)).transpose()
            anchor[:, :2] = (anchor[:, :2] + 0.5) / self._scales[l]
            anchor[:, 2:] *= (self._anchor_size << l) * self._scales[l]
            # yxhw -> tlbr
            anchor[:, :2] -= anchor[:, 2:] / 2
            anchor[:, 2:] += anchor[:, :2]
            anchors.append(self.xp.array(anchor, dtype=np.float32))

        return anchors
def anchors ( self , sizes ) : anchors = [ ] for l , ( H , W ) in enumerate ( sizes ) : v , u , ar = np . meshgrid ( np . arange ( W ) , np . arange ( H ) , self . _anchor_ratios ) w = np . round ( 1 / np . sqrt ( ar ) / self . _scales [ l ] ) h = np . round ( w * ar ) anchor = np . stack ( ( u , v , h , w ) ) . reshape ( ( 4 , - 1 ) ) . transpose ( ) anchor [ : , : 2 ] = ( anchor [ : , : 2 ] + 0.5 ) / self . _scales [ l ] anchor [ : , 2 : ] *= ( self . _anchor_size << l ) * self . _scales [ l ] # yxhw -> tlbr anchor [ : , : 2 ] -= anchor [ : , 2 : ] / 2 anchor [ : , 2 : ] += anchor [ : , : 2 ] anchors . append ( self . xp . array ( anchor , dtype = np . float32 ) ) return anchors