Skip to content

Evolutionary algorithm for reproducing pictures, written in Golang

Notifications You must be signed in to change notification settings

LukeBriggsDev/EARP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EARP: Evolutionary Algorithm for Reproducing Pictures

Darwin normal Darwin earp

Mona Lisa normal Mona Lisa earp

EARP is a program that uses evolutionary algorithm techniques to recreate an image using a limited number of semi-transparent polygons. The recreation images you see above has just 100 polygons in it!.

Backstory

EARP is a spin-off from a second year University project that I felt deserved a bit more than what was on the brief.

The original project used the DEAP library and was implemented in python. The tuning of variables and for efficiencies was calculated using this implementation but, in car parlance, there's no replacement for displacement.

So a rewrite in Golang commenced and this is what I present to you.

Installation

Clone the Repo

git clone https://github.com/LukeBriggsDev/EARP

Fetch Dependencies

cd EARP go get

Build Binary

go build

Usage

evolution.mp4

earp image_path no_of_polygons no_gens

Example

earp images/darwin.png 100 1000

Results

Here are some results after running the algorithm for 10,000 generations (Approx. 10 minutes on an 8-core M1 Pro) and limiting solutions to less than 100 polygons.

Image 1 Image 1 earp

Generations: 10,000

Fitness: 97.1%

Image 2 Image 2 earp

Generations: 10,000

Fitness: 95.2%

Here is a slightly harder image that was run for 20,000 generations

Image 2 Image 2 earp

Generations: 20,000

Fitness: 94.8%

About

Evolutionary algorithm for reproducing pictures, written in Golang

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages