Package ai.djl.modality.cv.translator
Class Sam2Translator.Sam2Input
java.lang.Object
ai.djl.modality.cv.translator.Sam2Translator.Sam2Input
- Enclosing class:
- Sam2Translator
A class represents the segment anything input.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classThe builder forSam2Input. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a builder to build aSam2Inputwith the image.static Sam2Translator.Sam2InputConstructs aSam2Inputinstance from json string.getBoxes()Returns the box.getImage()Returns the image.Returns the locations.booleanReturnstrueif output visualized image.
-
Constructor Details
-
Sam2Input
Constructs aSam2Inputinstance.- Parameters:
image- the imagepoints- the locations on the imagelabels- the labels for the locations (0: background, 1: foreground)
-
Sam2Input
Constructs aSam2Inputinstance.- Parameters:
image- the imagepoints- the locations on the imagelabels- the labels for the locations (0: background, 1: foreground)visualize- true if output visualized image
-
-
Method Details
-
getImage
Returns the image.- Returns:
- the image
-
isVisualize
public boolean isVisualize()Returnstrueif output visualized image.- Returns:
trueif output visualized image
-
getPoints
Returns the locations.- Returns:
- the locations
-
getBoxes
Returns the box.- Returns:
- the box
-
fromJson
Constructs aSam2Inputinstance from json string.- Parameters:
input- the json input- Returns:
- a
Sam2Inputinstance - Throws:
IOException- if failed to load the image
-
builder
Creates a builder to build aSam2Inputwith the image.- Parameters:
image- the image- Returns:
- a new builder
-