Class MnistImageFile

    • Method Detail

      • readImage

        public int[][] readImage()
                          throws IOException
        Reads the image at the current position.
        Returns:
        matrix representing the image
        Throws:
        IOException
      • readImagesUnsafe

        public byte[][] readImagesUnsafe​(int nImages)
                                  throws IOException
        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)
        Parameters:
        nImages - Number of images
        Throws:
        IOException
      • nextImage

        public void nextImage()
                       throws IOException
        Move the cursor to the next image.
        Throws:
        IOException
      • prevImage

        public void prevImage()
                       throws IOException
        Move the cursor to the previous image.
        Throws:
        IOException
      • getMagicNumber

        protected int getMagicNumber()
        Description copied from class: MnistDbFile
        MNIST DB files start with unique integer number.
        Specified by:
        getMagicNumber in class MnistDbFile
        Returns:
        integer number that should be found in the beginning of the file.
      • getRows

        public int getRows()
        Number of rows per image.
        Returns:
        int
      • getCols

        public int getCols()
        Number of columns per image.
        Returns:
        int
      • getEntryLength

        public int getEntryLength()
        Description copied from class: MnistDbFile
        Number of bytes for each entry. Defaults to 1.
        Overrides:
        getEntryLength in class MnistDbFile
        Returns:
        int