I’ve been enjoying xmas holidays doing some machine learning and Neural Network programming, in the general context of ‘Target Recognition’, more specifically, trying to teach my computer how to decide whether a person in an image is male or female.
This type of task, being very easy for humans (at least those of us who do not substribe to all the modern gender ‘science’ theories claiming that there’s no difference between men and women) happens to be very difficult for computers, and extremely difficult to do with traditional, deterministic, algorithmic approaches. So, I decided to attack this problem by using raw computing power, evolution theory and Neural Networks/A.I. instead of the traditional approach.
Thus, the task at hand was to teach my computer to determine whether a face is male or female. To do so, I randomly selected a ‘training set’ of images for my computer to analyze, where the only thing I told the program was whether the face was male or female. Then, I told the program to repetedly search for coeffients for my Neural Network (a 100 x 10 x 1 ) fully connected network, coefficients for the various weights and seed numbers, until a satisfactory solution was (hopefully) found.
The images above are examples of the images I used for input to my program, however, these images above are 100×100 pixels, and to keep my program’s performance requirements within reasonable limits, I scaled down each of the images to 10×10, that is, to just 100 pixels per image.
Below such an image:
The basic structure of my program is that the neural network’s 100 input nodes each receive a pixel, and that pixel is broadcasted to all the active, ‘hidden’ nodes at level 2, where initally random weights are applied to each signal, and the sum of all these signals is passed thru a Sigmoid filter. After each iteration, the weights of the active nodes are adjusted by a fitness/evaluation function, where a ‘steepest decent‘ algorithm is used to provide new parameters to the next iteration.
Based on about 100 of these tiny images, my neural network program started to analyze the images for any patterns that would enable it to determine whether the image represented a woman or a man.
Success would be defined by my program being able providing a clear separation of these two types of targets, without any overlaps, that is, whether the program would be capable of placing women into one category, and men into an other.
The graph below shows that the program indeed succeed doing so: the top chart displays the evolution of the ‘error level’, i.e. the frequency of ‘wrong calls’ in correctly identifying the target as male or female, over a number of iterations. As can be seen, the program converges fairly quickly to a low level of wrong calls.
The bottom part of the graph shows the results of the desired separation: the two genders are clearly separated, with no overlap.
I still have a bit of work to do on the Sigmoid filter that provides the final numeric value for the separation – ideally the two groups would be farther away from each other on the x-axis scale, but that’s (hopefully) just a bit of tuning of the coefficients of the program.
The above graph shows a complete separation of categories, which appears quite surprising, considering the very limited amount of ‘training’ – 100 images – that my neural network was subjected to. The reason for this ‘100%’ success rate is that the above graph only includes images that were part of the training set, meaning that the algorithms are able to fairly quickly detect significant patterns that apply specifically to the set.
To investigate how generally accurate the network is, I added a number of pictures that were not part of the training session, and now we can see some spread: there are some males ending up in the female category, and vice versa, but still, overall, specifically considering the very limited training set, the program performs remarkably well:
Perhaps there were some androgyne persons in the testset… ? 🙂