Class MultiBoxDetection


  • 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.

    • Method Detail

      • detection

        public NDList detection​(NDList inputs)
        Converts multi-box detection predictions.
        Parameters:
        inputs - a NDList of (class probabilities, box predictions, and anchors) in that order
        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]
      • builder

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