def dump_mode(args):
    net = get_net(model=args.model)
    out_layers = get_layers_list(net.layers, net.inputs, net.outputs, args.layers)
    plugin = get_plugin(args.device, args.l, args.plugin_path, args.config)
    inputs = input_processing(args.model, net.inputs, args.input)
    dump_dict = {}
    for out_layer in out_layers:
        log.info('Layer {} processing'.format(out_layer))
        net_copy = get_net_copy_with_output(model=args.model, output=out_layer)
        results = infer(net=net_copy, plugin=plugin, inputs=inputs, output=[out_layer])
        if out_layer not in results:
            continue
        out_blob, pc = results[out_layer]
        dump_dict[out_layer] = np.array({'blob': out_blob, 'pc': pc})
    dump_output_file(args.model + '_' + plugin.device + '_dump.npz', dump_dict)
Exemple #2
0
def dump_mode(args):
    core = get_plugin(args.device, args.l, args.config)
    net = get_net(model=args.model, core=core)
    func = ng.function_from_cnn(net)
    ops = func.get_ops()
    out_layers = get_layers_list(ops, net.input_info, net.outputs, args.layers)
    inputs = input_processing(args.model, net.input_info, args.input)
    dump_dict = {}
    for out_layer in out_layers:
        log.info('Layer {} processing'.format(out_layer))
        net_copy = get_net_copy_with_output(model=args.model, output=out_layer, core=core)
        results = infer(net=net_copy, core=core, device=args.device, inputs=inputs, output=[out_layer])
        if out_layer not in results:
            continue
        out_blob, pc = results[out_layer]
        dump_dict[out_layer] = np.array({'blob': out_blob, 'pc': pc})
    dump_output_file(args.model + '_' + args.device + '_dump.npz', dump_dict)