Giter Club home page Giter Club logo

news-image-caption's Introduction

News-image-caption

most of code in this repository originate from self-critical

Chinese image caption generation for breaking news

Requirements

  • python3
  • torch 1.4.0
  • numpy 1.16.2
  • coco-caption (see README)
  • cider (see README)

Data preparation

Download the raw data from News dataset

(1) preprocess the news label

python scripts/prepro_news_labels.py --input_json data/news_annotations/annotations/instances_train2017.json --input_json_2 data/news_annotations/annotations/instances_val2017.json --input_json_3 data/news_annotations/annotations/instances_test2017.json --output_json data/newstalk.json --output_h5 data/newstalk

(2) preprocess the features

python scripts/make_news_data.py

Start training & evaluation

Training

python tools/train.py --cfg configs/news.yml --id news_num

Eval

python tools/eval.py --dump_images 0 --num_images 1900 --model log_news_3/model-best.pth --infos_path log_news_3/infos_news_3-best.pkl --language_eval 1 --beam_size 5

Self critical training copy model

bash scripts/copy_model.sh news_3 news_3_r

training

python tools/train.py --cfg configs/news_rl.yml --id news_3_rl

Example

the result of Chinese image caption generation 1

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.