Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requirements.txt and download scripts #1

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
lib/
bin/
include/
local/
share/
pip-selfcheck.json
data/
pycocotools/
pycocoevalcap/
results/**/checkpoint
results/**/model*
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ This paper investigates whether the RNN should be viewed as a sequence generator

Works on both python 2 and python 3 (except for the MSCOCO evaluation toolkit which requires python 2) and uses TensorFlow 1.0.

Python dependencies (install all with pip):
* tensorflow
* future
## Setup

*setup.sh* downloads all three datasets (flickr8k, flickr30k and MSCOCO) and install all dependencies via pip.
Alternatively, you can copy/link existing data to data/flickr8k, data/flickr30k or data/coco and run pip install -r requirements.txt manually.

Before running *experiment.py*, you need to copy the *results/* directory to a different directory. The script fails with existing results and does not override them.
9 changes: 9 additions & 0 deletions download_scripts/download_coco_data_and_tools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /bin/bash
git clone https://github.com/tylin/coco-caption.git
mv coco-caption/pycocotools pycocotools
mv coco-caption/pycocoevalcap pycocoevalcap
mkdir -p data/coco/annotations/
mkdir data/coco/results/
mv coco-caption/annotations/captions_val2014.json data/coco/annotations/captions.json
mv coco-caption/results/captions_val2014_fakecap_results.json data/coco/results/generated_captions.json
rm -fR coco-caption
10 changes: 10 additions & 0 deletions download_scripts/download_coco_data_and_tools.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#! /bin/bash
# TODO check if data set from http://cs.stanford.edu/people/karpathy/deepimagesent/
# can be used with not too much adaptions to code

git clone https://github.com/tylin/coco-caption.git
mv coco-caption/pycocotools ../pycocotools
mv coco-caption/pycocoevalcap ../pycocoevalcap
mkdir -p ../data/coco/
mv coco-caption/annotations/ ../data/coco/
rm -fR coco-caption
12 changes: 12 additions & 0 deletions download_scripts/download_flickr_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash

function download_data {
wget http://cs.stanford.edu/people/karpathy/deepimagesent/$1.zip
unzip $1.zip
rm $1.zip
}

mkdir data
cd data
download_data flickr8k
download_data flickr30k
12 changes: 12 additions & 0 deletions download_scripts/download_flickr_data.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /bin/bash

function download_data {
wget http://cs.stanford.edu/people/karpathy/deepimagesent/$1.zip
unzip $1.zip
rm $1.zip
}

mkdir ../data
cd ../data
download_data flickr8k
download_data flickr30k
9 changes: 5 additions & 4 deletions experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
minibatch_size = 50

results_data_dir = 'results'
mscoco_dir = '.../coco-caption-master' #directory to mscoco evaluation code downloaded from https://github.com/tylin/coco-caption

def get_raw_input_data_dir(dataset):
return '.../'+dataset #directory to karpathy flickr8k or flickr30k dataset downloaded from http://cs.stanford.edu/people/karpathy/deepimagesent/
return 'data/'+dataset

mscoco_dir = get_raw_input_data_dir("coco")

sys.path.append(mscoco_dir)
from pycocotools.coco import COCO
from pycocoevalcap.eval import COCOEvalCap

Expand Down Expand Up @@ -190,7 +191,7 @@ def parse(data):

################################################################
print('Training...')

for layer_size in [ 128, 256, 512 ]:
for method in [ 'merge', 'inject' ]:
for run in range(1, num_runs+1):
Expand Down
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
future==0.16.0
tensorflow==1.0.0
matplotlib==2.1.0rc1
scikit-image==0.13.0
4 changes: 4 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#! /bin/bash
download_scripts/download_flickr_data.sh
download_scripts/download_coco_data_and_tools.sh
pip install -r requirements.txt