Class MnistLabelFile
- java.lang.Object
-
- java.io.RandomAccessFile
-
- org.deeplearning4j.datasets.mnist.MnistDbFile
-
- org.deeplearning4j.datasets.mnist.MnistLabelFile
-
- All Implemented Interfaces:
Closeable
,DataInput
,DataOutput
,AutoCloseable
public class MnistLabelFile extends MnistDbFile
MNIST database label file.
-
-
Constructor Summary
Constructors Constructor Description MnistLabelFile(String name, String mode)
Creates new MNIST database label file ready for reading.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
getMagicNumber()
MNIST DB files start with unique integer number.int
readLabel()
Reads the integer at the current position.int[]
readLabels(int num)
Read the specified number of labels from the current position-
Methods inherited from class org.deeplearning4j.datasets.mnist.MnistDbFile
getCount, getCurrentIndex, getEntryLength, getHeaderSize, next, prev, setCurrentIndex
-
Methods inherited from class java.io.RandomAccessFile
close, getChannel, getFD, getFilePointer, length, read, read, read, readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, seek, setLength, skipBytes, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
-
-
-
-
Constructor Detail
-
MnistLabelFile
public MnistLabelFile(String name, String mode) throws IOException
Creates new MNIST database label file ready for reading.- Parameters:
name
- the system-dependent filenamemode
- the access mode- Throws:
IOException
FileNotFoundException
-
-
Method Detail
-
readLabel
public int readLabel() throws IOException
Reads the integer at the current position.- Returns:
- integer representing the label
- Throws:
IOException
-
readLabels
public int[] readLabels(int num) throws IOException
Read the specified number of labels from the current position- Throws:
IOException
-
getMagicNumber
protected int getMagicNumber()
Description copied from class:MnistDbFile
MNIST DB files start with unique integer number.- Specified by:
getMagicNumber
in classMnistDbFile
- Returns:
- integer number that should be found in the beginning of the file.
-
-