Git Product home page Git Product logo

ganbreeder's Introduction

Ganbreeder

Ganbreeder is a collaborative art tool for discovering images. Images are 'bred' by having children, mixing with other images and being shared via their URL. This is an experiment in using breeding + sharing as methods of exploring high complexity spaces. GAN's are simply the engine enabling this. Ganbreeder is very similar to, and named after, Picbreeder. It is also inspired by an earlier project of mine Facebook Graffiti which demonstrated the creative capacity of crowds.Ganbreeder uses these models.

This code was made in a weekend and hasn't been cleaned up or documented yet. There are also improvements to make to scalability.

Pull request are more than welcome :)

How to use

Prerequisites

  • Install Python 3 + pip (for the GAN server)
  • Install NodeJS + npm (for the frontend)
  • Install a PostgreSQL server

Launch the GAN server

cd gan_server
# Install dependencies
pip install -r requirements.txt
# And go...
python server.py

Your GAN server is available at http://localhost:5000/

Configure the frontend

For quick hacking, if you have Docker at your disposal, you can spawn a PostgreSQL database like so:

docker run -p 5432:5432 --name ganbreederpostgres -e POSTGRES_PASSWORD=ganbreederpostgres -d postgres

With that simple scenario, the database and user would be postgres and the password would be ganbreederpostgres

Copy the file server/example_secrets.js to secrets.js and modify it to fit your environment.

Launch the frontend

cd server
npm install
# Create the database structure
node_modules/knex/bin/cli.js migrate:latest
# Generate the first images
node make_randoms.js
# Generate a cache of image keys for the front page (do it every time you want to update the front page)
node updatecache.js
# And go...
node server.js

Your frontend is available at http://localhost:8888/

docker-compose setup

Make sure that docker and docker-compose are installed.

Start the containers:

docker-compose up

Your frontend is available at http://localhost:8888/, backend at http://localhost:5000/. Initial backend setup can take few minutes.

If this is the first time you are running the project you might want to generate some random images:

docker-compose exec server node make_randoms.js

Restart only frontend server (to avoid backend initialization wait):

docker-compose restart server

ganbreeder's People

Contributors

ilesinge avatar joel-simon avatar mermop avatar sarunasazna avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ganbreeder's Issues

How do we change the path s3

I have already change the path of s3 and bucket name, but when i run the node make_random.js its still getting files from some other place.

View raw vectors for starred images

Before the latest redesign, it was possible to get the raw z and label vectors for an image. I'd love to have that functionality restored so that I can take images generated by ganbreeder and continue to tweak them with my own code.

Can't run ganbreeder with docker_compose

Trying to run it using docker_compose on Windows 7 (with Docker Toolbox).

I'm getting these errors:

server_1      | mkdir: cannot create directory 'public/img': No such file or directory
ganbreeder-master_server_1 exited with code 1
gan_server_1  | python: can't open file 'server.py': [Errno 2] No such file or directory
ganbreeder-master_gan_server_1 exited with code 2

Any ideas on how to resolve this?

Add Our Own Images?

Same question as the title, is there any way we can add our own images for ganbreeder to utilize?

Increase image resolution to 512x512?

Not at all understanding the internals, but tried replacing:

https://tfhub.dev/deepmind/biggan-256/2

with:

https://tfhub.dev/deepmind/biggan-512/2

on a local Windows10 install, I see this;

PS C:\Users\Chad\ganbreeder\gan_server> python .\server.py
Loading BigGAN module from: https://tfhub.dev/deepmind/biggan-512/2
2018-12-20 15:26:56.311724: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
port= 5000
 * Serving Flask app "server" (lazy loading)
 * Environment: production
   WARNING: Do not use the development server in a production environment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Restarting with stat
Loading BigGAN module from: https://tfhub.dev/deepmind/biggan-512/2
2018-12-20 15:27:09.644649: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
port= 5000
 * Debugger is active!
 * Debugger PIN: 113-412-377
 * Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
children
Cannot feed value of shape (10, 140) for Tensor 'z:0', which has shape '(?, 128)'
127.0.0.1 - - [20/Dec/2018 15:27:46] "�[1m�[35mPOST /children HTTP/1.1�[0m" 500 -

other models to be used in ganbreeder

Hi,

is there a way to use my own trained model in ganbreeder?
do I just change the reference in the ganbreeder ganserver.py.

it would be very interesting to be able to utilize my own trained model.
which is being created for a master thesis in graphical design.

