| 45 | |
| 46 | |
| 47 | def get_args(): |
| 48 | parser = argparse.ArgumentParser(description='Predict masks from input images') |
| 49 | parser.add_argument('--model', '-m', default='MODEL.pth', metavar='FILE', |
| 50 | help='Specify the file in which the model is stored') |
| 51 | parser.add_argument('--input', '-i', metavar='INPUT', nargs='+', help='Filenames of input images', required=True) |
| 52 | parser.add_argument('--output', '-o', metavar='INPUT', nargs='+', help='Filenames of output images') |
| 53 | parser.add_argument('--viz', '-v', action='store_true', |
| 54 | help='Visualize the images as they are processed') |
| 55 | parser.add_argument('--no-save', '-n', action='store_true', help='Do not save the output masks') |
| 56 | parser.add_argument('--mask-threshold', '-t', type=float, default=0.5, |
| 57 | help='Minimum probability value to consider a mask pixel white') |
| 58 | parser.add_argument('--scale', '-s', type=float, default=0.5, |
| 59 | help='Scale factor for the input images') |
| 60 | parser.add_argument('--bilinear', action='store_true', default=False, help='Use bilinear upsampling') |
| 61 | |
| 62 | return parser.parse_args() |
| 63 | |
| 64 | |
| 65 | def get_output_filenames(args): |