Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 11e004e

Browse files
committed
4.3.0 upd
1 parent c39d8de commit 11e004e

File tree

7 files changed

+53
-16
lines changed

7 files changed

+53
-16
lines changed

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ The official way is to use OpenVINO, but it is big and clumsy (just try to use i
4343
### Main differences from OpenVINO
4444

4545
+ No model-optimizer
46-
+ OpenBLAS instead of MKL ([details](https://github.com/banderlog/opencv-python-inference-engine/issues))
46+
+ OpenBLAS instead of MKL ([details](https://github.com/banderlog/opencv-python-inference-engine/issues/5#issuecomment-599563729))
4747
+ No [ITT](https://software.intel.com/en-us/articles/intel-itt-api-open-source)
4848
+ No [IPP](https://software.intel.com/en-us/ipp)
4949
+ No [Intel Media SDK](https://software.intel.com/en-us/media-sdk)
@@ -74,8 +74,13 @@ I am using Ubuntu 18.04 [multipass](https://multipass.run/) instance: `multipass
7474

7575
### Requirements
7676

77+
From [opencv](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html), [dldt](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html),
78+
[ffmpeg](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu), [openBLAS](https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu) and [ngraph](https://www.ngraph.ai/documentation/buildlb)
79+
7780
+ `build-essential`
78-
+ `cmake`
81+
+ `>=cmake-3.11`
82+
+ `autoconf` (for ngraph)
83+
+ `libtool-bin` (for ngraph)
7984
+ `git`
8085
+ `pkg-config`
8186
+ `python3-dev`
@@ -84,9 +89,17 @@ I am using Ubuntu 18.04 [multipass](https://multipass.run/) instance: `multipass
8489
+ `libusb-1.0-0-dev` (for MYRIAD plugin)
8590
+ `nasm` (for ffmpeg)
8691

87-
```
92+
```bash
93+
# We need newer `cmake` for dldt (commands from <https://apt.kitware.com/>)
94+
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
95+
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
96+
8897
sudo apt-get update
89-
sudo apt install build-essential cmake git pkg-config python3-dev nasm python3 virtualenv libusb-1.0-0-dev chrpath
98+
sudo apt install build-essential cmake git pkg-config python3-dev nasm python3 virtualenv libusb-1.0-0-dev chrpath autoconf libtool-bin
99+
100+
# for ngraph
101+
# the `dldt/_deps/ext_onnx-src/onnx/gen_proto.py` has `#!/usr/bin/env python` string and will throw an error otherwise
102+
sudo ln -s /usr/bin/python3 /usr/bin/python
90103
```
91104

92105
### Preparing

build/dldt/dldt_setup.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ if [ ! -f $BLAS_LIB ] || [ ! -d $BLAS_INC ]; then
1414
exit
1515
fi
1616

17+
# Manually-specified variables were not used by the project:
18+
# -D ENABLE_NGRAPH=ON \
1719
cmake -D CMAKE_BUILD_TYPE=Release \
1820
-D GEMM=OPENBLAS \
1921
-D THREADING=TBB \
@@ -34,8 +36,9 @@ cmake -D CMAKE_BUILD_TYPE=Release \
3436
-D ENABLE_SSE42=ON \
3537
-D ENABLE_AVX2=ON \
3638
-D ENABLE_AVX512F=OFF \
37-
-D ENABLE_NGRAPH=ON \
3839
-D NGRAPH_UNIT_TEST_ENABLE=OFF \
40+
-D NGRAPH_ONNX_IMPORT_ENABLE=ON \
41+
-D NGRAPH_JSON_ENABLE=ON \
3942
-D BLAS_LIBRARIES="$BLAS_LIB" \
4043
-D BLAS_INCLUDE_DIRS="$BLAS_INC" \
4144
-D ENABLE_CLDNN=OFF ../../dldt/

build/opencv/opencv_setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ cmake -D CMAKE_BUILD_TYPE=RELEASE \
7373
-D WITH_NGRAPH=ON \
7474
-D ngraph_DIR=$ABS_PORTION/build/dldt/ngraph \
7575
-D WITH_INF_ENGINE=ON \
76-
-D INF_ENGINE_RELEASE=2020010000 \
76+
-D INF_ENGINE_RELEASE=2020020000 \
7777
-D INF_ENGINE_INCLUDE_DIRS=$ABS_PORTION/dldt/inference-engine/include \
7878
-D INF_ENGINE_LIB_DIRS=$ABS_PORTION/dldt/bin/intel64/Release/lib \
7979
-D CPU_BASELINE=SSE4_2 \

create_wheel/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ def __len__(self):
1515

1616
setuptools.setup(
1717
name="opencv-python-inference-engine",
18-
version="4.2.0.4",
18+
version="4.3.0.1",
1919
url="https://github.com/banderlog/opencv-python-inference-engine",
2020
maintainer="Kabakov Borys",
2121
license='MIT, BSD, Intel Simplified Software License',
22-
description="Wrapper package for OpenCV 4.2.0 with Inference Engine 2020.1 python bindings",
22+
description="Wrapper package for OpenCV 4.3.0 with Inference Engine 2020.2 python bindings",
2323
long_description=long_description,
2424
long_description_content_type="text/markdown",
2525
ext_modules=EmptyListWithLength(),

download_all_stuff.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@ red () {
1414
}
1515

1616
green "DOWNLOAD ALL ARCHIVES"
17-
wget -c https://github.com/opencv/opencv/archive/4.2.0.tar.gz
18-
wget -c https://github.com/FFmpeg/FFmpeg/archive/n4.2.2.tar.gz
19-
wget -c https://github.com/opencv/dldt/archive/2020.1.tar.gz
17+
wget -c https://github.com/opencv/opencv/archive/4.3.0.tar.gz -O opencv.tar.gz
18+
wget -c https://github.com/FFmpeg/FFmpeg/archive/n4.2.2.tar.gz -O ffmpeg.tar.gz
19+
wget -c https://github.com/openvinotoolkit/openvino/archive/2020.2.tar.gz -O dldt.tar.gz
20+
2021

2122
green "CLEAN LIB DIRS"
2223
rm -drf ./dldt/*
@@ -37,9 +38,9 @@ rm -drf create_wheel/dist
3738
rm -drf create_wheel/*egg-info
3839

3940
green "UNZIP ALL STUFF"
40-
tar -xf 2020.1.tar.gz --strip-components=1 -C ./dldt/
41-
tar -xf n4.2.2.tar.gz --strip-components=1 -C ./ffmpeg/
42-
tar -xf 4.2.0.tar.gz --strip-components=1 -C ./opencv/
41+
tar -xf dldt.tar.gz --strip-components=1 -C ./dldt/
42+
tar -xf ffmpeg.tar.gz --strip-components=1 -C ./ffmpeg/
43+
tar -xf opencv.tar.gz --strip-components=1 -C ./opencv/
4344

4445
green "GIT RESET FOR ade"
4546
cd ./dldt/inference-engine/thirdparty/ade
@@ -49,12 +50,12 @@ git reset --hard cbe2db6
4950
green "GIT RESET FOR ngraph"
5051
cd ../../../ngraph
5152
git clone https://github.com/NervanaSystems/ngraph ./
52-
git reset --hard b0bb801
53+
git reset --hard edc65ca
5354

5455
green "GET RESET FOR OpenBLAS"
5556
cd ../../openblas/
5657
git clone --single-branch -b develop https://github.com/xianyi/OpenBLAS ./
57-
git reset --hard 9f67d0
58+
git reset --hard 9f67d03 # 2020-Mar-23
5859

5960
green "CREATE VENV"
6061
cd ../

tests/prepare_and_run_tests.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ for i in "${models[@]}"; do
6767
fi
6868
done
6969

70+
# for speed test
71+
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1vbonFjVyleGRSd_wR-Khc1htsZybiHCG' -O se_net.bin
72+
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Bz3EQwnes_iZ14iKAV6H__JZ2lynLmQz' -O se_net.xml
7073

7174
green "RUN TESTS with ./venv_t/bin/python ./tests.py"
7275
./venv_t/bin/python ./tests.py
76+
./venv_t/bin/ipython ./speed_test.py

tests/speed_test.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import cv2
2+
import numpy as np
3+
from IPython import get_ipython
4+
5+
# prepare al stuff and do first inference
6+
xml_model_path = "se_net.xml"
7+
net = cv2.dnn.readNet(xml_model_path, xml_model_path[:-3] + 'bin')
8+
blob = (np.random.standard_normal((1, 3, 224, 224)) * 255).astype(np.uint8)
9+
net.setInput(blob)
10+
net.setPreferableTarget(cv2.dnn.DNN_TARGET_CPU)
11+
net.setPreferableBackend(cv2.dnn.DNN_BACKEND_INFERENCE_ENGINE)
12+
_ = net.forward()
13+
14+
# measure the inference speed
15+
get_ipython().magic("timeit _ = net.forward()")
16+

0 commit comments

Comments
 (0)