Class MultiBoxDetection
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe Builder to construct aMultiBoxDetectionobject. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance ofMultiBoxDetectionwith the arguments from the givenMultiBoxDetection.Builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic MultiBoxDetection.Builderbuilder()Creates a builder to build aMultiBoxDetection.Converts multi-box detection predictions.
-
Constructor Details
-
MultiBoxDetection
Creates a new instance ofMultiBoxDetectionwith the arguments from the givenMultiBoxDetection.Builder.- Parameters:
builder- theMultiBoxDetection.Builderwith the necessary arguments
-
-
Method Details
-
detection
Converts multi-box detection predictions.- Parameters:
inputs- a NDList of (class probabilities, box predictions, and anchors) in that order- Returns:
- an
NDListwith a singleNDArrayofShape(batch_size, Number of generated anchor boxes, 6). For each generated anchor box, there is anNDArrayofShape(6,). The values in each of those arrays represent the following:[class, score, x_min, y_min, x_max, y_max]
-
builder
Creates a builder to build aMultiBoxDetection.- Returns:
- a new builder
-