Package ai.djl.modality.cv.output
Class DetectedObjects
java.lang.Object
ai.djl.modality.Classifications
ai.djl.modality.cv.output.DetectedObjects
- All Implemented Interfaces:
BytesSupplier
,Ensembleable<Classifications>
,ai.djl.util.JsonSerializable
,Serializable
A class representing the detected objects results for a single image in an
Application.CV.OBJECT_DETECTION
case.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
ADetectedObject
represents a single potential detected Object for an image.Nested classes/interfaces inherited from class ai.djl.modality.Classifications
Classifications.Classification
Nested classes/interfaces inherited from interface ai.djl.util.JsonSerializable
ai.djl.util.JsonSerializable.Serializer
-
Field Summary
Fields inherited from class ai.djl.modality.Classifications
classNames, probabilities, topK
-
Constructor Summary
ConstructorsConstructorDescriptionDetectedObjects
(List<String> classNames, List<Double> probabilities, List<BoundingBox> boundingBoxes) Constructs a DetectedObjects, usually during post-processing. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of objects found in an image.<T extends Classifications.Classification>
Titem
(int index) Returns the item at a given index based on the order used to construct theClassifications
.Methods inherited from class ai.djl.modality.Classifications
best, ensembleWith, get, getClassNames, getProbabilities, items, serialize, setTopK, topK, topK, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ai.djl.ndarray.BytesSupplier
getAsBytes, getAsObject
Methods inherited from interface ai.djl.util.JsonSerializable
getAsString, toByteBuffer, toJson
-
Constructor Details
-
DetectedObjects
public DetectedObjects(List<String> classNames, List<Double> probabilities, List<BoundingBox> boundingBoxes) Constructs a DetectedObjects, usually during post-processing.All three inputs(classNames, probabilities, boundingBoxes) should be parallel lists.
- Parameters:
classNames
- the names of the objects that were detectedprobabilities
- the probability of the objects that were detectedboundingBoxes
- the bounding boxes of the objects that were detected
-
-
Method Details
-
item
Returns the item at a given index based on the order used to construct theClassifications
.- Overrides:
item
in classClassifications
- Type Parameters:
T
- the type of classification item for the task- Parameters:
index
- the index of the item to return- Returns:
- the item at the given index, equivalent to
classifications.items().get(index)
-
getNumberOfObjects
public int getNumberOfObjects()Returns the number of objects found in an image.- Returns:
- the number of objects found in an image
-