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 -
Field Summary
Fields inherited from class ai.djl.nn.AbstractBlock
children, parametersFields inherited from class ai.djl.nn.AbstractBaseBlock
inputNames, inputShapes, outputDataTypes, version -
Method Summary
Modifier and TypeMethodDescriptionstatic 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<String, 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, DataInputStream is) Methods inherited from class ai.djl.nn.AbstractBlock
addChildBlock, addChildBlock, addChildBlockSingleton, addParameter, getChildren, getDirectParametersMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:
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, DataInputStream is) throws IOException, ai.djl.MalformedModelException - Overrides:
loadMetadatain classai.djl.nn.AbstractBaseBlock- Throws:
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
Creates a builder to build aSingleShotDetection.- Returns:
- a new builder
-