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

public class DetectedObjects extends Classifications
A class representing the detected objects results for a single image in an Application.CV.OBJECT_DETECTION case.
See Also:
  • 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 detected
      probabilities - the probability of the objects that were detected
      boundingBoxes - the bounding boxes of the objects that were detected
  • Method Details

    • item

      public <T extends Classifications.Classification> T item(int index)
      Returns the item at a given index based on the order used to construct the Classifications.
      Overrides:
      item in class Classifications
      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