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

Commit 56df119

Browse files
committed
Merge branch 'dev'
4.5.1_2021.2
2 parents 0f4c5db + 66e5f96 commit 56df119

26 files changed

+556
-831
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ build/opencv/*
1818
!build/dldt
1919
build/dldt/*
2020
!build/dldt/dldt_setup.sh
21+
!build/dldt/*.patch
2122

2223
!build/ffmpeg
2324
build/ffmpeg/*

README.md

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,28 @@ pip3 install opencv-python-inference-engine
1414

1515
## Examples of usage
1616

17-
I'll do more straightforward and well-documented examples of usage in the foreseeable future. But for now, please see the tests folder.
17+
Please see the `examples.ipynb` in the `tests` folder.
1818

1919
You will need to preprocess data as a model requires and decode the output. A description of the decoding *should* be in the model documentation with examples in open-vino documentation, however, in some cases, the original article may be the only information source. Some models are very simple to encode/decode, others are tough (e.g., PixelLink in tests).
2020

2121

22-
## Why
22+
## Downloading intel models
23+
24+
The official way is clumsy because you need to git clone the whole [model_zoo](https://github.com/opencv/open_model_zoo) ([details](https://github.com/opencv/open_model_zoo/issues/522))
25+
26+
Better to find a model description [here](https://github.com/opencv/open_model_zoo/blob/master/models/intel/index.md) and download manually from [here](https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1/)
27+
28+
29+
## Description
30+
31+
32+
### Why
2333

2434
I needed an ability to fast deploy a small package that able to run models from [Intel's model zoo](https://github.com/opencv/open_model_zoo/) and use [Movidius NCS](https://software.intel.com/en-us/neural-compute-stick).
2535
Well-known [opencv-python](https://github.com/skvark/opencv-python) can't do this.
2636
The official way is to use OpenVINO, but it is big and clumsy (just try to use it with python venv or fast download it on cloud instance).
2737

2838

29-
## Description
30-
3139
### Limitations
3240

3341
+ Package comes without contrib modules.
@@ -62,21 +70,16 @@ For additional info read `cv2.getBuildInformation()` output.
6270

6371
### Versioning
6472

65-
The first 3 letters are the version of OpenCV, the last one -- package version. E.g, `4.1.0.2` -- 2nd version of based on 4.1.0 OpenCV package. Package versions are not continuously numbered -- each new OpenCV version starts its own numbering.
66-
67-
68-
## Downloading intel models
69-
70-
The official way is clumsy because you need to git clone the whole [model_zoo](https://github.com/opencv/open_model_zoo) ([details](https://github.com/opencv/open_model_zoo/issues/522))
71-
72-
Better to find a model description [here](https://github.com/opencv/open_model_zoo/blob/master/models/intel/index.md) and download manually from [here](https://download.01.org/opencv/2020/openvinotoolkit/2020.1/open_model_zoo/models_bin/1/)
73+
The first 3 letters are the version of OpenCV, underscore, then inference engine (dldt/openvino) version, underscore, package version.
74+
E.g, `4.5.1_2120.2_0` -- first version of based on 4.5.1 OpenCV package with 2021.2 inference engine module.
75+
Package versions are not continuously numbered -- each new OpenCV-dldt version pair starts its own numbering.
7376

7477

7578
## Compiling from source
7679

7780
You will need ~7GB RAM and ~10GB disk space
7881

79-
I am using Ubuntu 18.04 [multipass](https://multipass.run/) instance: `multipass launch -c 6 -d 10G -m 7G`.
82+
I am using Ubuntu 18.04 [multipass](https://multipass.run/) instance: `multipass launch -c 6 -d 10G -m 7G 18.04`.
8083

8184
### Requirements
8285

@@ -96,7 +99,7 @@ From [opencv](https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html)
9699
+ `nasm` (for ffmpeg)
97100

98101
```bash
99-
# We need newer `cmake` for dldt (commands from <https://apt.kitware.com/>)
102+
# We need newer `cmake` for dldt (fastest way I know)
100103
sudo apt remove --purge cmake
101104
hash -r
102105
sudo snap install cmake --classic
@@ -186,15 +189,14 @@ Make next changes in `opencv-python-inference-engine/build/opencv/opencv_setup.s
186189

187190
Exporting `PKG_CONFIG_PATH` for `ffmpeg` somehow messes with default values.
188191

189-
#### IPP
192+
It will add ~16MB to the package.
193+
194+
#### Integrated Performance Primitives
190195

191196
Just set `-D WITH_IPP=ON` in `opencv_setup.sh`.
192197

193198
It will give +30MB to the final `cv2.so` size. And it will boost _some_ opencv functions.
194199

195-
![](https://www.oreilly.com/library/view/learning-opencv-3/9781491937983/assets/lcv3_0105.png)
196-
(Image from [Learning OpenCV 3 by Gary Bradski, Adrian Kaehler](https://www.oreilly.com/library/view/learning-opencv-3/9781491937983/ch01.html))
197-
198200
[Official Intel's IPP benchmarks](https://software.intel.com/en-us/ipp/benchmarks) (may ask for registration)
199201

200202
#### MKL
@@ -205,15 +207,6 @@ OpenVino comes with 30MB `libmkl_tiny_tbb.so`, but [you will not be able to comp
205207

206208
Our opensource MKL-DNN experiment will end with 125MB `libmklml_gnu.so` and inference speed compatible with 5MB openblas ([details](https://github.com/banderlog/opencv-python-inference-engine/issues/5)).
207209

208-
#### OpenBLAS
209-
210-
Please refer here for details: https://github.com/xianyi/OpenBLAS/issues/2528
211-
212-
+ [OpenBLAS Installation guide](https://github.com/xianyi/OpenBLAS/wiki/Installation-Guide)
213-
+ [OpenBLAS User Manual](https://github.com/xianyi/OpenBLAS/wiki/User-Manual)
214-
215-
If you compile it with `make FC=gfortran`, you'll need to put `libgfortran.so.4` and `libquadmath.so.0` to wheel and set them rpath via `patchelf --set-rpath \$ORIGIN *.so`
216-
217210

218211
#### CUDA
219212

@@ -223,16 +216,6 @@ I did not try it. But it cannot be universal, it will only work with the certain
223216
+ [Use OpenCV’s ‘dnn’ module with NVIDIA GPUs, CUDA, and cuDNN](https://www.pyimagesearch.com/2020/02/03/how-to-use-opencvs-dnn-module-with-nvidia-gpus-cuda-and-cudnn/)
224217

225218

226-
#### Build `ffmpeg` with `tbb`
227-
228-
Both `dldt` and `opencv` are compiled with `tbb` support, and `ffmpeg` compiled without it -- this does not feel right.
229-
There is some unproved solution for how to compile `ffmpeg` with `tbb` support: <https://stackoverflow.com/questions/6049798/ffmpeg-mt-and-tbb>
230-
231-
232219
#### OpenMP
233220

234221
It is possible to compile OpenBLAS, dldt and OpenCV with OpenMP. I am not sure that the result would be better than now, but who knows.
235-
236-
#### Use opencv for NLP
237-
238-
Presumably, you could also use speech2text model now -- [source](https://docs.openvinotoolkit.org/latest/_inference_engine_samples_speech_libs_and_demos_Speech_libs_and_demos.html)

TODO.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# TODO list
22

3+
+ get rid of tensorflow-cpu in tests
34
+ Auto value for `-D INF_ENGINE_RELEASE`: https://github.com/openvinotoolkit/openvino/issues/1435
4-
5+
+ https://answers.opencv.org/question/236271/what-the-difference-between-cv_version_status-values/

build/dldt/dependencies.patch

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
184,185c197,198
2+
< set(OPENCV_VERSION "4.5.0")
3+
< set(OPENCV_BUILD "36")
4+
---
5+
> set(OPENCV_VERSION "4.5.1")
6+
> set(OPENCV_BUILD "044")

build/dldt/dldt_setup.sh

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

17+
# <https://github.com/openvinotoolkit/openvino/issues/4527>
18+
patch ../../dldt/inference-engine/cmake/dependencies.cmake dependencies.patch
19+
20+
1721
# Manually-specified variables were not used by the project:
1822
# -D ENABLE_NGRAPH=ON \
1923
cmake -D CMAKE_BUILD_TYPE=Release \

build/ffmpeg/ffmpeg_premake.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
2-
# <https://stackoverflow.com/a/36937360/7599215>
2+
3+
# Build ffmpeg shared libraries without version suffix
4+
# from <https://stackoverflow.com/a/36937360/7599215>
5+
36
OLD1='SLIBNAME_WITH_VERSION=$(SLIBNAME).$(LIBVERSION)'
47
OLD2='SLIBNAME_WITH_MAJOR=$(SLIBNAME).$(LIBMAJOR)'
58
OLD3='SLIB_INSTALL_NAME=$(SLIBNAME_WITH_VERSION)'

build/ffmpeg/ffmpeg_setup.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
23
PATH_TO_SCRIPT=`dirname $(realpath $0)`
34

45
../../ffmpeg/configure \

build/openblas/openblas_setup.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
#!/bin/bash
2+
3+
# Please refer here for details: <https://github.com/xianyi/OpenBLAS/issues/2528>
4+
#
5+
# If you compile it with `make FC=gfortran`,
6+
# you'll need `libgfortran.so.4` and `libquadmath.so.0`
7+
18
cmake -D NO_LAPACKE=1 \
29
-D CMAKE_BUILD_TYPE=Release \
310
-D NOFORTRAN=ON \

build/opencv/opencv_setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ cmake -D CMAKE_BUILD_TYPE=RELEASE \
7575
-D WITH_NGRAPH=ON \
7676
-D ngraph_DIR=$ABS_PORTION/build/dldt/ngraph \
7777
-D WITH_INF_ENGINE=ON \
78-
-D INF_ENGINE_RELEASE=2021010000 \
78+
-D INF_ENGINE_RELEASE=2021020000 \
7979
-D INF_ENGINE_INCLUDE_DIRS=$ABS_PORTION/dldt/inference-engine/include \
8080
-D INF_ENGINE_LIB_DIRS=$ABS_PORTION/dldt/bin/intel64/Release/lib \
8181
-D CPU_BASELINE=SSE4_2 \
82-
-D CPU_DISPATCH=AVX,AVX2,FP16,AVX512 ../../opencv
82+
-D CPU_DISPATCH=AVX,AVX2,FP16,AVX512 ../../opencv

0 commit comments

Comments
 (0)