Class MultiBoxPrior


  • public class MultiBoxPrior
    extends java.lang.Object
    MultiBoxPrior is the class that generates anchor boxes that act as priors for object detection.

    Object detection algorithms usually sample a large number of regions in the input image, determine whether these regions contain objects of interest, and adjust the edges of the regions so as to predict the ground-truth bounding box of the target more accurately. Different models may use different region sampling methods. These bounding boxes are also called anchor boxes.

    MultiBoxPrior generates these anchor boxes, based on the required sizes and aspect ratios and returns an NDArray of Shape (1, Number of anchor boxes, 4). Anchor boxes need not be generated separately for the each example in the batch. One set of anchor boxes per batch is sufficient.

    The number of anchor boxes generated depends on the number of sizes and aspect ratios. If the number of sizes is \(n\) and the number of ratios is \(m\), the total number of boxes generated per pixel is \(n + m - 1\).

    • Method Detail

      • generateAnchorBoxes

        public NDArray generateAnchorBoxes​(NDArray input)
        Generates the anchorBoxes array in the input's manager and device.
        Parameters:
        input - the input whose manager and device to put the generated boxes in
        Returns:
        the generated boxes
      • builder

        public static MultiBoxPrior.Builder builder()
        Creates a builder to build a MultiBoxPrior.
        Returns:
        a new builder