as suggested in the cmake files I import dlib in my project using:
include(FetchContent)
FetchContent_Declare(dlib
GIT_REPOSITORY https://github.com/davisking/dlib.git
GIT_TAG v19.18
)
FetchContent_MakeAvailable(dlib)
I don't want dlib to use CUDA. How do I disable it?
I can not disable cuda for dlib. because if I disable then another error happened. instead of disabling I applied the following approach this Is working in my PC:
Create a new virtual environment
pip --no-cache-dir install cmake
pip --no-cache-dir install -v --install-option="--no" --install-option="DLIB_USE_CUDA" dlib
The line number 3 is the most important it install dlib without cuda support
pip --no-cache-dir install face-recognition
I am working face recognition project. and project is working now without error.
Related
I installed Tensorflow-macos and try to install opencv-python
but always fail in this message
ERROR: Command errored out with exit status 1: /Users/sean/Documents/sysvenv/tf24v/bin/python3 /Users/sean/Documents/sysvenv/tf24v/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/gy/jzs3xnwd1z3203d75y_31nxc0000gn/T/pip-build-env-en64krht/overlay --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"'' Check the logs for full command output.
it lookalike the bumpy version problem.
But In Tensorflow-macos it it 1.8.5 and python is 3.8
Does anynoe have the same problem?
thanks
You might want to look at these suggestions:
opencv issues with M1 MAC - OpenCV imshow doesnot work
conda install opencv
I was successful in installing Python 3.9.1 for Apple Silicon and then running conda install opencv. However, the slow time to compute a few functions for the first time might suggest some components are still being translated via Rosetta. Regardless, while I did not test performance the functions I needed seemed to work.
after searching the web I have successfully installed OpenCV on my Mac M1.
Probably you don't have brew installed, so here's how you should install it:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install wget
brew install miniforge
brew install cmake, you will need cmake for building OpenCV code
Then just follow this blog: https://sayak.dev/install-opencv-m1/#Install-conda
OR, here is the YouTube video which explains the second step: https://youtu.be/x_kAkabk-5o
P.S. If mdfind cv2.cpython returning an empty string then try to delete the build folder and compile opencv again. Otherwise, you have done everything correctly.
I want to build tensorflow with python libraries. Currently I have tensorflow installed but I do not see python packages in /usr/local/lib/python3.6/dist-packages so when I try to import tensorflow module in python terminal, it fails. However, there is library in /usr/lib and C++ programs work.
What is flag/target needed in bazel build?
You can get TensorFlow in python package by:
Directly doing pip install tensorflow: It will install the precompiled version by directly downloading a wheel file.
Build from source code in GitHub using bazel build.
For the second approach, the following steps are needed:
Take the source code from GitHub.
Compile the code using bazel build. It will give the ".whl" file.
Do pip install /tmp/TensorFlow-version-tags.whl
For detailed installation, steps follow this.
I have installed visual studio 2019, and Cuda 10.1 and TensorFlow 2.1.0 and I still can't run face recognition with GPU, can someone give me a complete guide on the steps to use GPU instead of CPU.
note: I'm using windows 10, my GPU is gtx1050 and I am using anaconda spider.
Firstly, you should install tensorflow-gpu package instead of tensorflow.
If your tf is installed correctly, you can run face recognition in gpu within deepface. You can test it with allocate memory function.
#!pip install deepface
from deepface import DeepFace
DeepFace.allocateMemory()
If everything is OK, then it returns "DeepFace will run on GPU" message.
All face recogntion models except Dlib will run on tensorflow-gpu. You can run face recognition with verification function.
from deepface import DeepFace
models = ["VGG-Face", "Facenet", "OpenFace", "DeepFace", "DeepID", "Dlib"]
obj = DeepFace.verify("img1.jpg", "img2.jpg", model_name = models[0])
print(obj)
i solved this by these steps using an anaconda enviroment:
cuda 10.2 installed
python (3.7.7)
conda install pip
conda install tensorflow (latest 2.1.0)
conda install tensorflow-gpu
pip install imutils
pip install opencv-python
pip install opencv-contrib-python
pip install dlib
pip install face_recognition
As Adrian Rosebrock mentioned at https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/, it is better to build Dlib from source, so the library is aware of the presence of the exact GPU in your system. My guess is - during the building process, it probes the capabilities of the GPU through the CUDA driver and builds and installs accordingly.
git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build
cd build
cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1
cmake --build .
cd ..
python setup.py install --yes USE_AVX_INSTRUCTIONS --yes DLIB_USE_CUDA
I am trying to install Tensorflow and Horovod
pip install tensorflow
HOROVOD_WITH_TENSORFLOW=1 pip install horovod
Then I ran a sample code
import tensorflow as tf
import horovod.tensorflow as hvd
When I run this code, I get the error
ImportError: Extension horovod.tensorflow has not been built. If this is not expected, reinstall Horovod with HOROVOD_WITH_TENSORFLOW=1 to debug the build error.
If you need to install tensorflow and horovod , you can use the following steps:
1)Create a conda environment to avoid the mismatch of package versions.
conda create -n test_hvd -c intel python=3.6
2)Activate the environment
source activate test_hvd
(You can use any name instead of test_hvd, which is an environment name.)
3)Install tensorflow in the activated environment:
pip install https://storage.googleapis.com/intel-optimized-tensorflow/tensorflow-1.10.0-cp36-cp36m-linux_x86_64.whl
4)Finally install horovod
pip install --no-cache-dir horovod
Note: 1. Kindly confirm if you are using the latest versions of GCC (gcc (GCC) 6.4.0 works fine).
These steps are tested on Linux OS
Hope this helps!
Back in the days, installing tensorflow-gpu required to install separately CUDA and cuDNN and add the path to LD_LIBRARY_PATH and CUDA_HOME to the environment.
Now, a simple conda install tensorflow-gpu==1.9 takes care of everything. Removing the CUDA_HOME and LD_LIBRARY_PATH from the environment has no effect whatsoever on tensorflow-gpu.
Question: where is the path to CUDA specified for TensorFlow when installing it with anaconda?
When you install tensorflow-gpu, it installs two other conda packages:
cudatoolkit: 9.0-h13b8566_0
cudnn: 7.1.2-cuda9.0_0
And if you look carefully at the tensorflow dynamic shared object, it uses RPATH to pick up these libraries on Linux:
(tflow) $ ldd $CONDA_PREFIX/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so | grep -E 'cufft|curand'
libcufft.so.9.0 => /tmp/wani.1533146686/tflow/lib/python3.6/site-packages/tensorflow/python/../../../../libcufft.so.9.0 (0x00007fbb9454a000)
libcurand.so.9.0 => /tmp/wani.1533146686/tflow/lib/python3.6/site-packages/tensorflow/python/../../../../libcurand.so.9.0 (0x00007fbb905e4000)
(tflow) $ ldd $CONDA_PREFIX/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so | grep cudnn
libcudnn.so.7 => /tmp/wani.1533146686/tflow/lib/python3.6/site-packages/tensorflow/python/../../../../libcudnn.so.7 (0x00007fd73b55d000)
The only thing is required from you is libcuda.so.1 which is usually available in standard list of search directories for libraries, once you install the cuda drivers.
In my case, the following command took care of it automatically:
$ sudo apt install nvidia-cuda-toolkit