garlicbulb-puzhuo / ggo

1 stars 0 forks source link

Clean up parsers #50

Closed tomowind closed 7 years ago

tomowind commented 7 years ago

See this example:

def get_parser():
    parser = argparse.ArgumentParser(description='Prediction.')
    parser.add_argument('--input_path', metavar='input_path', nargs='?',
                        help='test data directory containing numpy formatted images and masks in the test set')
    parser.add_argument('--model_id', metavar='model_id', nargs='?', type=int,
                        help='model_id')
    parser.add_argument('--model_weights', metavar='model_weights', nargs='?',
                        help='trained model weights file')
    parser.add_argument('--output_path', metavar='output_path', nargs='?',
                        help='output directory to store predition ')
    return parser

We have to change it like this:

def get_parser():
    parser = argparse.ArgumentParser(description='Prediction.')
    parser.add_argument('-i', '--input-path', required=True,
                        help='test data directory containing numpy formatted images and masks in the test set')
    parser.add_argument('-m', '--model_id', required=True, type=int,
                        help='model_id')
    parser.add_argument('-w', '--model_weights', required=True,
                        help='trained model weights file')
    parser.add_argument('-o', '--output_path', required=True,
                        help='output directory to store predition ')
    return parser

And remove this code:

    if not args.model_id:
        parser.error('Required to set --model_id')

    if not args.input_path:
        parser.error('Required to set --test_path')

Do this clean up in all files.