Class SingleShotDetection

java.lang.Object
ai.djl.nn.AbstractBaseBlock
ai.djl.nn.AbstractBlock
ai.djl.basicmodelzoo.cv.object_detection.ssd.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.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The Builder to construct a SingleShotDetection.
  • 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

    Modifier and Type
    Method
    Description
    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<String,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, 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, freezeParameters, getOutputShapes
  • Method Details

    • forwardInternal

      protected ai.djl.ndarray.NDList forwardInternal(ai.djl.training.ParameterStore parameterStore, ai.djl.ndarray.NDList inputs, boolean training, ai.djl.util.PairList<String,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, DataInputStream is) throws IOException, ai.djl.MalformedModelException
      Overrides:
      loadMetadata in class ai.djl.nn.AbstractBaseBlock
      Throws:
      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
    • builder

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