• Stars
    star
    306
  • Rank 131,718 (Top 3 %)
  • Language
    Python
  • License
    Other
  • Created over 8 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Generates poetry from images using convolutional and recurrent neural networks

"All the time the sun / Is wheeling out of a dark bright ground."

A close up of a red and white striped umbrella and the streets are still still and the sun is still a little and the sun is still and the sun is still and the sun is still and the sun is gone.

The sun is singing and the sun is still and the sun is looking for the sun.

The sun is still there and the sun is still and the sun is down and the sun is still and the sun is gone.

The sun is still there and the sun is gone.

The sun is still and the sun is still there.

The sun is dead.

The sun is still, and the sun is shining in the wind.

A close up of a red and white striped umbrella, and the post office was a fire of stone in the middle of the bar. The streetcar remains of the police. The bar was a little strange and sharp as the man who had the strength to stay away from the problem. The little girl was a big fish with a green shoe which had hardly a shot and the party of the storm was being considered a strange story.

A close up of a red and white striped umbrella, and the mountains are lighted and still there is no definition in the morning of a little of morning to the first thing that makes the moon sink under the space that will be gone from the stars.

I want to see it like this has been so awkward and unwanted. I shall see it all out of the sea of the past. Only the sound of the trees are coming up like a bone to be put on a strange ship.

A close up of a red and white striped umbrella, and the living and the dark and the red with the sleep of a hand, and the wind remains the sun and the high leaves.

The sun is beautiful, and there is no desire to feel the mind off the sea.

In the middle of the place, the moon is opened with the human form.

The world is all the streets are all there.

The land of the broken light of life is a procession

Of many million men in lonely arms

On the page of the barn. All the time the sun

Is wheeling out of a dark bright ground.

(Painting by Mark Rothko, poetry generated by NeuralSnap)

NeuralSnap

A new year, a new word camera: NeuralSnap uses artificial neural networks to generate poetry from images.

By Ross Goodwin, 2016

More Output Samples

Intent

This project, in many ways a follow-up on word.camera, was created on the shoulders of two spectacular open source contributions by Andrej Karpathy: NeuralTalk2 and Char-RNN, both of which run in Torch. The code I've provided in this repository is a modest Python wrapper for a few of Karpathy's scripts, and a means to experiment with a few models that I've trained on Nvidia K80 GPUs using the High Performance Computing facilities at NYU.

In my research, I am developing tools that I hope will serve to augment human creativity. These are the first neural network models to emerge from my explorations, and I've decided to make them available to others:

$ wget https://s3.amazonaws.com/rossgoodwin/models/2016-01-12_char-rnn_model_01_rg.t7
$ wget https://s3.amazonaws.com/rossgoodwin/models/2016-01-12_char-rnn_model_02_rg.t7
$ wget https://s3.amazonaws.com/rossgoodwin/models/2016-01-12_neuraltalk2_model_01_rg.t7

NOTE: These models are licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. That means if you use them you must attribute me (Ross Goodwin), you cannot use these models for commercial purposes, and any derivative work you produce must be licensed under the same terms.

Creative Commons License
NeuralSnap Models by Ross Goodwin are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Based on a work at https://github.com/rossgoodwin/neuralsnap.

How It Works

NeuralTalk2 uses convolutional and recurrent neural networks to caption images. I trained my own model on the MSCOCO dataset, using the general guidelines Karpathy outlines in his documentation, but made adjustments to increase verbosity.

I then trained a recurrent neural network using Char-RNN on about 40MB of (mostly) 20th-century poetry from a variety of writers (and a variety of cultures) around the world.

In the output examples above, the red text is the image caption, and the poetry-trained net generated the rest of the text. The stanzas iterate through different RNN "temperature" values, an input that controls the riskiness of the model's predictions. Lower temperature results will be more repetitive and strictly grammatical, while higher temperature results contain more variety but may also contain more errors.

How To Run It

I have tested this software on Ubuntu 14.04 and 15.10. You can try other OS options at your own risk -- in theory, it should run on anything that can run Torch and Python, although I've heard that NeuralTalk2 does not play nice with the Raspberry Pi.

You'll need to clone the NeuralTalk2 and Char-RNN repos into the main folder, then follow Karpathy's README instructions to install the dependencies for NeuralTalk2 -- you don't need to worry about any of the GPU or training stuff, unless you want to use your own models. (The models I've provided are calibrated to run on CPUs.) Thankfully, the dependencies of Char-RNN are a subset of those required for NeuralTalk2.

