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

espbook

 

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


Gifts For Geeks 2024
22/11/2024

Are you ready for Thanksgiving, when overeating remorse and a surfeit of being thankful causes the unsettling thought that there are only four weeks till the Xmas break? So here is a mix of weird [ ... ]



Greenplum's Cloudberry Fork Enters Apache Incubator
17/12/2024

Cloudberry is the open source equivalent of Greenplum.
Now it is fostered by the Apache Foundation as it acquires incubating status.


More News

Last Updated ( Sunday, 12 August 2012 )