GithubHelp home page GithubHelp logo

genetic-imaging's Introduction

Genetic Imaging

A genetic algorithm that reproduces an image from scratch!

But why?

  • It's a simple project of mine that was elaborated in about a day (but I will continue it cause it's really fun). These already exist, and there are tons on the internet that you can check out that are probably better than mine.
  • Yea it's fun.

Some examples

Since there are a few parameters that can be tweaked on, results may differ, and the bigger your population size and number of epochs, the longer it will take to generate the output image.

I believe this one took less than a minute.cute cats
These roughly took, respectively: 0.5s, 2s, 5s, 9 min, 7 years (had to google it lol).enter image description here
These one was just for curiosity sake: it took like 8 hours or so.enter image description here

You can experiment it yourself by changing the parameters and using your own images.

How to run? It's quite simple :).

  1. You can clone this repository by doing:

https://github.com/thiagop-usp/Genetic-Imaging.git

  1. After that, you will need some python3 libraries, so you can run:

pip3 install -r requirements.txt

  1. Then make sure you're running it with Python 3.7 (f-strings are the best):

python3 genetic.py

Improvements yet to be done:

  • Code is kind bad. It can be much better modularized.
  • It's quite slow, some things can be changed when calculating the fitness.
  • There are much better ways to reproduce the individuals (and some better ways to maintain good ones
  • The idea of mutation is very important here, but I didn't use it.
  • Make the progress and estimated time better to understand haha.
  • Make it work to grayscale and RGB as well. As of right now it's only black and white, and if you tweak the code around it won't work.
  • Video mode: it will create a timelapse.

Updates:

  • Works with greyscale now. RGB still in progress.
  • RGB and Rectangles are giving me lots of bugs, not working well yet =(.

genetic-imaging's People

Contributors

tprei avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.