Class SingleShotDetection

  • All Implemented Interfaces:
    ai.djl.nn.Block

    public final class SingleShotDetection
    extends ai.djl.nn.AbstractBlock
    SingleShotDetection is an implementation of Block that implements a Single Shot Detection (SSD) model for object detection.
    • Field Summary

      • Fields inherited from class ai.djl.nn.AbstractBlock

        children, parameters
      • Fields inherited from class ai.djl.nn.AbstractBaseBlock

        inputNames, inputShapes, outputDataTypes, version
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static SingleShotDetection.Builder builder()
      Creates a builder to build a SingleShotDetection.
      protected ai.djl.ndarray.NDList forwardInternal​(ai.djl.training.ParameterStore parameterStore, ai.djl.ndarray.NDList inputs, boolean training, ai.djl.util.PairList<java.lang.String,​java.lang.Object> params)
      static ai.djl.nn.convolutional.Conv2d getAnchorPredictionBlock​(int numAnchors)
      Creates a anchor prediction block used in an SSD.
      static ai.djl.nn.convolutional.Conv2d getClassPredictionBlock​(int numAnchors, int numClasses)
      Creates a class prediction block used in an SSD.
      static ai.djl.nn.SequentialBlock getDownSamplingBlock​(int numFilters)
      Creates a Block that reduces the size of a convolutional block by half.
      ai.djl.ndarray.types.Shape[] getOutputShapes​(ai.djl.ndarray.types.Shape[] inputShapes)
      void initialize​(ai.djl.ndarray.NDManager manager, ai.djl.ndarray.types.DataType dataType, ai.djl.ndarray.types.Shape... inputShapes)
      void loadMetadata​(byte loadVersion, java.io.DataInputStream is)
      • Methods inherited from class ai.djl.nn.AbstractBlock

        addChildBlock, addChildBlock, addChildBlockSingleton, addParameter, getChildren, getDirectParameters
      • Methods inherited from class ai.djl.nn.AbstractBaseBlock

        beforeInitialize, cast, clear, describeInput, forward, forward, forwardInternal, getInputShapes, getOutputDataTypes, getParameters, initializeChildBlocks, isInitialized, loadParameters, prepare, readInputShapes, saveInputShapes, saveMetadata, saveParameters, setInitializer, setInitializer, setInitializer, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface ai.djl.nn.Block

        forward, freezeParameters, getOutputShapes
    • Method Detail

      • forwardInternal

        protected ai.djl.ndarray.NDList forwardInternal​(ai.djl.training.ParameterStore parameterStore,
                                                        ai.djl.ndarray.NDList inputs,
                                                        boolean training,
                                                        ai.djl.util.PairList<java.lang.String,​java.lang.Object> params)
        Specified by:
        forwardInternal in class ai.djl.nn.AbstractBaseBlock
      • getOutputShapes

        public ai.djl.ndarray.types.Shape[] getOutputShapes​(ai.djl.ndarray.types.Shape[] inputShapes)
      • initialize

        public void initialize​(ai.djl.ndarray.NDManager manager,
                               ai.djl.ndarray.types.DataType dataType,
                               ai.djl.ndarray.types.Shape... inputShapes)
        Specified by:
        initialize in interface ai.djl.nn.Block
        Overrides:
        initialize in class ai.djl.nn.AbstractBaseBlock
      • loadMetadata

        public void loadMetadata​(byte loadVersion,
                                 java.io.DataInputStream is)
                          throws java.io.IOException,
                                 ai.djl.MalformedModelException
        Overrides:
        loadMetadata in class ai.djl.nn.AbstractBaseBlock
        Throws:
        java.io.IOException
        ai.djl.MalformedModelException
      • getDownSamplingBlock

        public static ai.djl.nn.SequentialBlock getDownSamplingBlock​(int numFilters)
        Creates a Block that reduces the size of a convolutional block by half.
        Parameters:
        numFilters - the number of filters
        Returns:
        a Block that reduces the size of a convolutional block by half
      • getClassPredictionBlock

        public static ai.djl.nn.convolutional.Conv2d getClassPredictionBlock​(int numAnchors,
                                                                             int numClasses)
        Creates a class prediction block used in an SSD.
        Parameters:
        numAnchors - the number of anchors
        numClasses - the number of classes
        Returns:
        a class prediction block used in an SSD
      • getAnchorPredictionBlock

        public static ai.djl.nn.convolutional.Conv2d getAnchorPredictionBlock​(int numAnchors)
        Creates a anchor prediction block used in an SSD.
        Parameters:
        numAnchors - the number of anchors
        Returns:
        a anchor prediction block used in an SSD