Class PikachuDetection

java.lang.Object
ai.djl.training.dataset.RandomAccessDataset
All Implemented Interfaces:
ai.djl.training.dataset.Dataset

public class PikachuDetection extends ObjectDetectionDataset
Pikachu image detection dataset that contains multiple Pikachus in each image.

It was based on a section from the [Dive into Deep Learning book](http://d2l.ai/chapter_computer-vision/object-detection-dataset.html). It contains 1000 Pikachu images of different angles and sizes created using an open source 3D Pikachu model. Each image contains only a single pikachu.

  • Constructor Details

  • Method Details

    • builder

      public static PikachuDetection.Builder builder()
      Creates a new builder to build a PikachuDetection.
      Returns:
      a new builder
    • prepare

      public void prepare(ai.djl.util.Progress progress) throws IOException
      Throws:
      IOException
    • getObjects

      public ai.djl.util.PairList<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.
    • getClasses

      public List<String> getClasses()
      Returns the classes that detected objects in the dataset can be classified into.
      Specified by:
      getClasses in class ObjectDetectionDataset
      Returns:
      the classes that detected objects in the dataset can be classified into.
    • 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 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:
      IOException - if the image could not be loaded
    • getImageWidth

      public Optional<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 Optional<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