public class MnistImageFile extends MnistDbFile
| Constructor and Description |
|---|
MnistImageFile(String name,
String mode)
Creates new MNIST database image file ready for reading.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getCols()
Number of columns per image.
|
int |
getEntryLength()
Number of bytes for each entry.
|
int |
getHeaderSize() |
protected int |
getMagicNumber()
MNIST DB files start with unique integer number.
|
int |
getRows()
Number of rows per image.
|
void |
nextImage()
Move the cursor to the next image.
|
void |
prevImage()
Move the cursor to the previous image.
|
int[][] |
readImage()
Reads the image at the current position.
|
byte[][] |
readImagesUnsafe(int nImages)
Read the specified number of images from the current position, to a byte[nImages][rows*cols]
Note that MNIST data set is stored as unsigned bytes; this method returns signed bytes without conversion
(i.e., same bits, but requires conversion before use)
|
getCount, getCurrentIndex, next, prev, setCurrentIndexclose, 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, writeUTFpublic MnistImageFile(String name, String mode) throws IOException
name - the system-dependent filenamemode - the access modeIOExceptionFileNotFoundExceptionpublic int[][] readImage()
throws IOException
IOExceptionpublic byte[][] readImagesUnsafe(int nImages)
throws IOException
nImages - Number of imagesIOExceptionpublic void nextImage()
throws IOException
IOExceptionpublic void prevImage()
throws IOException
IOExceptionprotected int getMagicNumber()
MnistDbFilegetMagicNumber in class MnistDbFilepublic int getRows()
public int getCols()
public int getEntryLength()
MnistDbFilegetEntryLength in class MnistDbFilepublic int getHeaderSize()
getHeaderSize in class MnistDbFileCopyright © 2016. All Rights Reserved.