Coder Social home page Coder Social logo

img2poem's Introduction

Beyond Narrative Description: Generating Poetry from Images by Multi-Adversarial Training

An implementation of the image-to-poem model described in the paper: "Beyond Narrative Description: Generating Poetry from Images by Multi-Adversarial Training."

Bei Liu, Jianlong Fu, Makoto P. Kato, Masatoshi Yoshikawa

Full text available at: https://arxiv.org/abs/1804.08473

Contents

Model Overview

Introduction

The Img2poem model is a deep neural network that learns how to generate poems from images. For example:

Architecture

Getting Started

Install Required Packages

(It is recommended to install the dependencies under Conda environment.)

  • python2.7
  • tensorflow1.6
  • mxnet
  • opencv
  • scikit-image
  • tqdm
  • colorama
  • flask

Prepare the Training Data

Name #Poem #Line/poem #Word/line
MultiM-Poem 8,292 7.2 5.7
UniM-Poem 93,265 5.7 6.2
MultiM-Poem(Ex) 26,161 5.4 5.9

Both datasets are formatted in JSON files.

MultiM-Poem.json: image and poem pairs

[
    {
        "poem": str,
        "image_url": str,
        "id": int
    },
    ...
]

UniM-Poem.json: poem corpus

[
    {
        "poem": str,
        "id": int
    },
    ...
]

Download Trained Model

Please download models from https://1drv.ms/u/s!AkLgJBAHL_VFgSyyfpeGyGFZux56 and put it under "code/".

Generating Poems

The following command line will generate poem for an image.

python test.py

Type in the relative path to the test image in the console and the poem will be generated.

../images/test.jpg

Example output:

the sun is singing in the forest wind
and let us go to the wind of the sun
let the sun be free
let us be the storm of heaven
and let us be the slow sun
we keep our own strength together
we live in love and hate

Results

Here are some examples of poems generated by eight methods for an image.

img2poem's People

Contributors

bei21 avatar wkcn avatar fdzzy avatar

Watchers

Noon van der Silk avatar James Cloos avatar  avatar paper2code - bot 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.