1 import argparse
 2 
 3 import tensorflow as tf
 4 tf.enable_eager_execution()
 5 
 6 
 7 def main(args):
 8     """Download the Microsoft COCO 2014 data set."""
 9     # Annotation zip
10     tf.keras.utils.get_file(fname=args.annotation_zip,
11                             origin=args.annotation_origin,
12                             cache_dir=args.cache_dir,
13                             cache_subdir=args.cache_subdir,
14                             extract=True)
15 
16     # Train image zip
17     tf.keras.utils.get_file(fname=args.train_zip,
18                             origin=args.train_origin,
19                             cache_dir=args.cache_dir,
20                             cache_subdir=args.cache_subdir,
21                             extract=True)
22 
23     # Val image zip
24     tf.keras.utils.get_file(fname=args.val_zip,
25                             origin=args.val_origin,
26                             cache_dir=args.cache_dir,
27                             cache_subdir=args.cache_subdir,
28                             extract=True)
29 
30     # Test image zip
31     tf.keras.utils.get_file(fname=args.test_zip,
32                             origin=args.test_origin,
33                             cache_dir=args.cache_dir,
34                             cache_subdir=args.cache_subdir,
35                             extract=True)
36 
37 
38 if __name__ == '__main__':
39     parser = argparse.ArgumentParser()
40     parser.add_argument('--cache_dir', type=str, default='F:/', help='location to store cached files')
41     parser.add_argument('--cache_subdir', type=str, default='COCO2014/', help='subdirectory under the cache dir')
42     parser.add_argument('--annotation_zip', type=str, default='annotation2014.zip', help='name of annotation zip')
43     parser.add_argument('--annotation_origin', type=str,
44                         default='http://images.cocodataset.org/annotations/annotations_trainval2014.zip',
45                         help='origin of annotation zip')
46     parser.add_argument('--train_zip', type=str, default='train2014.zip', help='name of train zip')
47     parser.add_argument('--train_origin', type=str,
48                         default='http://images.cocodataset.org/zips/train2014.zip',
49                         help='origin of train zip')
50     parser.add_argument('--val_zip', type=str, default='val2014.zip', help='name of val zip')
51     parser.add_argument('--val_origin', type=str,
52                         default='http://images.cocodataset.org/zips/val2014.zip',
53                         help='origin of val zip')
54     parser.add_argument('--test_zip', type=str, default='test2014.zip', help='name of test zip')
55     parser.add_argument('--test_origin', type=str,
56                         default='http://images.cocodataset.org/zips/test2014.zip',
57                         help='origin of test zip')
58 
59     args = parser.parse_args()
60     print(args)
61 
62     main(args)