Usage

$ python neuralsnap.py <output_title> <ntalk_model_filepath> <rnn_model_filepath> <image_folder_filepath>

e.g.

$ python neuralsnap.py testing123 /path/to/neuraltalk2/model/2016-01-12_neuraltalk2_model_01_rg.t7 /path/to/char-rnn/model/2016-01-12_char-rnn_model_02_rg.t7 /path/to/image/folder

Software License Information

As noted above, my trained models are available under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. However, I have licensed the code in this repository under GPLv3.

NeuralSnap image-to-text poetry generator
Copyright (C) 2016  Ross Goodwin

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

You may contact Ross Goodwin via email at [email protected] or
address physical correspondence to:

Ross Goodwin c/o ITP
721 Broadway, 4th Floor
New York, NY 10003

More Repositories

1

hmap

Image histogram remapping
Python
208
star
2

lexiconjure

Twitter bot generating invented words and definitions using RNN + genetic algorithm
Python
131
star
3

photosynthesis

word.camera
JavaScript
90
star
4

sonnetizer

Generates rhyming sonnets in (mostly) iambic pentameter from any text corpus
Python
46
star
5

plotgen

OUTDATED VERSION collective consciousness fiction generator
TeX
44
star
6

ficgen

collective consciousness fiction generator
TeX
29
star
7

poetizer

Generates free or fixed verse poetry from any text corpus using Ngram natural language generator (markov chains) + pos tagging + rhyme identifier + metrical rules
Python
27
star
8

american-names

All the surnames from the 2000 U.S. Census, plus all first names occurring > 4 times in Census data from 1883 forward
19
star
9

trumpocalypse

A book of poetry, computationally generated from Donald Trump quotes
18
star
10

cutup

The Cut-Up Method of Brion Gysin, as described by William S. Burroughs, implemented in Python
Python
18
star
11

metermap

Maps clauses from a text corpus onto the metrical structure of a poem
Python
17
star
12

wordcar

Automatic narration from Brooklyn to New Orleans, March 2017
Python
14
star
13

razer

Patterns & Scrolling Text for Razer RGB LED Keyboards
Python
13
star
14

tokenizer

reversible natural language tokenizer
Python
8
star
15

vonnegut

Kurt Vonnegut's complete works, analyzed for sentiment, visualized as interactive TF-IDF word clouds
JavaScript
8
star
16

emoji

Emoji subtitle generator
PHP
7
star
17

sfpc

SFPC Code Narratives, July 2017
Python
7
star
18

musapaedia

Pandora for Poetry – Created for NYPL Labs Open Book Hack Day 2015
Python
6
star
19

clock

Project Gutenberg Clock
6
star
20

lyricist

Writes song lyrics from any text corpus
Python
3
star
21

-

Turns The Universe Into Paperclips
Shell
3
star
22

wraithhimself

Twitter bot reading Infinite Jest by David Foster Wallace as the first word of retweets
Python
3
star
23

itpcamp

Creative Text Manipulation with Python // Sunday, June 7, 1-5pm @ ITP
HTML
2
star
24

codeshakespeare

HTML
2
star
25

wikipoet

Writes simple poems using Wikipedia
Python
2
star
26

videopizza

Python
2
star
27

gutenflag

Twitter bot for Project Gutenberg book recommendations.
Python
2
star
28

followcreatives

Follows other creative folks on Twitter
Python
2
star
29

drgonzo

Hunter S. Thompson Therapist Bot
Python
1
star
30

soundcamera

listen to your photographs
HTML
1
star
31

blackhole

Visualizing the scale of supermassive black holes
Jupyter Notebook
1
star
32

poemportraits-backend

Lua
1
star
33

python-image

Image Processing with Python | ITP Unconference | January 20, 2016
HTML
1
star
34

bizarromoma

Twitter bot tweeting alternate versions of MoMA collection items every two minutes
Python
1
star
35

flight359

Ross Goodwin's 2019 NaNoGenMo project
TeX
1
star
36

IamA-Proof

It's me, Ross Goodwin. Ask me anything today, Thursday, September 17, 2020.
1
star
37

rossgoodwin.github.io

HTML
1
star
38

poemportraits

CSS
1
star
39

survdoc

Final Project for Surveillance Documentary – NYU ITP Spring 2015
Python
1
star
40

narratedreality

Narrated Reality website
HTML
1
star