Class Cifar10
java.lang.Object
ai.beestream.jitnn.data.Cifar10
- All Implemented Interfaces:
Dataset
CIFAR-10 from the binary distribution (
cifar-10-batches-bin: data_batch_1..5.bin and
test_batch.bin, each record a label byte and 3072 pixel bytes in CHW order). Pixels are scaled
to [0, 1] and normalised per channel with the usual means (0.4914, 0.4822, 0.4465) and standard
deviations (0.2470, 0.2435, 0.2616). No augmentation: batches come in file order.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidbatch(int b, int size, float[] x, int[] y) Copies batchbofsizesamples, in dataset order, intoxandy.intcount()The number of samples.static booleanWhetherdir, or its cifar-10-batches-bin subdirectory, holds the CIFAR-10 binary files.static Cifar10diris the directory holding cifar-10-batches-bin (or that directory itself).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
-
PIXELS
public static final int PIXELSValues per image: 3 channels of 32 x 32.- See Also:
-
images
public final float[] imagesThe images [count, 3, 32, 32], row-major. -
labels
public final int[] labelsThe class of each image. -
count
public final int countThe number of images.
-
-
Method Details
-
load
diris the directory holding cifar-10-batches-bin (or that directory itself).- Throws:
IOException
-
isPresent
Whetherdir, or its cifar-10-batches-bin subdirectory, holds the CIFAR-10 binary files. -
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.
-