def get_args():
    import argparse
    import args as A
    parser = argparse.ArgumentParser(
        description='Inference.')
    A.add_runtime_args(parser)
    A.add_arch_args(parser)
    A.add_val_dataset_args(parser)
    A.add_dali_args(parser)
    parser.add_argument('--batch-size', '-b', default=100,
                        type=int, help='Batch size per GPU.')
    parser.add_argument('--monitor-path', '-M', default='tmp.val',
                        help='A directory the results are produced.')
    parser.add_argument("weights", help='Path to a trained parameter h5 file.')
    parser.add_argument(
        '--labels', help='Path to a label name file which contain label names as csv compatible with `label_words.csv`.', default='./label_words.csv')
    parser.add_argument(
        '--norm-config', '-n', type=A.lower_str, default='default',
        help='Specify how to normalize an image as preprocessing.')
    parser.add_argument(
        '--disable-dataset-size-error', '-E', action='store_false', default=True, dest='raise_dataset_size',
        help='If not set, raising an error when the dataset size is divisible by (batch_size * num workers)')
    args = parser.parse_args()

    # See available archs
    A.check_arch_or_die(args.arch)
    return args
Example #2
0
def get_args():
    import argparse
    import args as A
    parser = argparse.ArgumentParser(description='Inference.')
    A.add_runtime_args(parser)
    A.add_arch_args(parser)
    parser.add_argument("input_image", help='Path to an input image.')
    parser.add_argument("weights", help='Path to a trained parameter h5 file.')
    parser.add_argument(
        '--labels',
        help=
        'Path to a label name file which contain label names as csv compatible with `label_words.csv`.',
        default='./label_words.csv')
    parser.add_argument(
        '--norm-config',
        '-n',
        type=A.lower_str,
        default='default',
        help='Specify how to normalize an image as preprocessing.')
    parser.add_argument("--channel-last",
                        action='store_true',
                        help='Use a model with NHWC layout.')
    parser.add_argument("--spatial-size",
                        type=int,
                        default=224,
                        nargs="+",
                        help='Spatial size.')
    args = parser.parse_args()

    # Post process
    A.post_process_spatial_size(args)

    # See available archs
    A.check_arch_or_die(args.arch)
    return args
Example #3
0
def get_args():
    import argparse
    import args as A
    parser = argparse.ArgumentParser(description='Inference.')
    A.add_runtime_args(parser)
    A.add_arch_args(parser)
    parser.add_argument("input_image", help='Path to an input image.')
    parser.add_argument("weights", help='Path to a trained parameter h5 file.')
    parser.add_argument(
        '--labels',
        help=
        'Path to a label name file which contain label names as csv compatible with `label_words.csv`.',
        default='./label_words.csv')
    parser.add_argument(
        '--norm-config',
        '-n',
        type=A.lower_str,
        default='default',
        help='Specify how to normalize an image as preprocessing.')
    args = parser.parse_args()

    # See available archs
    A.check_arch_or_die(args.arch)
    return args