|
31 | 31 | parser.add_argument('--grpc_address',required=False, default='localhost', help='Specify url to grpc service. default:localhost')
|
32 | 32 | parser.add_argument('--grpc_port',required=False, default=9000, help='Specify port to grpc service. default: 9000')
|
33 | 33 | parser.add_argument('--input_name',required=False, default='input', help='Specify input tensor name. default: input')
|
34 |
| -parser.add_argument('--output_name',required=False, default='resnet_v1_50/predictions/Reshape_1', help='Specify output name. default: resnet_v1_50/predictions/Reshape_1') |
| 34 | +parser.add_argument('--output_name',required=False, default='resnet_v1_50/predictions/Reshape_1', |
| 35 | + help='Specify output name. default: resnet_v1_50/predictions/Reshape_1') |
35 | 36 | parser.add_argument('--transpose_input', choices=["False", "True"], default="True",
|
36 |
| - help='Set to False to skip NHWC->NCHW input transposing. default: True', |
| 37 | + help='Set to False to skip NHWC>NCHW or NCHW>NHWC input transposing. default: True', |
37 | 38 | dest="transpose_input")
|
| 39 | +parser.add_argument('--transpose_method', choices=["nchw2nhwc","nhwc2nchw"], default="nhwc2nchw", |
| 40 | + help="How the input transposition should be executed: nhwc2nchw or nhwc2nchw", |
| 41 | + dest="transpose_method") |
38 | 42 | parser.add_argument('--iterations', default=0,
|
39 | 43 | help='Number of requests iterations, as default use number of images in numpy memmap. default: 0 (consume all frames)',
|
40 | 44 | dest='iterations', type=int)
|
|
78 | 82 | print('\tModel name: {}'.format(args.get('model_name')))
|
79 | 83 | print('\tIterations: {}'.format(iterations))
|
80 | 84 | print('\tImages numpy path: {}'.format(args.get('images_numpy_path')))
|
| 85 | +if args.get('transpose_input') == "True": |
| 86 | + if args.get('transpose_method') == "nhwc2nchw": |
| 87 | + imgs = imgs.transpose((0,3,1,2)) |
| 88 | + if args.get('transpose_method') == "nchw2nhwc": |
| 89 | + imgs = imgs.transpose((0,2,3,1)) |
81 | 90 | print('\tImages in shape: {}\n'.format(imgs.shape))
|
82 | 91 |
|
83 |
| -if args.get('transpose_input') == "True": |
84 |
| - imgs = imgs.transpose((0,3,1,2)) |
85 | 92 | iteration = 0
|
86 | 93 |
|
87 | 94 | while iteration <= iterations:
|
|
0 commit comments