Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This repository contains the source code of **OpenVINO™ integration with Tenso

- Ubuntu 18.04, 20.04
- Python 3.6, 3.7, or 3.8
- TensorFlow v2.4.1
- TensorFlow v2.5.0

Check our [Interactive Installation Table](https://openvinotoolkit.github.io/openvino_tensorflow/) for a menu of installation options. The table will help you configure the installation process.

Expand All @@ -30,7 +30,7 @@ This **OpenVINO™ integration with TensorFlow** package comes with pre-built li


pip3 install -U pip==21.0.1
pip3 install -U tensorflow==2.4.1
pip3 install -U tensorflow==2.5.0
pip3 install openvino-tensorflow


Expand All @@ -49,10 +49,10 @@ To see if **OpenVINO™ integration with TensorFlow** is properly installed, run

This should produce an output like:

TensorFlow version: 2.4.1
TensorFlow version: 2.5.0
OpenVINO integration with TensorFlow version: b'0.5.0'
OpenVINO version used for this build: b'2021.3'
TensorFlow version used for this build: v2.4.1
TensorFlow version used for this build: v2.5.0
CXX11_ABI flag used for this build: 0
OpenVINO integration with TensorFlow built with Grappler: False

Expand Down
16 changes: 14 additions & 2 deletions build_ov.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ def main():

if not os.path.isdir(arguments.output_dir):
os.makedirs(arguments.output_dir)
assert os.path.exists(
arguments.output_dir), "path doesn't exist {0}".format(
arguments.output_dir)
os.chdir(arguments.output_dir)

assert os.path.exists(
arguments.output_dir), "Directory doesn't exist {0}".format(
arguments.output_dir)
if not os.path.isdir(os.path.join(arguments.output_dir, "openvino")):
# Download OpenVINO
download_repo(
Expand All @@ -49,12 +54,19 @@ def main():
submodule_update=True)
else:
pwd = os.getcwd()
assert os.path.exists(
arguments.output_dir), "path doesn't exist {0}".format(
arguments.output_dir)
os.chdir(os.path.join(arguments.output_dir, "openvino"))
call(["git", "fetch"])
command_executor(["git", "checkout", openvino_version])
call(["git", "pull"])
assert os.path.exists(pwd), "Path doesn't exist {0}".format(pwd)
os.chdir(pwd)

assert os.path.exists(
os.path.join(arguments.output_dir,
"openvino")), "Path doesn't exist {0}/openvino".format(
arguments.output_dir)
openvino_src_dir = os.path.join(arguments.output_dir, "openvino")
print("OV_SRC_DIR: ", openvino_src_dir)

Expand Down
32 changes: 28 additions & 4 deletions build_ovtf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def main():
'''

# Component versions
tf_version = "v2.4.1"
tf_version = "v2.5.0"
ovtf_version = "v0.5.0"
use_intel_tf = False

Expand Down Expand Up @@ -193,6 +193,8 @@ def main():
if arguments.use_openvino_from_location != '':
ver_file = arguments.use_openvino_from_location + \
'/deployment_tools/inference_engine/version.txt'
assert os.path.exists(ver_file), "Path doesn't exist {0}".format(
ver_file)
with open(ver_file) as f:
line = f.readline()
assert line.find(arguments.openvino_version) != -1, "OpenVINO version " + \
Expand All @@ -214,6 +216,7 @@ def main():
found_whl = False
found_libtf_fw = False
found_libtf_cc = False
assert os.path.exists(loc), "Path doesn't exist {0}".format(loc)
for i in os.listdir(loc):
if '.whl' in i:
found_whl = True
Expand All @@ -235,6 +238,8 @@ def main():
openvino_tf_src_dir = os.path.abspath(pwd)
print("OVTF SRC DIR: " + openvino_tf_src_dir)
build_dir_abs = os.path.abspath(build_dir)
assert os.path.exists(build_dir_abs), "Directory doesn't exist {}".format(
build_dir_abs)
os.chdir(build_dir)

venv_dir = 'venv-tf-py3'
Expand Down Expand Up @@ -280,6 +285,8 @@ def main():
# The tf whl should be in use_tensorflow_from_location/artifacts/tensorflow
tf_whl_loc = os.path.abspath(arguments.use_tensorflow_from_location +
'/artifacts/tensorflow')
assert os.path.exists(tf_whl_loc), "path doesn't exist {0}".format(
tf_whl_loc)
possible_whl = [i for i in os.listdir(tf_whl_loc) if '.whl' in i]
assert len(
possible_whl
Expand All @@ -296,6 +303,8 @@ def main():
"use_tensorflow_from_location are incompatible")

cwd = os.getcwd()
assert os.path.exists(tf_whl_loc), "Path doesn't exist {0}".format(
tf_whl_loc)
os.chdir(tf_whl_loc)
tf_in_artifacts = os.path.join(
os.path.abspath(artifacts_location), "tensorflow")
Expand All @@ -307,6 +316,7 @@ def main():
tf_version = get_tf_version()
copy_tf_to_artifacts(tf_version, tf_in_artifacts, tf_whl_loc,
use_intel_tf)
assert os.path.exists(cwd), "Path doesn't exist {0}".format(cwd)
os.chdir(cwd)
else:
if not arguments.build_tf_from_source:
Expand All @@ -322,17 +332,17 @@ def main():
if tags.interpreter == "cp36":
command_executor([
"pip", "install",
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.5.0/tensorflow_abi1-2.4.1-cp36-cp36m-manylinux2010_x86_64.whl"
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.6.0/tensorflow_abi1-2.5.0-cp36-cp36m-manylinux2010_x86_64.whl"
])
if tags.interpreter == "cp37":
command_executor([
"pip", "install",
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.5.0/tensorflow_abi1-2.4.1-cp37-cp37m-manylinux2010_x86_64.whl"
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.6.0/tensorflow_abi1-2.5.0-cp37-cp37m-manylinux2010_x86_64.whl"
])
if tags.interpreter == "cp38":
command_executor([
"pip", "install",
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.5.0/tensorflow_abi1-2.4.1-cp38-cp38-manylinux2010_x86_64.whl"
"https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.6.0/tensorflow_abi1-2.5.0-cp38-cp38-manylinux2010_x86_64.whl"
])

# ABI 1 TF required latest numpy
Expand All @@ -348,11 +358,16 @@ def main():
print("TF_SRC_DIR: ", tf_src_dir)
# Download TF source for enabling TF python tests
pwd_now = os.getcwd()
assert os.path.exists(
artifacts_location), "Path doesn't exist {0}".format(
artifacts_location)
os.chdir(artifacts_location)
print("DOWNLOADING TF: PWD", os.getcwd())
download_repo("tensorflow",
"https://github.com/tensorflow/tensorflow.git",
tf_version)
assert os.path.exists(pwd_now), "Path doesn't exist {0}".format(
pwd_now)
os.chdir(pwd_now)
# Finally, copy the libtensorflow_framework.so to the artifacts
if (tf_version.startswith("v1.") or (tf_version.startswith("1."))):
Expand All @@ -366,6 +381,8 @@ def main():
tf_lib_file = os.path.join(tf_lib_dir, tf_fmwk_lib_name)
print("SYSCFG LIB: ", tf_lib_file)
dst_dir = os.path.join(artifacts_location, "tensorflow")
assert os.path.exists(
dst_dir), "Directory doesn't exist {0}".format(dst_dir)
if not os.path.isdir(dst_dir):
os.mkdir(dst_dir)
dst = os.path.join(dst_dir, tf_fmwk_lib_name)
Expand Down Expand Up @@ -493,6 +510,11 @@ def main():
openvino_tf_cmake_flags, verbosity)

# Make sure that the openvino_tensorflow whl is present in the artfacts directory
assert os.path.exists(artifacts_location), "Path not found {}".format(
artifacts_location)
assert os.path.isfile(os.path.join(
artifacts_location,
ov_tf_whl)), "Cannot locate nGraph whl in the artifacts location"
if not os.path.isfile(os.path.join(artifacts_location, ov_tf_whl)):
raise Exception("Cannot locate nGraph whl in the artifacts location")

Expand Down Expand Up @@ -534,6 +556,8 @@ def main():
command_executor(['ln', '-sf', link_src, link_dst], verbose=True)

# Run a quick test
assert os.path.exists(artifacts_location), "Path doesn't exist {}".format(
artifacts_location)
install_openvino_tf(tf_version, venv_dir,
os.path.join(artifacts_location, ov_tf_whl))

Expand Down
14 changes: 11 additions & 3 deletions build_tf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def main():
type=str,
help="TensorFlow tag/branch/SHA\n",
action="store",
default="v2.4.1")
default="v2.5.0")
parser.add_argument(
'--output_dir',
type=str,
Expand Down Expand Up @@ -50,26 +50,34 @@ def main():

assert os.path.isdir(arguments.output_dir), \
"Did not find output directory: " + arguments.output_dir

assert os.path.exists(
arguments.output_dir), "path doesn't exist {0}".format(
arguments.output_dir)
os.chdir(arguments.output_dir)

venv_dir = './venv3/'

install_virtual_env(venv_dir)
load_venv(venv_dir)
setup_venv(venv_dir)

assert os.path.exists(
arguments.output_dir), "Directory doesn't exist {0}".format(
arguments.output_dir)
if not os.path.isdir(os.path.join(arguments.output_dir, "tensorflow")):
# Download TensorFlow
download_repo("tensorflow",
"https://github.com/tensorflow/tensorflow.git",
arguments.tf_version)
else:
pwd = os.getcwd()
assert os.path.exists(
arguments.output_dir), "Path doesn't exist {}".format(
arguments.output_dir)
os.chdir(os.path.join(arguments.output_dir, "tensorflow"))
call(["git", "fetch"])
command_executor(["git", "checkout", arguments.tf_version])
call(["git", "pull"])
assert os.path.exists(pwd), "Path doesn't exist {0}".format(pwd)
os.chdir(pwd)

# Build TensorFlow
Expand Down
2 changes: 2 additions & 0 deletions docs/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ Backend manager creates a backend for the execution of the CNNNetwork. We implem
Basic backend is used for Intel<sup>®</sup> CPUs, Intel<sup>®</sup> integrated GPUs and Intel<sup>®</sup> Movidius™ Vision Processing Units (VPUs). The backend creates an inference request and runs inference on a given input data.

VAD-M backend is used for Intel® Vision Accelerator Design with 8 Intel<sup>®</sup> Movidius™ MyriadX VPUs (referred as VAD-M or HDDL). We support batched inference execution in the VAD-M backend. When the user provides a batched input, multiple inference requests are created and inference is run in parallel on all the available VPUs in the VAD-M.

Backend Manager supports Dynamic Fallback which means if the execution of the corresponding CNNNetwork fails in OpenVINO runtime, the execution fallbacks to stock TensorFlow runtime.
18 changes: 9 additions & 9 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

|Build Type| Requirements|
|:-----------------------|-------------------|
|Use pre-built packages| Python 3.6, 3.7, or 3.8, TensorFlow v2.4.1|
|Use pre-built packages| Python 3.6, 3.7, or 3.8, TensorFlow v2.5.0|
|Build from source| Python 3.6, 3.7, or 3.8, GCC 7.5 (Ubuntu 18.04, 20.04), cmake 3.14 or higher, Bazelisk v1.7.5, virtualenv 16.0.0 or higher, patchelf 0.9, libusb 1.0.0|

## Use Pre-Built Packages
Expand All @@ -24,7 +24,7 @@ This **OpenVINO™ integration with TensorFlow** package includes pre-built libr


pip3 install -U pip==21.0.1
pip3 install -U tensorflow==2.4.1
pip3 install -U tensorflow==2.5.0
pip3 install openvino-tensorflow

### Install **OpenVINO™ integration with TensorFlow** alongside the Intel® Distribution of OpenVINO™ Toolkit
Expand All @@ -40,15 +40,15 @@ You can build TensorFlow from source with -D_GLIBCXX_USE_CXX11_ABI=1 or use the

2. Install `TensorFlow`. Based on your Python version, use the appropriate package below:

pip3.6 install https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.5.0/tensorflow_abi1-2.4.1-cp36-cp36m-manylinux2010_x86_64.whl
pip3.6 install https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.6.0/tensorflow_abi1-2.5.0-cp36-cp36m-manylinux2010_x86_64.whl

or

pip3.7 install https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.5.0/tensorflow_abi1-2.4.1-cp37-cp37m-manylinux2010_x86_64.whl
pip3.7 install https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.6.0/tensorflow_abi1-2.5.0-cp37-cp37m-manylinux2010_x86_64.whl

or

pip3.8 install https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.5.0/tensorflow_abi1-2.4.1-cp38-cp38-manylinux2010_x86_64.whl
pip3.8 install https://github.com/openvinotoolkit/openvino_tensorflow/releases/download/v0.6.0/tensorflow_abi1-2.5.0-cp38-cp38-manylinux2010_x86_64.whl

3. Download & install Intel® Distribution of OpenVINO™ Toolkit 2021.3 release along with its dependencies from ([https://software.intel.com/en-us/openvino-toolkit/download](https://software.intel.com/content/www/us/en/develop/tools/openvino-toolkit/download.html)).

Expand Down Expand Up @@ -142,10 +142,10 @@ Verify that `openvino-tensorflow` is installed correctly:

This should produce an output like:

TensorFlow version: 2.4.1
TensorFlow version: 2.5.0
OpenVINO integration with TensorFlow version: b'0.5.0'
OpenVINO version used for this build: b'2021.3'
TensorFlow version used for this build: v2.4.1
TensorFlow version used for this build: v2.5.0
CXX11_ABI flag used for this build: 1
OpenVINO integration with TensorFlow built with Grappler: False

Expand Down Expand Up @@ -181,9 +181,9 @@ TensorFlow can be built from source using `build_tf.py`. The build artifacts can

python3 build_tf.py --output_dir=${PATH_TO_TF_BUILD} --cxx11_abi_version=1

- To build with a desired TF version, for example: v2.4.1
- To build with a desired TF version, for example: v2.5.0

python3 build_tf.py --output_dir=${PATH_TO_TF_BUILD} --tf_version=v2.4.1
python3 build_tf.py --output_dir=${PATH_TO_TF_BUILD} --tf_version=v2.5.0

## OpenVINO™

Expand Down
Loading