argparse

Good:   https://blog.ixxoo.me/argparse.html

http://kuanghy.github.io/2016/06/30/python-argparse

 

import argparse
parser = argparse.ArgumentParser()
parser.add_argument('lfw_dir', type=str,  help='Path to the data directory containing aligned LFW face patches.')
parser.add_argument('--lfw_batch_size', type=int,   help='Number of images to process in a batch in the LFW test set.', default=100)
parser.add_argument('model', type=str,    help='Could be either a directory containing the meta_file and ckpt_file or a model protobuf (.pb) file')
parser.add_argument('--image_size', type=int,  help='Image size (height, width) in pixels.', default=160)
parser.add_argument('--lfw_pairs', type=str,  help='The file containing the pairs to use for validation.', default='data/pairs.txt')
parser.add_argument('--lfw_file_ext', type=str,  help='The file extension for the LFW dataset.', default='png', choices=['jpg', 'png'])
parser.add_argument('--lfw_nrof_folds', type=int, help='Number of folds to use for cross validation. Mainly used for testing.', default=10)
parser.parse_args()

 

Result:

# python prog.py --help
usage: prog.py [-h] [--lfw_batch_size LFW_BATCH_SIZE]
               [--image_size IMAGE_SIZE] [--lfw_pairs LFW_PAIRS]
               [--lfw_file_ext {jpg,png}] [--lfw_nrof_folds LFW_NROF_FOLDS]
               lfw_dir model

positional arguments:
  lfw_dir               Path to the data directory containing aligned LFW face
                        patches.
  model                 Could be either a directory containing the meta_file
                        and ckpt_file or a model protobuf (.pb) file

optional arguments:
  -h, --help            show this help message and exit
  --lfw_batch_size LFW_BATCH_SIZE
                        Number of images to process in a batch in the LFW test
                        set.
  --image_size IMAGE_SIZE
                        Image size (height, width) in pixels.
  --lfw_pairs LFW_PAIRS
                        The file containing the pairs to use for validation.
  --lfw_file_ext {jpg,png}
                        The file extension for the LFW dataset.
  --lfw_nrof_folds LFW_NROF_FOLDS
                        Number of folds to use for cross validation. Mainly
                        used for testing.

 

posted on 2018-03-05 14:59  cdekelon  阅读(154)  评论(0编辑  收藏  举报

导航