Learn Model Inference with OpenVINO™ API in JupyterLab* Environment¶
JupyterLab* Environment delivered by the DL Workbench helps you learn how to use OpenVINO™, its Python* API, and its components essential to analyze and optimize models. The environment enables you to quick start with OpenVINO™ by providing a preconfigured OpenVINO™ environment.
Access the JupyterLab¶
The JupyterLab* notebooks are running in the same environment as the DL Workbench. Refer to Run DL Workbench instructions, to start DL Workbench.
Go to the JupyterLab* Environment¶
Choose one of the ways to access the notebooks:
By clicking LEARN OPENVINO on the top header of the tool.
From the Learn OpenVINO tab on the Projects page. This works only if you have created a project.
The playground opens in a new tab. Make sure your browser does not block pop-ups.
Learn Model Inference with OpenVINO API¶
The JupyterLab* provides you with tutorials that show how to infer a model using OpenVINO™ Python interface. The tutorials are listed below. Decide on what use case you want to work with and open the notebook with the relevant tutorial:
If you could not find your use case in the list above, open the Generic tutorial:
If you opened the playground from the Learn OpenVINO tab and the DL Workbench recognized the task of your model, you go directly to the associated tutorial. See You Have a Model Imported into the DL Workbench for next steps.
Decide on the model you want to work with:
You want to work with a model that you imported into the DL Workbench
You want to work with a model that you have on your machine
You do not have a model
You Have a Model Imported into the DL Workbench¶
To use the same model, sample image, and/or the device that you imported into or used in the DL Workbench, follow the steps below.
Create a project in the DL Workbench.
On the Projects page, go to the Learn OpenVINO tab.
Copy the paths and device name from the Learn OpenVINO tab in the DL Workbench and paste them into correct places:
Find the paths to IR files in the the cell under the Requirements section in the Configure an Inference step, replace them with the paths displayed on the Learn OpenVINO tab.
Find the path to an image in the cell under the Optional Parameters section in the Configure an Inference step. Replace it with the path displayed on the Learn OpenVINO tab.
Find the device name in the cell under the Optional Parameters section in the Configure an Inference step as in the image above. Replace it with the device displayed on the Learn OpenVINO tab.
Run all code cells.
You Have a Model on Your Machine¶
To use a model, sample image, and/or device other than those specified in a tutorial, follow the steps below.
OpenVINO™ works with Intermediate Representation (IR) and ONNX* formats. IR is a preferred format. If you upload an original model, convert it into the IR format. To do that, create a new cell in the notebook, and call the OpenVINO™ Model Optimizer. Your command should start with
!python3 /opt/intel/openvino/tools/model_optimizer/mo.py ....
Upload the files to the playground using the upload icon under the top menu:
Replace the paths and device name in the notebook:
Find the paths to IR files in the the cell under the Requirements section in the Configure an Inference step. Replace them with the paths of IR files that you uploaded.
Find the path to an image in the cell under the Optional Parameters section in the Configure an Inference step. Replace it with the path to the image you uploaded.
Find the device name in the cell under the Optional Parameters section in the Configure an Inference step as in the image above. Replace it with the name of the device that you want to use. See the Supported Inference Devices of Install DL Workbench for reference.
Run all code cells.
You Do Not Have a Model¶
If you do not have a model, you still can use the tutorials. Intel® Open Model Zoo provides pretrained models for various use cases. Also, each notebook already has a selected model in it, so simply run all the cells to see how the model works in the OpenVINO™ environment. Feel free to change the model and experiment with another one.
WARNING : Be cautious when working with files and folders available in JupyterLab. It is recommended to work with a limited set of folders to ensure that the DL Workbench and JupyterLab continue working:
datasets. Contains all datasets imported in the DL Workbench. Feel free to open and use images from the folder, however, do not change the content.
models. Contains all models imported in the DL Workbench. Feel free to use models from the folder, however, do not change the content.
tutorials. Contains Jupyter notebooks with a full inference workflow for different use cases. Feel free to change the content of the folder.