Python argparse.ArgumentDefaultsHelpFormatter() Examples

The following are 30 code examples of argparse.ArgumentDefaultsHelpFormatter(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module argparse , or try the search function .
Example #1
Source File: config_idracs.py    From JetPack with Apache License 2.0 6 votes vote down vote up
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Performs initial configuration of iDRACs.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_instack_arg(parser)
    ArgHelper.add_model_properties_arg(parser)

    LoggingHelper.add_argument(parser)

    parser.add_argument("-j",
                        "--json_config",
                        default=None,
                        help="""JSON that specifies the PXE NIC FQDD and the "
                            "new password for each overcloud node""")

    return parser.parse_args() 
Example #2
Source File: ovs.py    From don with Apache License 2.0 6 votes vote down vote up
def check_args():
    global params

    parser = argparse.ArgumentParser(
        description='OVS test', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--debug', dest='debug',
                        help='Enable debugging', default=False, action='store_true')
    parser.add_argument('--src_port_id', dest='src_port_id',
                        help='OVS src port id (required)', type=str, required=True)
    parser.add_argument('--dst_port_id', dest='dst_port_id',
                        help='OVS dst port id (required)', type=str, required=True)
    parser.add_argument(
        '--tag', dest='tag', help='VLAN tag of port (required)', type=str, required=True)
    parser.add_argument('--ovs_bridge', dest='ovs_bridge',
                        help='OVS bridge to be tested (required)', type=str, required=True)
    args = parser.parse_args()

    settings['debug'] = args.debug
    params['src_port_id'] = args.src_port_id
    params['dst_port_id'] = args.dst_port_id
    params['tag'] = args.tag
    params['ovs_bridge'] = args.ovs_bridge 
Example #3
Source File: standardize_jigsaws.py    From miccai-2016-surgical-activity-rec with Apache License 2.0 6 votes vote down vote up
def define_and_process_args():
    """ Define and process command-line arguments.

    Returns:
        A Namespace with arguments as attributes.
    """

    description = main.__doc__
    formatter_class = argparse.ArgumentDefaultsHelpFormatter
    parser = argparse.ArgumentParser(description=description,
                                     formatter_class=formatter_class)

    parser.add_argument('--data_dir', default='~/Data/JIGSAWS/Suturing',
                        help='Data directory.')
    parser.add_argument('--data_filename', default='standardized_data.pkl',
                        help='''The name of the standardized-data pkl file that
                                we'll create inside data_dir.''')

    args = parser.parse_args()
    args.data_dir = os.path.expanduser(args.data_dir)
    return args 
Example #4
Source File: diagnose.py    From dynamic-training-with-apache-mxnet-on-aws with Apache License 2.0 6 votes vote down vote up
def parse_args():
    """Parse arguments."""
    parser = argparse.ArgumentParser(
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        description='Diagnose script for checking the current system.')
    choices = ['python', 'pip', 'mxnet', 'os', 'hardware', 'network']
    for choice in choices:
        parser.add_argument('--' + choice, default=1, type=int,
                            help='Diagnose {}.'.format(choice))
    parser.add_argument('--region', default='', type=str,
                        help="Additional sites in which region(s) to test. \
                        Specify 'cn' for example to test mirror sites in China.")
    parser.add_argument('--timeout', default=10, type=int,
                        help="Connection test timeout threshold, 0 to disable.")
    args = parser.parse_args()
    return args 
Example #5
Source File: calibrate_camera.py    From derplearning with MIT License 6 votes vote down vote up
def main():
    """
    Calibrate the live camera and optionally do a live display of the results
    """
    parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("config", type=Path, help="camera config path")
    parser.add_argument("--height", type=int, default=4)
    parser.add_argument("--width", type=int, default=10)
    parser.add_argument("--count", type=int, default=10)
    parser.add_argument("--view", action="store_true")
    args = parser.parse_args()

    config = {"camera": derp.util.load_config(args.config)}
    camera = Camera(config)
    pattern_shape = (args.height, args.width)

    camera_matrix, distortion_coefficients = live_calibrate(camera, pattern_shape, args.count)
    print(camera_matrix)
    print(distortion_coefficients)
    if args.view:
        live_undistort(camera, camera_matrix, distortion_coefficients)
    cv2.destroyAllWindows() 
Example #6
Source File: predict.py    From robosat with MIT License 6 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "predict",
        help="predicts probability masks for slippy map tiles",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )

    parser.add_argument("--batch_size", type=int, default=1, help="images per batch")
    parser.add_argument("--checkpoint", type=str, required=True, help="model checkpoint to load")
    parser.add_argument("--overlap", type=int, default=32, help="tile pixel overlap to predict on")
    parser.add_argument("--tile_size", type=int, required=True, help="tile size for slippy map tiles")
    parser.add_argument("--workers", type=int, default=0, help="number of workers pre-processing images")
    parser.add_argument("tiles", type=str, help="directory to read slippy map image tiles from")
    parser.add_argument("probs", type=str, help="directory to save slippy map probability masks to")
    parser.add_argument("--model", type=str, required=True, help="path to model configuration file")
    parser.add_argument("--dataset", type=str, required=True, help="path to dataset configuration file")

    parser.set_defaults(func=main) 
