How To Breed A Face
Written by Alex Armstrong   
Sunday, 12 August 2012

The genetic algorithm is a way to create solutions to problems by mimicking the way that nature works. However, that doesn't mean it can't be fun! Pareidoloop is a program which uses a GA approach to create a face that satisfies a face recognition algorithm - and all using JavaScript.

The basic idea of the GA is simple enough. Start with a representation of a solution as a sequence of bits that can be combined in the same way as DNA, i.e. using exchange and mutation. Next set up a population of solutions and test them against the problem. Finally weed out the poor performers and allow the best of the rest to mix their genetic material to product the next generation of solutions.

If you go through enough generations the solutions should keep getting better as the population evolves towards a better fitness.

pareidoloop

Image:Philip Mccarthy

 

This is the idea behind Pareidoloop. It uses a face detection program written in JavaScript. This is taken from Liu Liu's  Core Computer Vision library which provides a range of image processing algorithms as well as face detection and is well worth knowing about.

Next code up a way to generate random polygons such that the representation can take part in the GA. This part of the program is based on an earlier experiment with trying to breed the Mona Lisa - see Roger Alsing’s Evolution of Mona Lisa.

All you have to do next is to run the GA and use the output of the face detection program as the measure of fitness of each individual in the population. Keep the generations turning over and eventually you will reach a reasonable arrangement of polygons which activates the face detection algorithm - i.e. it looks like a face.

Why Pareidoloop?

This is the term for the phenomenon of seeing things like faces in random textures. I'm not sure that this is quite Pareidoloop in that the input isn't random as it is being designed for the purpose.

Is there any purpose to this?

Unlikely, but it is a good demonstration of the GA in action and the images it creates are kind of spooky. There might be a call for artistic renderings of the eigenface of face detection, but mostly it's just fun.

 

More Information

Pareidoloop

Code on GitHub

Related Articles

The Genetic Algorithm (program)
Genetic Algorithms (Theory)

Face Recognition

AI Can Find Long Lost Relatives

raspberry pi books

 

Comments




or email your comment to: comments@i-programmer.info

To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin,  or sign up for our weekly newsletter.

 

Banner


WasmCon 2023 Sessions Now Online
01/03/2024

The recorded session of the premier conference for technical developers and users interested in exploring the potential of WebAssembly are now online.



Stack Overflow On Google Cloud
06/03/2024

Stack Overflow and Google Cloud have announced a partnership to deliver new gen AI-powered capabilities to developers through the Stack Overflow platform, Google Cloud Console, and Gemini for Google C [ ... ]


More News

Last Updated ( Sunday, 12 August 2012 )