load data

This commit is contained in:
Mike J Innes 2018-01-17 16:39:55 +00:00
parent bd57359535
commit 72eabde373

View File

@ -81,6 +81,7 @@ Returns the 60,000 training images by default; pass `:test` to retreive the
10,000 test images. 10,000 test images.
""" """
function images(set = :train) function images(set = :train)
load()
io = IOBuffer(read(set == :train ? TRAINIMAGES : TESTIMAGES)) io = IOBuffer(read(set == :train ? TRAINIMAGES : TESTIMAGES))
_, N, nrows, ncols = imageheader(io) _, N, nrows, ncols = imageheader(io)
[rawimage(io) for _ in 1:N] [rawimage(io) for _ in 1:N]
@ -97,6 +98,7 @@ Returns the 60,000 training labels by default; pass `:test` to retreive the
10,000 test labels. 10,000 test labels.
""" """
function labels(set = :train) function labels(set = :train)
load()
io = IOBuffer(read(set == :train ? TRAINLABELS : TESTLABELS)) io = IOBuffer(read(set == :train ? TRAINLABELS : TESTLABELS))
_, N = labelheader(io) _, N = labelheader(io)
[rawlabel(io) for _ = 1:N] [rawlabel(io) for _ = 1:N]