Example #7
Source File: prep_overcloud_nodes.py    From JetPack with Apache License 2.0 5 votes vote down vote up
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Prepares the overcloud nodes.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    LoggingHelper.add_argument(parser)

    return parser.parse_args() 
Example #8
Source File: introspect_nodes.py    From JetPack with Apache License 2.0 5 votes vote down vote up
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Introspects the overcloud nodes.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_inband_arg(parser)
    LoggingHelper.add_argument(parser)

    return parser.parse_args() 
Example #9
Source File: config_dashboard.py    From JetPack with Apache License 2.0 5 votes vote down vote up
def parse_arguments(dashboard_user):
    """ Parses the input argments
    """

    parser = argparse.ArgumentParser(
        description="Configures the Ceph Storage Dashboard and Ceph nodes.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument("-dashboard_addr", "--dashboard_addr",
                        help="The IP address of the Ceph Storage Dashboard "
                        "on the external network", required=True)
    parser.add_argument("-dashboard_pass", "--dashboard_pass",
                        help="The password of the Ceph Storage Dashboard "
                        "node ", required=True)
    parser.add_argument("-subUser", "--subUser",
                        help="The username for Red Hat Subscription Access",
                        action='store', required=False)
    parser.add_argument("-subPass", "--subPass",
                        help="The password for Red Hat Subscription Access",
                        action='store', required=False)
    parser.add_argument("-satOrg", "--satOrg",
                        help="The Red Hat Satellite Organization",
                        action='store', required=False)
    parser.add_argument("-satKey", "--satKey",
                        help="The Red Hat Satellite Activation Key",
                        action='store', required=False)
    parser.add_argument("-physId", "--physId",
                        help="The subscription poolid for Physical Nodes",
                        required=True)
    parser.add_argument("-cephId", "--cephId",
                        help="The subscription poolid for Ceph Nodes",
                        required=True)

    LoggingHelper.add_argument(parser)

    return parser.parse_args() 
