using Flux, Flux.Data.MNIST, Statistics
using Flux: onehotbatch, onecold, crossentropy, throttle
using Base.Iterators: repeated, partition
# load the images
imgs = MNIST.images()
raw_labels=MNIST.labels()
# average the values in the image
imgs0 = imgs[raw_labels .== 0]
avg_imgs0 = reduce(+, float.(imgs0))./length(imgs0)
I see that eltype(imgs[1])
is ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}}
and imgs[1]
is a 28x28 matrix. But I can’t seem to convert avg_imgs0
which has eltype
of Float
back to imgs[1]
's eltype
I tried
#import Base.ColorTypes
ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}}.(avg_imgs0)
How do I convert avg_imgs0
back to a matrix containing ColorTypes.Gray{FixedPointNumbers.Normed{UInt8,8}}
?