Package smile.vision
Class ImageDataset
java.lang.Object
smile.vision.ImageDataset
- All Implemented Interfaces:
AutoCloseable
,Iterable<SampleBatch>
,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 Summary
ConstructorDescriptionImageDataset
(int batch, String root, Transform transform, ToIntFunction<String> targetTransform) Constructor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
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
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
size
public long size()Description copied from interface:Dataset
Returns the size of dataset. -
iterator
- Specified by:
iterator
in interfaceIterable<SampleBatch>
-