Intel® FPGA AI Suite: Getting Started Guide

ID 768970
Date 4/05/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.2. Preparing OpenVINO™ Model Zoo and Model Optimizer

These instructions assume that you have a copy of OpenVINO™ Model Zoo 2021.4.2 in your $COREDLA_ROOT/demo/open_model_zoo/ directory. You can use the copy of Model Zoo that was installed with OpenVINO™ or download a fresh copy.

To use the copy of Model Zoo that was installed with OpenVINO™ , run the following commands:
cp -r $INTEL_OPENVINO_DIR/deployment_tools/open_model_zoo \
    $COREDLA_WORK/demo
If you want to download a fresh copy of Model Zoo instead, run the following commands:
cd $COREDLA_WORK/demo
git clone https://github.com/openvinotoolkit/open_model_zoo.git
cd open_model_zoo
git checkout 2021.4.2

Although have already installed OpenVINO™ (for instructions, see Related Links that follow)), you must install additional dependencies to enable the Model Optimizer tool within OpenVINO™ .

The set of required dependencies varies depending on the framework (such as Caffe, TensorFlow, or TensorFlow 2). The following commands enable the Model Optimizer with the TensorFlow 1 framework, which is used in this tutorial.

To create the Python virtual environment that supports the OpenVINO™ Model Optimizer, run the following commands:

Red Hat* Enterprise Linux* 8.7

cd $COREDLA_WORK/demo/open_model_zoo
python3.6 -m venv venv
. venv/bin/activate
pip3 install --upgrade pip
mo_dir=$INTEL_OPENVINO_DIR/deployment_tools/model_optimizer
cp $mo_dir/requirements.txt .
sed -i -e 's/onnx>=/onnx==/' requirements.txt
pip3 install -r requirements.txt
pip3 install -r $mo_dir/requirements_tf.txt
pip3 install -r tools/downloader/requirements.in
pip3 install -r tools/downloader/requirements-tensorflow.in

Ubuntu* 18.04

cd $COREDLA_WORK/demo/open_model_zoo
python3.7 -m venv venv
. venv/bin/activate
pip3 install --upgrade pip
mo_dir=$INTEL_OPENVINO_DIR/deployment_tools/model_optimizer
pip3 install -r $mo_dir/requirements.txt
pip3 install -r $mo_dir/requirements_tf.txt
pip3 install -r tools/downloader/requirements.in
pip3 install -r tools/downloader/requirements-tensorflow.in

Ubuntu* 20.04

sudo apt-get install software-properties-common
# The -E sudo option in the following command
# helps with some proxy configurations 
sudo -E add-apt-repository ppa:deadsnakes/ppa
sudo apt update 
sudo apt install python3.7
sudo apt install python3.7-venv
cd $COREDLA_WORK/demo/open_model_zoo
python3.7 -m venv venv
. venv/bin/activate
pip3 install --upgrade pip
mo_dir=$INTEL_OPENVINO_DIR/deployment_tools/model_optimizer
pip3 install -r $mo_dir/requirements.txt
pip3 install -r $mo_dir/requirements_tf.txt
pip3 install -r tools/downloader/requirements.in
pip3 install -r tools/downloader/requirements-tensorflow.in

You need to run these commands only once, but you must activate the virtual environment with the venv/bin/activate command whenever you have a new shell and want to use OpenVINO™ Model Optimizer with a model based on TensorFlow 1.0.

Use the following command to activate the Model Optimizer virtual environment:
source $COREDLA_WORK/demo/open_model_zoo/venv/bin/activate