Dlib Configure on Raspberry PI

Install dlib dependences

The dlib library requires four prerequisites:

  1. Boost
  2. Boost.Python
  3. CMake
  4. X11

These can all be installed via the following commands

sudo apt-get update
sudo apt-get install build-essential cmake
sudo apt-get install libgtk-3-dev
sudo apt-get install libboost-all-dev

 Access your Python virtual environment (if you are using them)

All of my OpenCV install tutorials on the PyImageSearch blog make use of Python virtual environments.

Using Python’s virtualenv and virtualenvwrapper libraries, we can create separate Python environments for each project we are working on — this is considered a best practice when developing software in the Python programming language.

I’ve discussed Python virtual environments many times before on the PyImageSearch blog, so I’ll spare any discussion of them here. If you would like to read more about Python virtual environments please refer to any of my installing OpenCV tutorials along with this excellent Python virtual environment primer.

If you would like to install dlib into a pre-existing Python, virtual environment, use the workon  command:

workon <your virtualenv name>

For example, most tutorials here on PyImageSearch create a virtual environment named cv. We can access the cv  virtual environment via:

workon cv
Otherwise, I suggest creating an entirely separate virtual environment using the mkvirtualenv   command.

The command below will create a Python virtual environment named py2_dlib  with the Python 2.7 interpreter:

 mkvirtualenv py2_dlib

While this command will create a Python 3 virtual environment named py3_dlib :

 mkvirtualenv py3_dlib -p python3

Please keep in mind that this step is optional, but highly recommended.

Use pip to install dlib with Python bindings

We’ll start with the basic NumPy + SciPy stack, followed by  scikit-image , a library commonly used in conjunction with dlib:

pip install numpy
pip install scipy
pip install scikit-image
We can then install dlib via pip  as well:
pip install dlib

Note: Use 'pip3' for python3

Test out your dlib install

To test out your dlib install, open up a Python shell (making sure to access your Python virtual environment if you used one), and then try to import dlib :

Python 2.7.13:

pi@raspberrypi:~ $ python
Python 2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>>

Python 3.5:

Use "pip3 install dlib" if Python3 did not find 'dlib'.

pi@raspberrypi:~ $ python3
Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>>

If you would like to access your OpenCV bindings along with your dlib bindings from the same virtual environment, make sure your  cv2.so   bindings are properly sym-linked into the  site-packages   directory of your Python virtual environment.

Example:

  • Facial landmark detection with dlib and the Raspberry Pi

Refer https://www.pyimagesearch.com/2017/05/01/install-dlib-raspberry-pi/

  • RTD

Reference:

  1. Install dlib on the Raspberry Pi, 

    https://www.pyimagesearch.com/2017/05/01/install-dlib-raspberry-pi/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值