|
28 | 28 | parser.add_argument("--img-exts", default=['png', 'jpg', 'bmp'], nargs='*', type=str, help="images extensions to glob") |
29 | 29 | parser.add_argument('--max_flow', default=None, type=float, |
30 | 30 | help='max flow value. Flow map color is saturated above this value. If not set, will use flow map\'s max value') |
31 | | -parser.add_argument('--no-resize', action='store_true', help='if set, will output FlowNet raw input, which is 4 times downsampled.' |
32 | | - 'if not set, will output full resolution flow map, with bilinear upsampling') |
| 31 | +parser.add_argument('--upsampling', '-u', choices=['nearest', 'bilinear'], default=None, help='if not set, will output FlowNet raw input,' |
| 32 | + 'which is 4 times downsampled. If set, will output full resolution flow map, with selected upsampling') |
33 | 33 | parser.add_argument('--bidirectional', action='store_true', help='if set, will output invert flow (from 1 to 0) along with regular flow') |
34 | 34 |
|
35 | 35 |
|
@@ -81,8 +81,8 @@ def main(): |
81 | 81 |
|
82 | 82 | # compute output |
83 | 83 | output = model(input_var) |
84 | | - if not args.no_resize: |
85 | | - output = torch.nn.functional.upsample(output, size=img1.size()[-2:], mode='bilinear') |
| 84 | + if args.upsampling is not None: |
| 85 | + output = torch.nn.functional.upsample(output, size=img1.size()[-2:], mode=args.upsampling) |
86 | 86 | for suffix, flow_output in zip(['flow', 'inv_flow'], output.data.cpu()): |
87 | 87 | rgb_flow = flow2rgb(args.div_flow * flow_output.numpy(), max_value=args.max_flow) |
88 | 88 | to_save = (rgb_flow * 255).astype(np.uint8) |
|
0 commit comments