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 ofBlock
that implements a Single Shot Detection (SSD) model for object detection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SingleShotDetection.Builder
The Builder to construct aSingleShotDetection
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SingleShotDetection.Builder
builder()
Creates a builder to build aSingleShotDetection
.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 aBlock
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, addParameter, getChildren, getDirectParameters
-
Methods inherited from class ai.djl.nn.AbstractBaseBlock
beforeInitialize, cast, clear, describeInput, forward, forward, forwardInternal, 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:
forwardInternal
in 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:
initialize
in interfaceai.djl.nn.Block
- Overrides:
initialize
in classai.djl.nn.AbstractBaseBlock
-
loadMetadata
public void loadMetadata(byte loadVersion, java.io.DataInputStream is) throws java.io.IOException, ai.djl.MalformedModelException
- Overrides:
loadMetadata
in classai.djl.nn.AbstractBaseBlock
- Throws:
java.io.IOException
ai.djl.MalformedModelException
-
getDownSamplingBlock
public static ai.djl.nn.SequentialBlock getDownSamplingBlock(int numFilters)
Creates aBlock
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 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
-
-