I'm working with the package 'pybrain' and trying to build a neural network that will recognize images. The part of analyzing the photo is working very well, but as one who is new to pybrain- I'm not used to working with it. Somehow I keep getting the following error:
AttributeError: 'NoneType' object has no attribute 'indim'
I've tried to solve this problem like a day or so and still doesn't get it. here's part of my code:
target=np.array([[0],[1]])
input=getNumberOfImages("photosAfterAverage/",1,2)
ds=SupervisedDataSet(72,1)
ds.setField('target',target)
ds.setField('input',input)
print ds.data
net=buildNewNetwork(72,76,1)
trainer = BackpropTrainer(net, ds)
Assume that input is a 2 dimensional containg each cell 72 cells.
Edit: As requested, the whole error:
Traceback (most recent call last):
File "C:\Users\Eytan\Desktop\Mah\Kids_Painting\pyBrainDiffrenceBetween5GradeAnd2Grade.py", line 53, in <module>
trainer = BackpropTrainer(net, ds)
File "C:\Python27\pybrain\supervised\trainers\backprop.py", line 35, in __init__
self.setData(dataset)
File "C:\Python27\pybrain\supervised\trainers\trainer.py", line 22, in setData
assert dataset.indim == self.module.indim
AttributeError: 'NoneType' object has no attribute 'indim'
It may be helpful to point out that the following code is working:
net=buildNetwork(2,500,1)
ds=SupervisedDataSet(2,1)
input=array([[0,1],[1,3434],[34,65],[40,56]])
target=array([[0],[1],[0],[1]])
ds.setField('input',input)
ds.setField('target',target)
print ds.data
trainer = BackpropTrainer(net, ds)
Thanks very much for answering, I found the problem- the right function that should have been used is buildNetwork instead of buildNewNetwork.