Last active
July 4, 2020 14:42
-
-
Save natxopedreira/f5467dea8b9f267e0a39e0cad422e37d to your computer and use it in GitHub Desktop.
docker compilar openvino opencv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
USER root | |
RUN dpkg --add-architecture armhf && \ | |
apt-get update && \ | |
apt-get install -y --no-install-recommends \ | |
build-essential \ | |
crossbuild-essential-armhf \ | |
git \ | |
wget \ | |
cmake \ | |
cython \ | |
libusb-1.0-0-dev:armhf \ | |
libgtk-3-dev:armhf \ | |
libavcodec-dev:armhf \ | |
libavformat-dev:armhf \ | |
libswscale-dev:armhf \ | |
libgstreamer1.0-dev:armhf \ | |
libgstreamer-plugins-base1.0-dev:armhf \ | |
libpython3-dev:armhf \ | |
libpython-dev:armhf \ | |
python3-numpy \ | |
python-numpy \ | |
python3-pip | |
RUN wget https://www.cmake.org/files/v3.14/cmake-3.14.3.tar.gz && \ | |
tar xf cmake-3.14.3.tar.gz && \ | |
(cd cmake-3.14.3 && ./bootstrap --parallel=$(nproc --all) && make --jobs=$(nproc --all) && make install) && \ | |
rm -rf cmake-3.14.3 cmake-3.14.3.tar.gz | |
# Build Inference Engine (https://github.com/openvinotoolkit/openvino/blob/master/build-instruction.md#build-for-raspbian-stretch-os) | |
RUN git clone https://github.com/openvinotoolkit/openvino | |
RUN cd openvino && mkdir build && cd build && \ | |
git submodule init && git submodule update --recursive && \ | |
cmake -DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_TOOLCHAIN_FILE="../cmake/arm.toolchain.cmake" \ | |
-DTHREADS_PTHREAD_ARG="-pthread" \ | |
-DENABLE_SSE42=OFF \ | |
-DTHREADING=SEQ \ | |
-DNGRAPH_ONNX_IMPORT_ENABLE=OFF \ | |
-DENABLE_PYTHON=ON \ | |
-DPYTHON_EXECUTABLE=`which python3.7` \ | |
-DPYTHON_LIBRARY=/usr/lib/arm-linux-gnueabihf/libpython3.7m.so \ | |
-DPYTHON_INCLUDE_DIR=/usr/include/python3.7 \ | |
-DENABLE_GNA=OFF .. && make --jobs=$(nproc --all) | |
# Build OpenCV (https://github.com/opencv/opencv/wiki/Intel%27s-Deep-Learning-Inference-Engine-backend#raspbian-buster) | |
RUN git clone https://github.com/opencv/opencv --depth 1 | |
RUN cd opencv && mkdir opencv_build && mkdir opencv_install && cd opencv_build && \ | |
cmake -DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX="../opencv_install" \ | |
-DOPENCV_CONFIG_INSTALL_PATH="cmake" \ | |
-DCMAKE_TOOLCHAIN_FILE="../platforms/linux/arm-gnueabi.toolchain.cmake" \ | |
-DWITH_IPP=OFF \ | |
-DBUILD_TESTS=OFF \ | |
-DBUILD_PERF_TESTS=OFF \ | |
-DOPENCV_ENABLE_PKG_CONFIG=ON \ | |
-DPKG_CONFIG_EXECUTABLE="/usr/bin/arm-linux-gnueabihf-pkg-config" \ | |
-DPYTHON2_INCLUDE_PATH="/usr/include/python2.7" \ | |
-DPYTHON2_NUMPY_INCLUDE_DIRS="/usr/local/lib/python2.7/dist-packages/numpy/core/include" \ | |
-DPYTHON3_INCLUDE_PATH="/usr/include/python3.7" \ | |
-DPYTHON3_NUMPY_INCLUDE_DIRS="/usr/local/lib/python3.7/dist-packages/numpy/core/include" \ | |
-DPYTHON3_CVPY_SUFFIX=".cpython-37m-arm-linux-gnueabihf.so" \ | |
-DENABLE_NEON=ON \ | |
-DCPU_BASELINE="NEON" \ | |
-DWITH_INF_ENGINE=ON \ | |
-DINF_ENGINE_RELEASE=2020030000 \ | |
-DINF_ENGINE_LIB_DIRS="/openvino/bin/armv7l/Release/lib/" \ | |
-DINF_ENGINE_INCLUDE_DIRS="/openvino/inference_engine/include" \ | |
-DCMAKE_FIND_ROOT_PATH="/openvino/build" .. && \ | |
make --jobs=$(nproc --all) && make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment