File tree 1 file changed +66
-0
lines changed
1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ start=` date +%s`
4
+
5
+ # handle optional download dir
6
+ if [ -z " $1 " ]
7
+ then
8
+ # navigate to ~/data
9
+ echo " navigating to ~/data/ ..."
10
+ mkdir -p ~ /data
11
+ cd ~ /data/
12
+ mkdir -p ./coco
13
+ cd ./coco
14
+ mkdir -p ./images
15
+ mkdir -p ./annotations
16
+ else
17
+ # check if specified dir is valid
18
+ if [ ! -d $1 ]; then
19
+ echo $1 " is not a valid directory"
20
+ exit 0
21
+ fi
22
+ echo " navigating to " $1 " ..."
23
+ cd $1
24
+ fi
25
+
26
+ if [ ! -d images ]
27
+ then
28
+ mkdir -p ./images
29
+ fi
30
+
31
+ # Download the image data.
32
+ cd ./images
33
+ echo " Downloading MSCOCO train images ..."
34
+ curl -LO http://images.cocodataset.org/zips/train2014.zip
35
+ echo " Downloading MSCOCO val images ..."
36
+ curl -LO http://images.cocodataset.org/zips/val2014.zip
37
+
38
+ cd ../
39
+ if [ ! -d annotations]
40
+ then
41
+ mkdir -p ./annotations
42
+ fi
43
+
44
+ # Download the annotation data.
45
+ cd ./annotations
46
+ echo " Downloading MSCOCO train/val annotations ..."
47
+ curl -LO http://images.cocodataset.org/annotations/annotations_trainval2014.zip
48
+ echo " Finished downloading. Now extracting ..."
49
+
50
+ # Unzip data
51
+ echo " Extracting train images ..."
52
+ unzip ../images/train2014.zip -d ../images
53
+ echo " Extracting val images ..."
54
+ unzip ../images/val2014.zip -d ../images
55
+ echo " Extracting annotations ..."
56
+ unzip ./annotations_trainval2014.zip
57
+
58
+ echo " Removing zip files ..."
59
+ rm ../images/train2014.zip
60
+ rm ../images/val2014.zip
61
+ rm ./annotations_trainval2014.zip
62
+
63
+ end=` date +%s`
64
+ runtime=$(( end- start))
65
+
66
+ echo " Completed in " $runtime " seconds"
You can’t perform that action at this time.
0 commit comments