Class MultiBoxPrior
- java.lang.Object
-
- ai.djl.modality.cv.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 anNDArray
ofShape
(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\).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MultiBoxPrior.Builder
The Builder to construct aMultiBoxPrior
object.
-
Constructor Summary
Constructors Constructor Description MultiBoxPrior(MultiBoxPrior.Builder builder)
Creates a new instance ofMultiBoxPrior
with the arguments from the givenMultiBoxPrior.Builder
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static MultiBoxPrior.Builder
builder()
Creates a builder to build aMultiBoxPrior
.NDArray
generateAnchorBoxes(NDArray input)
Generates the anchorBoxes array in the input's manager and device.
-
-
-
Constructor Detail
-
MultiBoxPrior
public MultiBoxPrior(MultiBoxPrior.Builder builder)
Creates a new instance ofMultiBoxPrior
with the arguments from the givenMultiBoxPrior.Builder
.- Parameters:
builder
- theMultiBoxPrior.Builder
with the necessary arguments
-
-
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 aMultiBoxPrior
.- Returns:
- a new builder
-
-