Search code examples
neural-networkpattern-recognitiontraining-data

Training for pattern recognition (neural network)


How do you train Neural Network for pattern recognition? For example a face recognition in a picture how would you define the output neurons? (eg. how to detect where is the face exactly, rather than just saying that there is a face in camera). Also, how about detecting multiple faces and different size of faces?

If anyone could give me a pointer it would be really great

Cheers!


Solution

  • Generally speaking I would split the problem into multiple stages e.g.

    1 - Is there a face in the picture?

    2 - Where is the face in the picture?

    3 - Is the face in the picture one that the NN (Neural network) recognises?

    In each instance I would suggest you build a separate NN and train it to answer the questions posed.

    As for the structure of the NN, that's a bit trickier to answer as it depends on your input data and desired output. For example if you had a 100x100 px image then I suppose its feasible to have 10,000 inputs. You might want to consider doing some preprocessing before hand to say detect ovals that way you could look and see if there are a number of ovals in a predictable outline (1 for the face, 2 for the eyes, and one for the mouth possibly). If you are preprocessing the data then you might have inputs for each oval.

    Now for the output... for question one you could just have one output to say how sure the NN is that there is a face in the input data i.e a valuer of 0.0 (defiantly no face) --> 1.0 (defiantly a face). This way you can move onto stages 2 and 3.

    I might say at this point that this is a non-trivial problem and you might be better to have a look at some of the frameworks available e.g. OpenCV

    Now for the training part, you need to have a stockpile of images available to train the NN. There are a number of ways in which you could train the NN. One potential solution is to use a technique called back propagation 1, 2. In general terms, you use the NN on an image and compare it to a predetermined output. If its wrong tweak the NN to produce the desired output and repeat.

    If you want a good book on AI, then I would highly recommend Artificial Intelligence: A Modern Approach by Russell and Norvig. Im sure that there are more appropriate Computer Vision textbooks, but the Russell & Norvig book is an excellent starter.