Example #10
Source File: analyzer.py    From don with Apache License 2.0 5 votes vote down vote up
def check_args():
    parser = argparse.ArgumentParser(description='Static analysis of output of commands',
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--debug', dest='debug',
                        help='Enable debugging',
                        default=True, action='store_true')
    parser.add_argument('--info_file', dest='info_file',
                        help='Info is read  in JSON format in this file',
                        default="don.json", type=str)
    parser.add_argument('--ping', dest='ping',
                        help='ping test between all VMs', default=False,
                        action='store_true')
    parser.add_argument('--ping_count', dest='ping_count',
                        help='how many ping packets to send',
                        default=2, type=int)
    parser.add_argument('--ping_timeout', dest='ping_timeout',
                        help='ping timeout period in seconds',
                        default=2, type=int)
    parser.add_argument('--ovs', dest='ovs',
                        help='ovs test between ports using same tag in br-int',
                        default=False, action='store_true')
    parser.add_argument('--test_all', dest='test_all',
                        help='Perform all tests in test suite',
                        default=False, action='store_true')
    parser.add_argument('--error_file', dest='error_file',
                        help='All errors will be reported to this file',
                        type=str, default='don.error.txt')
    parser.add_argument('--report_file', dest='report_file',
                        help='Report will be written in this file in HTML format',
                        type=str, default='don.report.html')
    args = parser.parse_args()

    settings['debug'] = args.debug
    settings['info_file'] = args.info_file
    settings['error_file'] = args.error_file
    settings['test:all'] = args.test_all
    settings['test:ping'] = args.test_all or args.ping
    settings['test:ping_count'] = args.ping_count
    settings['test:ping_timeout'] = args.ping_timeout
    settings['test:ovs'] = args.test_all or args.ovs
    settings['test:report_file'] = args.report_file 
