Class MultiBoxPrior
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\).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
The Builder to construct aMultiBoxPrior
object. -
Constructor Summary
ConstructorsConstructorDescriptionMultiBoxPrior
(MultiBoxPrior.Builder builder) Creates a new instance ofMultiBoxPrior
with the arguments from the givenMultiBoxPrior.Builder
. -
Method Summary
Modifier and TypeMethodDescriptionstatic MultiBoxPrior.Builder
builder()
Creates a builder to build aMultiBoxPrior
.generateAnchorBoxes
(NDArray input) Generates the anchorBoxes array in the input's manager and device.
-
Constructor Details
-
MultiBoxPrior
Creates a new instance ofMultiBoxPrior
with the arguments from the givenMultiBoxPrior.Builder
.- Parameters:
builder
- theMultiBoxPrior.Builder
with the necessary arguments
-
-
Method Details
-
generateAnchorBoxes
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
Creates a builder to build aMultiBoxPrior
.- Returns:
- a new builder
-