From a9cee5f10192a32637da343c7daf811551e39f8c Mon Sep 17 00:00:00 2001 From: Vladimir Dudnik Date: Mon, 27 Dec 2021 09:19:18 +0300 Subject: [PATCH] [IE Samples] OV2.0 API python ngraph_function_creation_sample (#9440) * [IE Python Speech Sample] Migrate to OV 2.0 API * improvements * flake notes * improved code style like as C++ * linters changes * changed data.py * sync output with C++ sample Co-authored-by: Maxim Gordeev --- .../ngraph_function_creation_sample/data.py | 420 ++++++++++++++++++ .../ngraph_function_creation_sample.py | 239 ++++------ 2 files changed, 514 insertions(+), 145 deletions(-) create mode 100644 samples/python/ngraph_function_creation_sample/data.py diff --git a/samples/python/ngraph_function_creation_sample/data.py b/samples/python/ngraph_function_creation_sample/data.py new file mode 100644 index 00000000000..7fb968577fc --- /dev/null +++ b/samples/python/ngraph_function_creation_sample/data.py @@ -0,0 +1,420 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +import numpy + +digits = numpy.array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0b, 0x96, 0xfd, 0xca, 0x1f, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0x25, 0xfb, 0xfb, 0xfd, 0x6b,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0x83, 0xfe, 0xfe, 0xf4, 0x40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0d, 0xf9, 0xfe, 0xfe, 0x98, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0c, 0xe4, + 0xfe, 0xfe, 0xd0, 0x08, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0x4e, 0xff, 0xfe, 0xfe, 0x42, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xd1, 0xfe, 0xfe, + 0x89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0xe3, 0xff, 0xe9, 0x19, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x71, 0xff, 0x6c, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0]]) diff --git a/samples/python/ngraph_function_creation_sample/ngraph_function_creation_sample.py b/samples/python/ngraph_function_creation_sample/ngraph_function_creation_sample.py index 47fc46353b5..70cd4089dc6 100755 --- a/samples/python/ngraph_function_creation_sample/ngraph_function_creation_sample.py +++ b/samples/python/ngraph_function_creation_sample/ngraph_function_creation_sample.py @@ -2,110 +2,67 @@ # -*- coding: utf-8 -*- # Copyright (C) 2018-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -import argparse import logging as log -import struct as st import sys import typing from functools import reduce -import cv2 -import ngraph -from ngraph.opset1 import max_pool import numpy as np -from openvino.inference_engine import IECore, IENetwork +from openvino.preprocess import PrePostProcessor +from openvino.runtime import Core, Layout, Type, Model, Shape, PartialShape +import openvino +from data import digits -def parse_args() -> argparse.Namespace: - """Parse and return command line arguments""" - parser = argparse.ArgumentParser(add_help=False) - args = parser.add_argument_group('Options') - # fmt: off - args.add_argument('-h', '--help', action='help', help='Show this help message and exit.') - args.add_argument('-m', '--model', required=True, type=str, - help='Required. Path to a file with network weights.') - args.add_argument('-i', '--input', required=True, type=str, nargs='+', help='Required. Path to an image file.') - args.add_argument('-d', '--device', default='CPU', type=str, - help='Optional. Specify the target device to infer on; CPU, GPU, MYRIAD, HDDL or HETERO: ' - 'is acceptable. The sample will look for a suitable plugin for device specified. ' - 'Default value is CPU.') - args.add_argument('--labels', default=None, type=str, help='Optional. Path to a labels mapping file.') - args.add_argument('-nt', '--number_top', default=10, type=int, help='Optional. Number of top results.') - # fmt: on - return parser.parse_args() - - -def read_image(image_path: str) -> np.ndarray: - """Read and return an image as grayscale (one channel)""" - image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE) - - # Try to open image as ubyte - if image is None: - with open(image_path, 'rb') as f: - st.unpack('>4B', f.read(4)) # need to skip 4 bytes - nimg = st.unpack('>I', f.read(4))[0] # number of images - nrow = st.unpack('>I', f.read(4))[0] # number of rows - ncolumn = st.unpack('>I', f.read(4))[0] # number of column - nbytes = nimg * nrow * ncolumn * 1 # each pixel data is 1 byte - - if nimg != 1: - raise Exception('Sample supports ubyte files with 1 image inside') - - image = np.asarray(st.unpack('>' + 'B' * nbytes, f.read(nbytes))).reshape((nrow, ncolumn)) - - return image - - -def create_ngraph_function(args: argparse.Namespace) -> ngraph.impl.Function: +def create_ngraph_function(model_path: str) -> Model: """Create a network on the fly from the source code using ngraph""" def shape_and_length(shape: list) -> typing.Tuple[list, int]: length = reduce(lambda x, y: x * y, shape) return shape, length - weights = np.fromfile(args.model, dtype=np.float32) + weights = np.fromfile(model_path, dtype=np.float32) weights_offset = 0 padding_begin = padding_end = [0, 0] # input input_shape = [64, 1, 28, 28] - param_node = ngraph.parameter(input_shape, np.float32, 'Parameter') + param_node = openvino.runtime.op.Parameter(Type.f32, Shape(input_shape)) # convolution 1 conv_1_kernel_shape, conv_1_kernel_length = shape_and_length([20, 1, 5, 5]) - conv_1_kernel = ngraph.constant(weights[0:conv_1_kernel_length].reshape(conv_1_kernel_shape)) + conv_1_kernel = openvino.runtime.op.Constant(Type.f32, Shape(conv_1_kernel_shape), weights[0:conv_1_kernel_length].tolist()) weights_offset += conv_1_kernel_length - conv_1_node = ngraph.convolution(param_node, conv_1_kernel, [1, 1], padding_begin, padding_end, [1, 1]) + conv_1_node = openvino.runtime.opset8.convolution(param_node, conv_1_kernel, [1, 1], padding_begin, padding_end, [1, 1]) # add 1 add_1_kernel_shape, add_1_kernel_length = shape_and_length([1, 20, 1, 1]) - add_1_kernel = ngraph.constant( - weights[weights_offset : weights_offset + add_1_kernel_length].reshape(add_1_kernel_shape), - ) + add_1_kernel = openvino.runtime.op.Constant(Type.f32, Shape(add_1_kernel_shape), + weights[weights_offset : weights_offset + add_1_kernel_length]) weights_offset += add_1_kernel_length - add_1_node = ngraph.add(conv_1_node, add_1_kernel) + add_1_node = openvino.runtime.opset8.add(conv_1_node, add_1_kernel) # maxpool 1 - maxpool_1_node = max_pool(add_1_node, [2, 2], padding_begin, padding_end, [2, 2], 'ceil') + maxpool_1_node = openvino.runtime.opset1.max_pool(add_1_node, [2, 2], padding_begin, padding_end, [2, 2], 'ceil') # convolution 2 conv_2_kernel_shape, conv_2_kernel_length = shape_and_length([50, 20, 5, 5]) - conv_2_kernel = ngraph.constant( - weights[weights_offset : weights_offset + conv_2_kernel_length].reshape(conv_2_kernel_shape), - ) + conv_2_kernel = openvino.runtime.op.Constant(Type.f32, Shape(conv_2_kernel_shape), + weights[weights_offset : weights_offset + conv_2_kernel_length], + ) weights_offset += conv_2_kernel_length - conv_2_node = ngraph.convolution(maxpool_1_node, conv_2_kernel, [1, 1], padding_begin, padding_end, [1, 1]) + conv_2_node = openvino.runtime.opset8.convolution(maxpool_1_node, conv_2_kernel, [1, 1], padding_begin, padding_end, [1, 1]) # add 2 add_2_kernel_shape, add_2_kernel_length = shape_and_length([1, 50, 1, 1]) - add_2_kernel = ngraph.constant( - weights[weights_offset : weights_offset + add_2_kernel_length].reshape(add_2_kernel_shape), - ) + add_2_kernel = openvino.runtime.op.Constant(Type.f32, Shape(add_2_kernel_shape), + weights[weights_offset : weights_offset + add_2_kernel_length], + ) weights_offset += add_2_kernel_length - add_2_node = ngraph.add(conv_2_node, add_2_kernel) + add_2_node = openvino.runtime.opset8.add(conv_2_node, add_2_kernel) # maxpool 2 - maxpool_2_node = max_pool(add_2_node, [2, 2], padding_begin, padding_end, [2, 2], 'ceil') + maxpool_2_node = openvino.runtime.opset1.max_pool(add_2_node, [2, 2], padding_begin, padding_end, [2, 2], 'ceil') # reshape 1 reshape_1_dims, reshape_1_length = shape_and_length([2]) @@ -114,142 +71,134 @@ def create_ngraph_function(args: argparse.Namespace) -> ngraph.impl.Function: weights[weights_offset : weights_offset + 2 * reshape_1_length], dtype=np.int64, ) - reshape_1_kernel = ngraph.constant(dtype_weights) + reshape_1_kernel = openvino.runtime.op.Constant(Type.i64, Shape(list(dtype_weights.shape)), dtype_weights) weights_offset += 2 * reshape_1_length - reshape_1_node = ngraph.reshape(maxpool_2_node, reshape_1_kernel, True) + reshape_1_node = openvino.runtime.opset8.reshape(maxpool_2_node, reshape_1_kernel, True) # matmul 1 matmul_1_kernel_shape, matmul_1_kernel_length = shape_and_length([500, 800]) - matmul_1_kernel = ngraph.constant( - weights[weights_offset : weights_offset + matmul_1_kernel_length].reshape(matmul_1_kernel_shape), - ) + matmul_1_kernel = openvino.runtime.op.Constant(Type.f32, Shape(matmul_1_kernel_shape), + weights[weights_offset : weights_offset + matmul_1_kernel_length], + ) weights_offset += matmul_1_kernel_length - matmul_1_node = ngraph.matmul(reshape_1_node, matmul_1_kernel, False, True) + matmul_1_node = openvino.runtime.opset8.matmul(reshape_1_node, matmul_1_kernel, False, True) # add 3 add_3_kernel_shape, add_3_kernel_length = shape_and_length([1, 500]) - add_3_kernel = ngraph.constant( - weights[weights_offset : weights_offset + add_3_kernel_length].reshape(add_3_kernel_shape), - ) + add_3_kernel = openvino.runtime.op.Constant(Type.f32, Shape(add_3_kernel_shape), + weights[weights_offset : weights_offset + add_3_kernel_length], + ) weights_offset += add_3_kernel_length - add_3_node = ngraph.add(matmul_1_node, add_3_kernel) + add_3_node = openvino.runtime.opset8.add(matmul_1_node, add_3_kernel) # ReLU - relu_node = ngraph.relu(add_3_node) + relu_node = openvino.runtime.opset8.relu(add_3_node) # reshape 2 - reshape_2_kernel = ngraph.constant(dtype_weights) - reshape_2_node = ngraph.reshape(relu_node, reshape_2_kernel, True) + reshape_2_kernel = openvino.runtime.op.Constant(Type.i64, Shape(list(dtype_weights.shape)), dtype_weights) + reshape_2_node = openvino.runtime.opset8.reshape(relu_node, reshape_2_kernel, True) # matmul 2 matmul_2_kernel_shape, matmul_2_kernel_length = shape_and_length([10, 500]) - matmul_2_kernel = ngraph.constant( - weights[weights_offset : weights_offset + matmul_2_kernel_length].reshape(matmul_2_kernel_shape), - ) + matmul_2_kernel = openvino.runtime.op.Constant(Type.f32, Shape(matmul_2_kernel_shape), + weights[weights_offset : weights_offset + matmul_2_kernel_length], + ) weights_offset += matmul_2_kernel_length - matmul_2_node = ngraph.matmul(reshape_2_node, matmul_2_kernel, False, True) + matmul_2_node = openvino.runtime.opset8.matmul(reshape_2_node, matmul_2_kernel, False, True) # add 4 add_4_kernel_shape, add_4_kernel_length = shape_and_length([1, 10]) - add_4_kernel = ngraph.constant( - weights[weights_offset : weights_offset + add_4_kernel_length].reshape(add_4_kernel_shape), - ) + add_4_kernel = openvino.runtime.op.Constant(Type.f32, Shape(add_4_kernel_shape), + weights[weights_offset : weights_offset + add_4_kernel_length], + ) weights_offset += add_4_kernel_length - add_4_node = ngraph.add(matmul_2_node, add_4_kernel) + add_4_node = openvino.runtime.opset8.add(matmul_2_node, add_4_kernel) # softmax softmax_axis = 1 - softmax_node = ngraph.softmax(add_4_node, softmax_axis) + softmax_node = openvino.runtime.opset8.softmax(add_4_node, softmax_axis) - # result - result_node = ngraph.result(softmax_node) - return ngraph.impl.Function(result_node, [param_node], 'lenet') + return Model(softmax_node, [param_node], 'lenet') def main(): log.basicConfig(format='[ %(levelname)s ] %(message)s', level=log.INFO, stream=sys.stdout) - args = parse_args() + # Parsing and validation of input arguments + if len(sys.argv) != 3: + log.info('Usage: ') + return 1 + model_path = sys.argv[1] + device_name = sys.argv[2] + labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] + number_top = 1 # ---------------------------Step 1. Initialize inference engine core-------------------------------------------------- - log.info('Creating Inference Engine') - ie = IECore() + log.info('Creating OpenVINO Runtime Core') + core = Core() # ---------------------------Step 2. Read a model in OpenVINO Intermediate Representation------------------------------ - log.info(f'Loading the network using ngraph function with weights from {args.model}') - ngraph_function = create_ngraph_function(args) - net = IENetwork(ngraph.impl.Function.to_capsule(ngraph_function)) - - # ---------------------------Step 3. Configure input & output---------------------------------------------------------- - log.info('Configuring input and output blobs') + log.info(f'Loading the network using ngraph function with weights from {model_path}') + model = create_ngraph_function(model_path) + # ---------------------------Step 3. Apply preprocessing---------------------------------------------------------- # Get names of input and output blobs - input_blob = next(iter(net.input_info)) - out_blob = next(iter(net.outputs)) + ppp = PrePostProcessor(model) + # 1) Set input tensor information: + # - input() provides information about a single model input + # - precision of tensor is supposed to be 'u8' + # - layout of data is 'NHWC' + ppp.input().tensor() \ + .set_element_type(Type.u8) \ + .set_layout(Layout('NHWC')) # noqa: N400 - # Set input and output precision manually - net.input_info[input_blob].precision = 'U8' - net.outputs[out_blob].precision = 'FP32' + # 2) Here we suppose model has 'NCHW' layout for input + ppp.input().model().set_layout(Layout('NCHW')) + # 3) Set output tensor information: + # - precision of tensor is supposed to be 'f32' + ppp.output().tensor().set_element_type(Type.f32) - # Set a batch size to a equal number of input images - net.batch_size = len(args.input) + # 4) Apply preprocessing modifing the original 'model' + model = ppp.build() + + # Set a batch size equal to number of input images + model.reshape({model.input().get_any_name(): PartialShape((digits.shape[0], model.input().shape[1], model.input().shape[2], model.input().shape[3]))}) # ---------------------------Step 4. Loading model to the device------------------------------------------------------- log.info('Loading the model to the plugin') - exec_net = ie.load_network(network=net, device_name=args.device) + compiled_model = core.compile_model(model, device_name) - # ---------------------------Step 5. Create infer request-------------------------------------------------------------- - # load_network() method of the IECore class with a specified number of requests (default 1) returns an ExecutableNetwork - # instance which stores infer requests. So you already created Infer requests in the previous step. - - # ---------------------------Step 6. Prepare input--------------------------------------------------------------------- - n, c, h, w = net.input_info[input_blob].input_data.shape + # ---------------------------Step 5. Prepare input--------------------------------------------------------------------- + n, c, h, w = model.input().shape input_data = np.ndarray(shape=(n, c, h, w)) - for i in range(n): - image = read_image(args.input[i]) - - light_pixel_count = np.count_nonzero(image > 127) - dark_pixel_count = np.count_nonzero(image < 127) - is_light_image = (light_pixel_count - dark_pixel_count) > 0 - - if is_light_image: - log.warning(f'Image {args.input[i]} is inverted to white over black') - image = cv2.bitwise_not(image) - - if image.shape != (h, w): - log.warning(f'Image {args.input[i]} is resized from {image.shape} to {(h, w)}') - image = cv2.resize(image, (w, h)) - + image = digits[i].reshape(28, 28) + image = image[:, :, np.newaxis] input_data[i] = image - # ---------------------------Step 7. Do inference---------------------------------------------------------------------- + # ---------------------------Step 6. Do inference---------------------------------------------------------------------- log.info('Starting inference in synchronous mode') - res = exec_net.infer(inputs={input_blob: input_data}) + results = compiled_model.infer_new_request({0: input_data}) - # ---------------------------Step 8. Process output-------------------------------------------------------------------- - # Generate a label list - if args.labels: - with open(args.labels, 'r') as f: - labels = [line.split(',')[0].strip() for line in f] - - res = res[out_blob] + # ---------------------------Step 7. Process output-------------------------------------------------------------------- + predictions = next(iter(results.values())) + log.info(f'Top {number_top} results: ') for i in range(n): - probs = res[i] - # Get an array of args.number_top class IDs in descending order of probability - top_n_idexes = np.argsort(probs)[-args.number_top :][::-1] + probs = predictions[i] + # Get an array of number_top class IDs in descending order of probability + top_n_idexes = np.argsort(probs)[-number_top :][::-1] header = 'classid probability' - header = header + ' label' if args.labels else header + header = header + ' label' if labels else header - log.info(f'Image path: {args.input[i]}') - log.info(f'Top {args.number_top} results: ') + log.info(f'Image {i}') + log.info('') log.info(header) log.info('-' * len(header)) for class_id in top_n_idexes: probability_indent = ' ' * (len('classid') - len(str(class_id)) + 1) - label_indent = ' ' * (len('probability') - 8) if args.labels else '' - label = labels[class_id] if args.labels else '' + label_indent = ' ' * (len('probability') - 8) if labels else '' + label = labels[class_id] if labels else '' log.info(f'{class_id}{probability_indent}{probs[class_id]:.7f}{label_indent}{label}') log.info('')