Example #11
Source File: train.py    From n2n-watermark-remove with MIT License 5 votes vote down vote up
def get_args():
    parser = argparse.ArgumentParser(description="train noise2noise model",
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("--image_dir", type=str, required=True,
                        help="train image dir")
    parser.add_argument("--test_dir", type=str, required=True,
                        help="test image dir")
    parser.add_argument("--image_size", type=int, default=64,
                        help="training patch size")
    parser.add_argument("--batch_size", type=int, default=16,
                        help="batch size")
    parser.add_argument("--nb_epochs", type=int, default=100,
                        help="number of epochs")
    parser.add_argument("--lr", type=float, default=0.01,
                        help="learning rate")
    parser.add_argument("--steps", type=int, default=1000,
                        help="steps per epoch")
    parser.add_argument("--loss", type=str, default="mse",
                        help="loss; mse', 'mae', or 'l0' is expected")
    parser.add_argument("--weight", type=str, default=None,
                        help="weight file for restart")
    parser.add_argument("--output_path", type=str, default="checkpoints",
                        help="checkpoint dir")
    parser.add_argument("--source_noise_model", type=str, default="gaussian,0,50",
                        help="noise model for source images")
    parser.add_argument("--target_noise_model", type=str, default="gaussian,0,50",
                        help="noise model for target images")
    parser.add_argument("--val_noise_model", type=str, default="gaussian,25,25",
                        help="noise model for validation source images")
    parser.add_argument("--model", type=str, default="srresnet",
                        help="model architecture ('srresnet' or 'unet')")
    args = parser.parse_args()

    return args 
Example #12
Source File: chardetect.py    From vulscan with MIT License 5 votes vote down vote up
def main(argv=None):
    '''
    Handles command line arguments and gets things started.

    :param argv: List of arguments, as if specified on the command-line.
                 If None, ``sys.argv[1:]`` is used instead.
    :type argv: list of str
    '''
    # Get command line arguments
    parser = argparse.ArgumentParser(
        description="Takes one or more file paths and reports their detected \
                     encodings",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        conflict_handler='resolve')
    parser.add_argument('input',
                        help='File whose encoding we would like to determine.',
                        type=argparse.FileType('rb'), nargs='*',
                        default=[sys.stdin])
    parser.add_argument('--version', action='version',
                        version='%(prog)s {0}'.format(__version__))
    args = parser.parse_args(argv)

    for f in args.input:
        if f.isatty():
            print("You are running chardetect interactively. Press " +
                  "CTRL-D twice at the start of a blank line to signal the " +
                  "end of your input. If you want help, run chardetect " +
                  "--help\n", file=sys.stderr)
        print(description_of(f, f.name)) 
Example #13
Source File: preprocess.py    From video-caption-openNMT.pytorch with MIT License 5 votes vote down vote up
def parse_args():
    parser = argparse.ArgumentParser(
        description='preprocess.py',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    onmt.opts.add_md_help_argument(parser)
    onmt.opts.preprocess_opts(parser)

    opt = parser.parse_args()
    torch.manual_seed(opt.seed)

    check_existing_pt_files(opt)

    return opt 
Example #14
Source File: chardetect.py    From recruit with Apache License 2.0 5 votes vote down vote up
def main(argv=None):
    '''
    Handles command line arguments and gets things started.

    :param argv: List of arguments, as if specified on the command-line.
                 If None, ``sys.argv[1:]`` is used instead.
    :type argv: list of str
    '''
    # Get command line arguments
    parser = argparse.ArgumentParser(
        description="Takes one or more file paths and reports their detected \
                     encodings",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        conflict_handler='resolve')
    parser.add_argument('input',
                        help='File whose encoding we would like to determine.',
                        type=argparse.FileType('rb'), nargs='*',
                        default=[sys.stdin])
    parser.add_argument('--version', action='version',
                        version='%(prog)s {0}'.format(__version__))
    args = parser.parse_args(argv)

    for f in args.input:
        if f.isatty():
            print("You are running chardetect interactively. Press " +
                  "CTRL-D twice at the start of a blank line to signal the " +
                  "end of your input. If you want help, run chardetect " +
                  "--help\n", file=sys.stderr)
        print(description_of(f, f.name)) 
Example #15
Source File: plot.py    From don with Apache License 2.0 5 votes vote down vote up
def check_args():
    parser = argparse.ArgumentParser(description='Plot the compute node network internals',
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--debug', dest='debug',
                        help='Enable debugging', default=True, action='store_true')
    parser.add_argument('--info_file', dest='info_file',
                        help='Info is read  in JSON format in this file', default="don.json", type=str)
    parser.add_argument('--compute_file', dest='compute_file',
                        help='[compute_file].dot and [compute_file].svg will be generated for compute node', default="compute", type=str)
    parser.add_argument('--network_file', dest='network_file',
                        help='[network_file].dot and [network_file].svg will be generated for network node', default="network", type=str)
    parser.add_argument('--combined_file', dest='combined_file',
                        help='[combined_file].dot and [combined_file].svg will be generated', default="don", type=str)
    parser.add_argument('--highlight_file', dest='highlight_file',
                        help='pass and fail node are specified in this file', default=None, type=str)

    args = parser.parse_args()

    settings['debug'] = args.debug
    settings['info_file'] = args.info_file
    settings['compute_dot_file'] = args.compute_file + '.dot'
    settings['compute_svg_file'] = args.compute_file + '.svg'
    settings['network_dot_file'] = args.network_file + '.dot'
    settings['network_svg_file'] = args.network_file + '.svg'
    settings['combined_dot_file'] = args.combined_file + '.dot'
    settings['combined_svg_file'] = args.combined_file + '.svg'
    settings['highlight_file'] = args.highlight_file 
Example #16
Source File: collector.py    From don with Apache License 2.0 5 votes vote down vote up
def check_args():
    parser = argparse.ArgumentParser(description='Runs commands, collects, and parses output',
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--debug', dest='debug', help='Enable debugging',
                        default=True, action='store_true')
    parser.add_argument('--info_file', dest='info_file',
                        help='Info will be stored in JSON format in this file',
                        default="don.json", type=str)
    args = parser.parse_args()

    settings['debug'] = args.debug
    settings['info_file'] = args.info_file 
Example #17
Source File: noise_model_test.py    From n2n-watermark-remove with MIT License 5 votes vote down vote up
def get_args():
    parser = argparse.ArgumentParser(description="test noise model",
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("--image_size", type=int, default=256,
                        help="training patch size")
    parser.add_argument("--noise_model", type=str, default="gaussian,0,50",
                        help="noise model to be tested")
    args = parser.parse_args()
    return args 
Example #18
Source File: ping.py    From don with Apache License 2.0 5 votes vote down vote up
def check_args():
    global params

    parser = argparse.ArgumentParser(
        description='Ping test',
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('--debug', dest='debug',
                        help='Enable debugging',
                        default=False, action='store_true')
    parser.add_argument('--src_ip', dest='src_ip',
                        help='IP from where ping will be run (required)',
                        type=str, required=True)
    parser.add_argument('--dst_ip', dest='dst_ip',
                        help='IP to which ping will be run (required)',
                        type=str, required=True)
    parser.add_argument('--username', dest='username',
                        help='SSH login username (required)', type=str,
                        required=True)
    parser.add_argument('--passwd', dest='passwd',
                        help='SSH login passwd (required)',
                        type=str, required=True)
    parser.add_argument('--count', dest='count',
                        help='ping count', type=str, default='2')
    parser.add_argument('--timeout', dest='timeout',
                        help='ping timeout (-W option of ping) in seconds',
                        type=str, default='4')
    args = parser.parse_args()

    settings['debug'] = args.debug
    params['src_ip'] = args.src_ip
    params['dst_ip'] = args.dst_ip
    params['username'] = args.username
    params['passwd'] = args.passwd
    params['count'] = args.count
    params['timeout'] = args.timeout 
Example #19
Source File: config_idrac_dhcp.py    From JetPack with Apache License 2.0 5 votes vote down vote up
def parse_arguments(sah_user):
    parser = argparse.ArgumentParser(
        description="Configures DHCP server on SAH node for use by iDRACs.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("sah_ip",
                        help="""The IP address of the SAH node on the
                                provisioning network""")
    parser.add_argument("-p",
                        "--password",
                        help="The {} password of the SAH node".format(
                             sah_user))
    LoggingHelper.add_argument(parser)

    return parser.parse_args() 
Example #20
Source File: import_nodes.py    From JetPack with Apache License 2.0 5 votes vote down vote up
def parse_arguments():
    parser = argparse.ArgumentParser(
        description="Loads nodes into ironic.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    ArgHelper.add_instack_arg(parser)

    LoggingHelper.add_argument(parser)

    return parser.parse_args() 
Example #21
Source File: cmd_util.py    From Reinforcement_Learning_for_Traffic_Light_Control with Apache License 2.0 5 votes vote down vote up
def arg_parser():
    """
    Create an empty argparse.ArgumentParser.
    """
    import argparse
    return argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) 
Example #22
Source File: deploy-dashboard-vm.py    From JetPack with Apache License 2.0 5 votes vote down vote up
def parse_arguments():
    """ Parses the input argments
    """

    parser = argparse.ArgumentParser(
        description="Deploys the Dashboard VM.",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument("cfg_filename",
                        help="Dashboard configuration file",
                        metavar="CFG-FILE")
    parser.add_argument("rhel_iso",
                        help="RHEL ISO file",
                        metavar="RHEL-ISO")

    return parser.parse_args() 
Example #23
Source File: __init__.py    From tox with MIT License 5 votes vote down vote up
def __init__(self):
        class HelpFormatter(argparse.ArgumentDefaultsHelpFormatter):
            def __init__(self, prog):
                super(HelpFormatter, self).__init__(prog, max_help_position=35, width=190)

        self.argparser = argparse.ArgumentParser(
            description="tox options", add_help=False, prog="tox", formatter_class=HelpFormatter,
        )
        self._testenv_attr = [] 
Example #24
Source File: chardetect.py    From core with MIT License 5 votes vote down vote up
def main(argv=None):
    '''
    Handles command line arguments and gets things started.

    :param argv: List of arguments, as if specified on the command-line.
                 If None, ``sys.argv[1:]`` is used instead.
    :type argv: list of str
    '''
    # Get command line arguments
    parser = argparse.ArgumentParser(
        description="Takes one or more file paths and reports their detected \
                     encodings",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
        conflict_handler='resolve')
    parser.add_argument('input',
                        help='File whose encoding we would like to determine.',
                        type=argparse.FileType('rb'), nargs='*',
                        default=[sys.stdin])
    parser.add_argument('--version', action='version',
                        version='%(prog)s {0}'.format(__version__))
    args = parser.parse_args(argv)

    for f in args.input:
        if f.isatty():
            print("You are running chardetect interactively. Press " +
                  "CTRL-D twice at the start of a blank line to signal the " +
                  "end of your input. If you want help, run chardetect " +
                  "--help\n", file=sys.stderr)
        print(description_of(f, f.name)) 
Example #25
Source File: train.py    From robosat with MIT License 5 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "train", help="trains model on dataset", formatter_class=argparse.ArgumentDefaultsHelpFormatter
    )

    parser.add_argument("--model", type=str, required=True, help="path to model configuration file")
    parser.add_argument("--dataset", type=str, required=True, help="path to dataset configuration file")
    parser.add_argument("--checkpoint", type=str, required=False, help="path to a model checkpoint (to retrain)")
    parser.add_argument("--resume", type=bool, default=False, help="resume training or fine-tuning (if checkpoint)")
    parser.add_argument("--workers", type=int, default=0, help="number of workers pre-processing images")

    parser.set_defaults(func=main) 
Example #26
Source File: compare.py    From robosat with MIT License 5 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "compare",
        help="compare images, labels and masks side by side",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument("out", type=str, help="directory to save visualizations to")
    parser.add_argument("images", type=str, help="directory to read slippy map images from")
    parser.add_argument("labels", type=str, help="directory to read slippy map labels from")
    parser.add_argument("masks", type=str, nargs="+", help="slippy map directories to read masks from")
    parser.add_argument("--minimum", type=float, default=0.0, help="minimum percentage of mask not background")
    parser.add_argument("--maximum", type=float, default=1.0, help="maximum percentage of mask not background")

    parser.set_defaults(func=main) 
Example #27
Source File: masks.py    From robosat with MIT License 5 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "masks",
        help="compute masks from prediction probabilities",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )

    parser.add_argument("masks", type=str, help="slippy map directory to save masks to")
    parser.add_argument("probs", type=str, nargs="+", help="slippy map directories with class probabilities")
    parser.add_argument("--weights", type=float, nargs="+", help="weights for weighted average soft-voting")

    parser.set_defaults(func=main) 
Example #28
Source File: export.py    From robosat with MIT License 5 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "export", help="exports model in ONNX format", formatter_class=argparse.ArgumentDefaultsHelpFormatter
    )

    parser.add_argument("--dataset", type=str, required=True, help="path to dataset configuration file")
    parser.add_argument("--image_size", type=int, default=512, help="image size to use for model")
    parser.add_argument("--checkpoint", type=str, required=True, help="model checkpoint to load")
    parser.add_argument("model", type=str, help="path to save ONNX GraphProto .pb model to")

    parser.set_defaults(func=main) 
Example #29
Source File: subset.py    From robosat with MIT License 5 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "subset",
        help="filter images in a slippy map directory using a csv",
        formatter_class=argparse.ArgumentDefaultsHelpFormatter,
    )
    parser.add_argument("images", type=str, help="directory to read slippy map image tiles from for filtering")
    parser.add_argument("tiles", type=str, help="csv to filter images by")
    parser.add_argument("out", type=str, help="directory to save filtered images to")

    parser.set_defaults(func=main) 
Example #30
Source File: rasterize.py    From robosat with MIT License 5 votes vote down vote up
def add_parser(subparser):
    parser = subparser.add_parser(
        "rasterize", help="rasterize features to label masks", formatter_class=argparse.ArgumentDefaultsHelpFormatter
    )

    parser.add_argument("features", type=str, help="path to GeoJSON features file")
    parser.add_argument("tiles", type=str, help="path to .csv tiles file")
    parser.add_argument("out", type=str, help="directory to write converted images")
    parser.add_argument("--dataset", type=str, required=True, help="path to dataset configuration file")
    parser.add_argument("--zoom", type=int, required=True, help="zoom level of tiles")
    parser.add_argument("--size", type=int, default=512, help="size of rasterized image tiles in pixels")

    parser.set_defaults(func=main)