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,java.io.Serializable
public class DetectedObjects extends Classifications
A class representing the detected objects results for a single image in anApplication.CV.OBJECT_DETECTIONcase.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDetectedObjects.DetectedObjectADetectedObjectrepresents a single potential detected Object for an image.-
Nested classes/interfaces inherited from class ai.djl.modality.Classifications
Classifications.Classification, Classifications.ClassificationsSerializer
-
-
Field Summary
-
Fields inherited from class ai.djl.modality.Classifications
classNames, probabilities
-
-
Constructor Summary
Constructors Constructor Description DetectedObjects(java.util.List<java.lang.String> classNames, java.util.List<java.lang.Double> probabilities, java.util.List<BoundingBox> boundingBoxes)Constructs a DetectedObjects, usually during post-processing.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetNumberOfObjects()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.java.lang.StringtoJson()-
Methods inherited from class ai.djl.modality.Classifications
best, ensembleWith, get, getAsString, getClassNames, getProbabilities, items, setTopK, toByteBuffer, 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
-
-
-
-
Constructor Detail
-
DetectedObjects
public DetectedObjects(java.util.List<java.lang.String> classNames, java.util.List<java.lang.Double> probabilities, java.util.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 Detail
-
item
public <T extends Classifications.Classification> T item(int index)
Returns the item at a given index based on the order used to construct theClassifications.- Overrides:
itemin 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
-
toJson
public java.lang.String toJson()
- Specified by:
toJsonin interfaceai.djl.util.JsonSerializable- Overrides:
toJsonin classClassifications
-
-