Skip to content

Single Python Script to mutate polygons and evaluate their fitness based on a target image.

Notifications You must be signed in to change notification settings

James-02/image-evolution

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Evolution with Python DEAP

Evolutionary algorithm written in Python using DEAP and Pillow to evaluate an image and mutate an array of polygons over generations to gradually increase fitness; the algorithm will generate a final image and graphed statistics after the set number of generations.

Requirements

  • Python3.6+

Setup & Run

git clone [email protected]:James-02/image-evolution.git
cd image-evolution
python3.6 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python main.py 0

Add a new image to test against

  • Add a 200x200px .png image to the media directory
  • Update config.json's "Image" parameter:
"Image": {
        "TARGET_IMAGE": "media/target-image-1.png"
}

Run Configurations

python main.py <code>
        0 - Reference algorithm
        1 - Solution Representation
        2 - Offspring Generation
        3 - Selection Function

Example Timelapse

Image Generation Timelapse

Timelapse was created externally using images generated by this algorithm

About

Single Python Script to mutate polygons and evaluate their fitness based on a target image.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages