public class MultiBoxDetection
extends java.lang.Object
MultiBoxDetection
is the class that takes the output of a multi-box detection model, and
converts it into an NDList that contains the object detections.
The output from a Single Shot Detection(SSD) network would be class probabilities, box offset
predictions, and the generated anchor boxes. Once out-of-boundary boxes are eliminated, and boxes
with scores lower than the threshold are removed, we will ideally have a small number of
candidates for each object in the image. Since anchor boxes are generated in multiple scales
around each pixel by MultiBoxPrior
, there are bound to be multiple boxes around each
object which have a score greater than the threshold. We use Non-Maximum Suppression(NMS) to
choose one box that is most likely to fit the object in the image.
MultiBoxDetection
handles all of these tasks, and returns an NDList
with a
single NDArray
of Shape
(batch_size, Number
of generated anchor boxes, 6). For each generated anchor box, there is an NDArray
of Shape
(6,). The values in each of those
arrays represent the following: [class, score, x_min, y_min, x_max, y_max]
. The class
is set to -1 for boxes that are removed or classified as background. The score
is
the confidence with which the model thinks the box contains an object of the specified class
, and the other four values represent the normalised co-ordinates of the box.
Modifier and Type | Class and Description |
---|---|
static class |
MultiBoxDetection.Builder
The Builder to construct a
MultiBoxDetection object. |
Constructor and Description |
---|
MultiBoxDetection(MultiBoxDetection.Builder builder)
Creates a new instance of
MultiBoxDetection with the arguments from the given MultiBoxDetection.Builder . |
Modifier and Type | Method and Description |
---|---|
static MultiBoxDetection.Builder |
builder()
Creates a builder to build a
MultiBoxDetection . |
NDList |
detection(NDList inputs)
Converts multi-box detection predictions.
|
public MultiBoxDetection(MultiBoxDetection.Builder builder)
MultiBoxDetection
with the arguments from the given MultiBoxDetection.Builder
.builder
- the MultiBoxDetection.Builder
with the necessary argumentspublic NDList detection(NDList inputs)
inputs
- a NDList of (class probabilities, box predictions, and anchors) in that orderNDList
with a single NDArray
of Shape
(batch_size, Number of generated anchor boxes, 6). For each
generated anchor box, there is an NDArray
of Shape
(6,). The values in each of those arrays represent the
following: [class, score, x_min, y_min, x_max, y_max]
public static MultiBoxDetection.Builder builder()
MultiBoxDetection
.