Class Mnist
java.lang.Object
ai.beestream.jitnn.data.Mnist
- All Implemented Interfaces:
Dataset
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidbatch(int b, int size, float[] x, int[] y) Copies batchb(of sizesize) of images intoxand labels intoy.intcount()The number of samples.static booleanWhetherdirholds the MNIST training images (plain or gzipped).static MnistPixels normalised with MNIST's mean and standard deviation (0.1307, 0.3081).static MnistWithunit, pixels are raw / 255 in [0, 1] (targets for generative models); otherwise normalised.voidsample(int i, float[] x, int xAt, int[] y, int yAt) Copies sampleiintoxatxAtand its label intoyatyAt(DataLoaderassembles shuffled batches with it).int[]The shape of one sample, e.g. {1, 28, 28} or {3, 32, 32}.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Dataset
sampleSize
-
Field Details
-
images
public final float[] imagesThe images [count, 28 * 28], row-major. -
labels
public final int[] labelsThe digit of each image. -
count
public final int countThe number of images. -
PIXELS
public static final int PIXELSPixels per image.- See Also:
-
-
Method Details
-
load
Pixels normalised with MNIST's mean and standard deviation (0.1307, 0.3081).- Throws:
IOException
-
load
Withunit, pixels are raw / 255 in [0, 1] (targets for generative models); otherwise normalised.- Throws:
IOException
-
isPresent
Whetherdirholds the MNIST training images (plain or gzipped). -
count
-
sampleShape
public int[] sampleShape()Description copied from interface:DatasetThe shape of one sample, e.g. {1, 28, 28} or {3, 32, 32}.- Specified by:
sampleShapein interfaceDataset
-
batch
-
sample
public void sample(int i, float[] x, int xAt, int[] y, int yAt) Description copied from interface:DatasetCopies sampleiintoxatxAtand its label intoyatyAt(DataLoaderassembles shuffled batches with it). The default copies throughDataset.batch(int, int, float[], int[])of size 1.
-