Package ai.djl.modality.cv.translator
Class ImageClassificationTranslator.Builder
java.lang.Object
ai.djl.modality.cv.translator.BaseImageTranslator.BaseBuilder<T>
ai.djl.modality.cv.translator.BaseImageTranslator.ClassificationBuilder<ImageClassificationTranslator.Builder>
ai.djl.modality.cv.translator.ImageClassificationTranslator.Builder
- Enclosing class:
- ImageClassificationTranslator
public static class ImageClassificationTranslator.Builder
extends BaseImageTranslator.ClassificationBuilder<ImageClassificationTranslator.Builder>
A Builder to construct a
ImageClassificationTranslator
.-
Field Summary
Fields inherited from class ai.djl.modality.cv.translator.BaseImageTranslator.ClassificationBuilder
synsetLoader
Fields inherited from class ai.djl.modality.cv.translator.BaseImageTranslator.BaseBuilder
batchifier, flag, height, pipeline, width
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds theImageClassificationTranslator
with the provided data.protected void
configPostProcess
(Map<String, ?> arguments) optApplySoftmax
(boolean applySoftmax) Sets whether to apply softmax when processing output.optTopK
(int topK) Set the topK number of classes to be displayed.protected ImageClassificationTranslator.Builder
self()
Methods inherited from class ai.djl.modality.cv.translator.BaseImageTranslator.ClassificationBuilder
optSynset, optSynsetArtifactName, optSynsetUrl, validate
Methods inherited from class ai.djl.modality.cv.translator.BaseImageTranslator.BaseBuilder
addTransform, configPreProcess, optBatchifier, optFlag, setImageSize, setPipeline
-
Method Details
-
optTopK
Set the topK number of classes to be displayed.- Parameters:
topK
- the number of top classes to return- Returns:
- the builder
-
optApplySoftmax
Sets whether to apply softmax when processing output. Some models already include softmax in the last layer, so don't apply softmax when processing model output.- Parameters:
applySoftmax
- boolean whether to apply softmax- Returns:
- the builder
-
self
- Specified by:
self
in classBaseImageTranslator.BaseBuilder<ImageClassificationTranslator.Builder>
-
configPostProcess
-
build
Builds theImageClassificationTranslator
with the provided data.- Returns:
- an
ImageClassificationTranslator
-