How to adjust my data to use in Theano?

Asked

Viewed 74 times

1

I’m following the blog book tutorial http://neuralnetworksanddeeplearning.com/ and would like to apply the codes in my own image dataset.

Since I don’t know much about python, I did some research and found that I needed to put my data in a multidimensional array as in the code below:

import pickle
import Image
import numpy as np
def generateDataset(filesDir):
   x = np.asarray([np.asarray(Image.open(fname)) for fname in filesDir]) #gera array com todas images
   with open('dataset.pickle', 'wb') as handle:
       pickle.dump( x, handle, protocol=2) #salva como .pkl

However, when I loaded the file using cPickle and sent as parameter of the method used in the examples, I get the error:

The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

What makes me believe that this is not the correct way to adapt my data to those used in the code. Does anyone know how to tailor my data to the one used in this example, or how to use my own dataset on Theano?

Some extra information: The dataset used in the book is mnist and my images are 320x320 gray level.

Note: The github with the codes used are on the first link

Thanks in advance.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.