class Rbmnist::MNIST::Train
Constants
- IMAGE_COUNT
Public Class Methods
images()
click to toggle source
# File lib/rbmnist/mnist.rb, line 72 def self.images if @@images.length == 0 img_bytes = unzip_from_path(__dir__ + '/../../data/train-images-idx3-ubyte.gz') curr_byte = 16 @@images = Array.new(IMAGE_COUNT) do |pic| Rbmnist::ImageWrapper.new(img_bytes[curr_byte...(curr_byte += 784)]) end end @@images end
labels()
click to toggle source
# File lib/rbmnist/mnist.rb, line 83 def self.labels if @@labels.length == 0 label_bytes = unzip_from_path(__dir__ + '/../../data/train-labels-idx1-ubyte.gz') curr_byte = 8 @@labels = Array.new(IMAGE_COUNT) do |label| label_bytes[curr_byte...(curr_byte += 1)].first end end @@labels end