|
33 | 33 | " - [Change Batch Size](#Change-Batch-Size)\n",
|
34 | 34 | " - [Caching a Model](#Caching-a-Model)\n",
|
35 | 35 | " \n",
|
36 |
| - "The notebook is divided into sections with headers. Each section is standalone and does not depend on any previous sections except for the next cell with imports. A segmentation and classification OpenVINO IR model and a segmentation ONNX model are provided as examples. These model files can be replaced with your own models. The exact outputs will be different, but the process is the same. " |
| 36 | + "The notebook is divided into sections with headers. The next cell contains global requirements installation and imports. Each section is standalone and does not depend on any previous sections. A segmentation and classification OpenVINO IR model and a segmentation ONNX model are provided as examples. These model files can be replaced with your own models. The exact outputs will be different, but the process is the same. " |
37 | 37 | ]
|
38 | 38 | },
|
39 | 39 | {
|
|
44 | 44 | "outputs": [],
|
45 | 45 | "source": [
|
46 | 46 | "# Required imports. Please execute this cell first.\n",
|
47 |
| - "import sys\n", |
| 47 | + "!pip install -q \"openvino>=2023.0.0\"\n", |
| 48 | + "!pip install requests tqdm\n", |
| 49 | + "\n", |
| 50 | + "# Fetch `notebook_utils` module\n", |
| 51 | + "import urllib.request\n", |
| 52 | + "urllib.request.urlretrieve(\n", |
| 53 | + " url='https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/main/notebooks/utils/notebook_utils.py',\n", |
| 54 | + " filename='notebook_utils.py'\n", |
| 55 | + ")\n", |
48 | 56 | "\n",
|
49 |
| - "sys.path.append('../utils')\n", |
50 | 57 | "from notebook_utils import download_file"
|
51 | 58 | ]
|
52 | 59 | },
|
|
588 | 595 | "Creating OpenVINO Core and model compilation is covered in the previous steps. The next step is preparing an inference request. To do inference on a model, first create an inference request by calling the `create_infer_request()` method of `CompiledModel`, `compiled_model` that was loaded with `compile_model()`. Then, call the `infer()` method of `InferRequest`. It expects one argument: `inputs`. This is a dictionary that maps input layer names to input data or list of input data in np.ndarray format, where the position of the input tensor corresponds to input index. If a model has a single input, wrapping to a dictionary or list can be omitted. "
|
589 | 596 | ]
|
590 | 597 | },
|
| 598 | + { |
| 599 | + "cell_type": "code", |
| 600 | + "execution_count": null, |
| 601 | + "id": "d64830f0", |
| 602 | + "metadata": {}, |
| 603 | + "outputs": [], |
| 604 | + "source": [ |
| 605 | + "# Install opencv package for image handling\n", |
| 606 | + "!pip install -q opencv-python" |
| 607 | + ] |
| 608 | + }, |
591 | 609 | {
|
592 | 610 | "attachments": {},
|
593 | 611 | "cell_type": "markdown",
|
|
649 | 667 | "source": [
|
650 | 668 | "import cv2\n",
|
651 | 669 | "\n",
|
652 |
| - "image_filename = \"../data/image/coco_hollywood.jpg\"\n", |
653 |
| - "image = cv2.imread(image_filename)\n", |
| 670 | + "image_filename = download_file(\n", |
| 671 | + " \"https://storage.openvinotoolkit.org/repositories/openvino_notebooks/data/data/image/coco_hollywood.jpg\",\n", |
| 672 | + " directory=\"data\"\n", |
| 673 | + ")\n", |
| 674 | + "image = cv2.imread(str(image_filename))\n", |
654 | 675 | "image.shape"
|
655 | 676 | ]
|
656 | 677 | },
|
|
0 commit comments