Class CocoDetection

  • All Implemented Interfaces:
    ai.djl.training.dataset.Dataset

    public class CocoDetection
    extends ObjectDetectionDataset
    Coco image detection dataset from http://cocodataset.org/#home.

    Each image might have different Shapes.

    • Field Summary

      • Fields inherited from class ai.djl.training.dataset.RandomAccessDataset

        dataBatchifier, device, labelBatchifier, limit, pipeline, prefetchNumber, sampler, targetPipeline
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected long availableSize()
      static CocoDetection.Builder builder()
      Creates a builder to build a CocoDetection.
      protected ai.djl.modality.cv.Image getImage​(long index)
      Returns the image at the given index in the dataset.
      java.util.Optional<java.lang.Integer> getImageHeight()
      Returns the height of the images in the dataset.
      java.util.Optional<java.lang.Integer> getImageWidth()
      Returns the width of the images in the dataset.
      ai.djl.util.PairList<java.lang.Long,​ai.djl.modality.cv.output.Rectangle> getObjects​(long index)
      Returns the list of objects in the image at the given index.
      void prepare​(ai.djl.util.Progress progress)
      • Methods inherited from class ai.djl.training.dataset.RandomAccessDataset

        getData, getData, getData, getData, randomSplit, size, subDataset, toArray
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ai.djl.training.dataset.Dataset

        prepare
    • Method Detail

      • getObjects

        public ai.djl.util.PairList<java.lang.Long,​ai.djl.modality.cv.output.Rectangle> getObjects​(long index)
        Returns the list of objects in the image at the given index.
        Specified by:
        getObjects in class ObjectDetectionDataset
        Parameters:
        index - the index (if the dataset is a list of data items)
        Returns:
        the list of objects in the image. The long is the class number of the index into the list of classes of the desired class name. The rectangle is the location of the object inside the image.
      • prepare

        public void prepare​(ai.djl.util.Progress progress)
                     throws java.io.IOException
        Throws:
        java.io.IOException
      • availableSize

        protected long availableSize()
        Specified by:
        availableSize in class ai.djl.training.dataset.RandomAccessDataset
      • getImage

        protected ai.djl.modality.cv.Image getImage​(long index)
                                             throws java.io.IOException
        Description copied from class: ImageDataset
        Returns the image at the given index in the dataset.
        Specified by:
        getImage in class ImageDataset
        Parameters:
        index - the index (if the dataset is a list of data items)
        Returns:
        the image
        Throws:
        java.io.IOException - if the image could not be loaded
      • getImageWidth

        public java.util.Optional<java.lang.Integer> getImageWidth()
        Returns the width of the images in the dataset.
        Specified by:
        getImageWidth in class ImageDataset
        Returns:
        the width of the images in the dataset
      • getImageHeight

        public java.util.Optional<java.lang.Integer> getImageHeight()
        Returns the height of the images in the dataset.
        Specified by:
        getImageHeight in class ImageDataset
        Returns:
        the height of the images in the dataset