thnx in advance Kris

How can I upload two image for this method?

@app.route('/mix_images', methods=['POST'])
def mix_images():
try:
label1 = np.asarray(json.loads(request.form['label1']), dtype='float64')
label2 = np.asarray(json.loads(request.form['label2']), dtype='float64')
vector1 = np.asarray(json.loads(request.form['vector1']), dtype='float64')
vector2 = np.asarray(json.loads(request.form['vector2']), dtype='float64')

ganbreeder provides similar function like artbreeder?

Hello,
The artbreeder provides perfect result for face morphing.
I have hundreds of image pairs, and looking for 'local' solution for do it.
Can I install ganbreeder and morph three images (portraits) just like artbreeder?

Tensorflow and javascript errors, configuration issue ?

Hello guys,

I'm trying to make this thing working by following the readme but I get stuck at some point.
I'm using
Ubuntu 18.04
Python 3.6.9
Tensorflow 1.12

It seems to fail when I run

node make_randoms.js

and I'm having difficulties pin pointing the reason.
Maybe it comes from my server/secrets.js file? I have to admit that I'm not sure what value I should put for

connection: {
            host: "",

and I left it empty.

Anyway, here is the log from the server.py:

 * Debugger is active!
 * Debugger PIN: 558-604-792
127.0.0.1 - - [12/Feb/2022 21:31:54] "GET / HTTP/1.1" 200 -
Random 24
2022-02-12 21:49:37.006871: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 0, topological sort failed with message: The graph couldn't be sorted in topological order.
2022-02-12 21:49:37.015832: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 1, topological sort failed with message: The graph couldn't be sorted in topological order.
2022-02-12 21:49:37.122234: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 0, topological sort failed with message: The graph couldn't be sorted in topological order.
2022-02-12 21:49:37.130529: E tensorflow/core/grappler/optimizers/dependency_optimizer.cc:666] Iteration = 1, topological sort failed with message: The graph couldn't be sorted in topological order.
2022-02-12 21:49:41.363498: W tensorflow/core/framework/allocator.cc:122] Allocation of 2684354560 exceeds 10% of system memory.
2022-02-12 21:49:49.669616: W tensorflow/core/framework/allocator.cc:122] Allocation of 2684354560 exceeds 10% of system memory.
Finished in 20.853251218795776
127.0.0.1 - - [12/Feb/2022 21:49:57] "POST /random HTTP/1.1" 200 -

and here is the log from node make_randoms.js:

$ node make_randoms.js
{ Error: ENOENT: no such file or directory, open 'public/img/3ae730976a4f4ed36d399830.jpeg'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1299:33)
    at module.exports (/home/argos/git/ganbreeder/server/save_results.js:26:16)
    at <anonymous>
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'public/img/3ae730976a4f4ed36d399830.jpeg' }

Could you please help me get back on track? Any help would be greatly appreciated.
Thank you

Cheers

Utilize parts of your project to mix images (for use in an animation)?

I've been exploring your project and first off: thanks for making this open source. I've learned a lot.

I'm interested in using parts your project to mix two images. I have an art project in mind where I take two images with a camera in slightly different positions and then use a GAN to create interval frames and then stitch them together into a video. I'm wondering if I can create something that looks like an animation, but with hopefully slightly strange images from a GAN.

Would your project be suitable for this? And, if so, do you have suggestions on how I could send image data correctly to the server? Ideally I would love to be able to just make a POST request with cURL like:

curl -d "@image1.png" -d "@image2.png" -X POST http://localhost:3000/mix_images

Tensorflow issue prohibiting server.py to run

Traceback:

Traceback (most recent call last):
  File "d:\Open-Source\AI\ganbreeder\gan_server\server.py", line 6, in <module>
    import tensorflow as tf
  File "C:\Python38\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import
  File "C:\Python38\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Python38\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 114
    def TFE_ContextOptionsSetAsync(arg1, async):
                                         ^
SyntaxError: invalid syntax

OS: Windows 10

pip freeze:


Flask                            1.0.2
Flask-Cors                       3.0.7
Pillow                           7.0.0
scipy                            1.5.2
tensorflow                       1.8.0
tensorflow-hub                   0.9.0

Unexpected CUDA error: out of memory

I run "python server.py" and got the error "Unexpected CUDA error: out of memory". My GPU is 2080ti with 11GB memory. Could you let me know how to correct it? thanks!

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.