Package smile.vision

Class ImageDataset

java.lang.Object
smile.vision.ImageDataset
All Implemented Interfaces:
AutoCloseable, Iterable<SampleBatch>, Dataset

public class ImageDataset extends Object implements Dataset
Each of these directories should contain one subdirectory for each class in the dataset. The subdirectories are named after the corresponding class and contain all the images for that class. Ensure that each image file is named uniquely and stored in a common format such as JPEG or PNG.
  • Constructor Details

    • ImageDataset

      public ImageDataset(int batch, String root, Transform transform, ToIntFunction<String> targetTransform) throws IOException
      Constructor.
      Parameters:
      batch - the mini-batch size.
      root - the root directory of image dataset.
      transform - the transformation from image to tensor.
      targetTransform - the transform from image label to class index.
      Throws:
      IOException - if the root directory doesn't exist or doesn't have images.
  • Method Details