Last active
March 25, 2017 10:13
-
-
Save marschhuynh/af6e7f81240a30907f85aafcca99b410 to your computer and use it in GitHub Desktop.
Build tensorflow and opencv
This file contains hidden or 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
## Build OpenCV for python 3 | |
#### For python3 on ubuntu | |
```bash | |
cmake -Wno-deprecated-gpu-targets \ | |
-D BUILD_TIFF=ON \ | |
-D BUILD_opencv_java=OFF \ | |
-D WITH_CUDA=ON \ | |
-D CUDA_FAST_MATH=1 \ | |
-D WITH_CUBLAS=1 \ | |
-D ENABLE_AVX=ON \ | |
-D WITH_IPP=OFF \ | |
-D WITH_TBB=ON \ | |
-D WITH_EIGEN=ON \ | |
-D WITH_V4L=ON \ | |
-D WITH_VTK=OFF \ | |
-D BUILD_TESTS=OFF \ | |
-D BUILD_PERF_TESTS=OFF \ | |
-D CMAKE_BUILD_TYPE=RELEASE \ | |
-D OPENCV_EXTRA_MODULES_PATH=~/Desktop/opencv_contrib/modules \ | |
-D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") \ | |
-D PYTHON_EXECUTABLE=$(which python3) \ | |
-D PYTHON3_INCLUDE_DIR=$(python3 -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \ | |
-D PYTHON3_PACKAGES_PATH=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") .. | |
``` | |
#### For python on Mac | |
```bash | |
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D WITH_CUDA=ON \ | |
-D ENABLE_FAST_MATH=1 \ | |
-D CUDA_FAST_MATH=1 \ | |
-D WITH_CUBLAS=1 \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.1.0/modules \ | |
-D BUILD_EXAMPLES=ON .. | |
``` | |
## Build Tensorflow with GPU | |
```bash | |
bazel build -c opt --copt=-march=native --config=cuda -k //tensorflow/tools/pip_package:build_pip_package | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment