I have created an ANN in Python (without libs). On beginning, it had been learned in target of solve linear problems like distinguishing between negative and positive numbers, where the layer widths were [1, 2, 1]. I have decided to learn recognizing small digits saved as 20x20 black & white PNG files. Now the array of layer widths is:
[1200, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 10]
I tried other similar ones.... With the above array of layer widths training took 8 hours (NN had seen 600.000 images from 5000 images of learning set) and when I look at results, each output is equal about 10%-15%. Nothing is certain.
and that is main code:
net = nnmv.NeuralNetwork() net.createNew([1200,100,100,100,100,100,100,100,100,100,100,100,100,10],0.15,0.07) for step in range(0,1000): for i in range(0,500): for number in range(0,10): print("Currently learning: ",number,'x',i," in step: ",step) pixels = list(Image.open("judgment/"+str(number)+'x'+str(i)+".png").convert("RGB").getdata()) output = list() for itr in range(0,number): output.append(0) output.append(1) for itr in range(0,9-number): output.append(0) net.teach(Stuff.reorganisePixelData(pixels),output) print("Error: ",net.calculateError(output)) Saver.Saver().save(net, "digitrecognizer")
There is 1200 inputs because there are 400 pixels and each pixel is saved in RGB model. Stuff.reorganisePixelData:
def reorganisePixelData(pixels): output =  for i in range(0,len(pixels)): output.append(pixels[i]) output.append(pixels[i]) output.append(pixels[i]) return output
What have I to do? Add or remove layers, change some or all of the layer widths? Or something in concept of learning?
My error calculator prints error like 0.30203135930914193, and it changes only a bit.