What's the difference between loading mnist.hdf5 manually and with MNIST() ?

87 views
Skip to first unread message

Samy Melaine

unread,
Dec 4, 2015, 6:06:07 AM12/4/15
to fuel-users
I was running [blocks' tutorial code](https://blocks.readthedocs.org/en/latest/tutorial.html) code (wich you can find [here](https://gist.github.com/SamyMe/2cfcfa50bdb3d72af8a3) ) and it is running perfectly.

But, when I change the dataset loading methode (for train and test) from:

    mnist_test = MNIST(("test",))

to:

    mnist_test = H5PYDataset('../mnist.hdf5', which_sets=("test",))


The code still works but I get awful training results !
So what differs? Am I missing some attributes to the H5PYDataset()?

Samy Melaine

unread,
Dec 4, 2015, 10:08:31 AM12/4/15
to fuel-users
I've got the answer from reddit:

[–]NasenSpray 

I've never used blocks or fuel. But it's open source, so...

  1. open fuel/datasets/mnist.py
  2. notice line 27:
    default_transformers = uint8_pixels_to_floatX(('features',))
  3. open fuel/transformers/defaults.py
  4. read the definition of uint8_pixels_to_floatX
  5. infer that you're missing a cast to floatX (Theano's float type) and a division by 255 (normalization) on the input features
Reply all
Reply to author
Forward
0 new messages