forked from LisaAnne/DCC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
executable file
·91 lines (79 loc) · 2.55 KB
/
setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
# Initialize our own variables:
zip_file="release_DCC_06182016.zip"
unzip_file="release_DCC"
annotation_dl=1
annotation_folder="annotations"
image_dl=1
image_folder="coco_images"
tool_dl=1
function show_help {
echo "-z: option which indicates path for downloaded zip file is. Default is $zip_file."
echo "-a: option which indicates whether or not to download MSCOCO annotations. If MSCOCO annotations already downloaded, need path to annotations to properly setup folders. Default path is $annotation-folder"
echo "-i: option to indicate whether or not to download MSOCO images."
}
while getopts "h?z:a:it" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
z) zip_file=$OPTARG
;;
a) annotation_dl=0
annotation_folder=$OPTARG
;;
i) image_dl=0
;;
t) tool_dl=0
;;
esac
done
shift $((OPTIND-1))
[ "$1" = "--" ] && shift
if [ $annotation_dl -eq 1 ]
then
echo "Downloading MSCOCO annotations to $annotation_folder"
mscoco_annotation_file="annotations-1-0-3/captions_train-val2014.zip"
wget http://msvocds.blob.core.windows.net/$mscoco_annotation_file
unzip captions_train-val2014.zip
else
echo "Not downloading MSCOCO annotations. Annotations already in $annotation_folder"
fi
if [ $image_dl -eq 1 ]
then
echo "Downloading MSCOCO images to $image_folder"
mscoco_train_image_file="coco2014/train2014.zip"
wget http://msvocds.blob.core.windows.net/$mscoco_train_image_file
unzip train2014.zip
mscoco_train_image_file="coco2014/val2014.zip"
wget http://msvocds.blob.core.windows.net/$mscoco_train_image_file
unzip val2014.zip
mkdir $image_folder
mv train2014 $image_folder
mv val2014 $image_folder
else
echo "Not downloading MSCOCO images. Images already in $image_folder"
fi
if [ $tool_dl -eq 1 ]
then
echo "Downloading MSCOCO eval tools"
./utils/download_tools.sh
else
echo "Not downloading MSCOCO eval_tools."
fi
unzip $zip_file
mkdir snapshots
mkdir results
mkdir results/generated_sentences
mv $unzip_file/trained_models/caption_models/* snapshots
mv $unzip_file/trained_models/classifiers/* snapshots
mv $unzip_file/trained_models/language_models/* snapshots
mv $unzip_file/utils/image_list/* utils/image_list
mv $unzip_file/utils/vectors-cbow-bnc+ukwac+wikipedia.bin train_captions
mv $unzip_file/annotations_DCC/* $annotation_folder
mkdir outfiles
mkdir outfiles/transfer
rm -r $unzip_file
#rm $zip_file