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.AbstractBlockSingleShotDetectionis an implementation ofBlockthat implements a Single Shot Detection (SSD) model for object detection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSingleShotDetection.BuilderThe Builder to construct aSingleShotDetection.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SingleShotDetection.Builderbuilder()Creates a builder to build aSingleShotDetection.protected ai.djl.ndarray.NDListforwardInternal(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.Conv2dgetAnchorPredictionBlock(int numAnchors)Creates a anchor prediction block used in an SSD.static ai.djl.nn.convolutional.Conv2dgetClassPredictionBlock(int numAnchors, int numClasses)Creates a class prediction block used in an SSD.static ai.djl.nn.SequentialBlockgetDownSamplingBlock(int numFilters)Creates aBlockthat reduces the size of a convolutional block by half.ai.djl.ndarray.types.Shape[]getOutputShapes(ai.djl.ndarray.types.Shape[] inputShapes)voidinitialize(ai.djl.ndarray.NDManager manager, ai.djl.ndarray.types.DataType dataType, ai.djl.ndarray.types.Shape... inputShapes)voidloadMetadata(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, getParameters, initializeChildBlocks, isInitialized, loadParameters, prepare, readInputShapes, saveInputShapes, saveMetadata, saveParameters, setInitializer, setInitializer, setInitializer, toString
-
-
-
-
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:
forwardInternalin classai.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:
initializein interfaceai.djl.nn.Block- Overrides:
initializein classai.djl.nn.AbstractBaseBlock
-
loadMetadata
public void loadMetadata(byte loadVersion, java.io.DataInputStream is) throws java.io.IOException, ai.djl.MalformedModelException- Overrides:
loadMetadatain classai.djl.nn.AbstractBaseBlock- Throws:
java.io.IOExceptionai.djl.MalformedModelException
-
getDownSamplingBlock
public static ai.djl.nn.SequentialBlock getDownSamplingBlock(int numFilters)
Creates aBlockthat reduces the size of a convolutional block by half.- Parameters:
numFilters- the number of filters- Returns:
- a
Blockthat 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 anchorsnumClasses- 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 aSingleShotDetection.- Returns:
- a new builder
-
-