Skip to content

Installation

matiasdelellis edited this page Feb 6, 2020 · 19 revisions

OK, once you are sure you have all needed requirements, this is how you can install FaceRecognition app. In general, you will need to install PDlib library (this is PHP wrapper for DLib) and FaceRecognition app (this app).

Easy way

(this section is not yet fully ready, please ignore it for now)

Ideally, you will want to use precompiled libraries. We prepared PDLib PHP library for some systems. If you have one, proceed. If you don't have it, take a look how to compile it yourself below. So, you will need to add this repo to your sources and to install it:

Debian stretch

echo "deb [trusted=yes] http://repo.delellis.com.ar stretch main" > /etc/apt/sources.list.d/20-pdlib.list
apt update
apt install php7.0-pdlib

Ubuntu Xenial

echo "deb [trusted=yes] http://repo.delellis.com.ar xenial main" > /etc/apt/sources.list.d/20-pdlib.list
apt update
apt install php7.0-pdlib

Fedora 28 onwards.

dnf copr enable matias/dlib
dnf install pdlib

NOTE: You can use real test of these components using the following tool. If this test passes correctly, you can continue with the installation of the application knowing that you really meet the requirements.

Once you did that, you can install FaceRecognition app from Nextcloud app store.

Head over to Usage to see where to start from there!

Hard way

Install DLib

First you need to install DLib library. You can follow procedure for your system, but here is quick overview if you are in hurry (taken from here). First, you need to have decent system, with:

  • support for C++11,
  • libx11-dev (on Ubuntu, install it with sudo apt-get install libx11-dev)
  • BLAS library (If no BLAS library is found, DLib's built-in BLAS will be used. However, if you install an optimized BLAS such as OpenBLAS or the Intel MKL your code will run faster. On Ubuntu you can install OpenBLAS by executing sudo apt-get install libopenblas-dev liblapack-dev)

After that, remember to install DLib as shared library:

git clone https://github.com/davisking/dlib.git
cd dlib/dlib
mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=ON ..
make
sudo make install

Install PDLib

You will have to have PHP dev libraries. On Ubuntu, they can be obtained with sudo apt-get install php7.x-dev.

Installing PDLib boils down to:

git clone https://github.com/goodspb/pdlib.git
cd pdlib
phpize
./configure
make
sudo make install

Now you need to configure your PHP installation to know for pdlib. Edit your php.ini and append content below to it:

[pdlib]
extension="pdlib.so"

Note that you can have 2 php.ini files, one for FPM, one for CLI. You need to change both of them! On Ubuntu, you can generally find them in /etc/php/7.x/cli/php.ini and /etc/php/7.x/fpm/php.ini.

If everything is working, you will see one line after you execute this:

$ php -m | grep pdlib
pdlib

NOTE: You can use real test of these components using the following tool. If this test passes correctly, you can continue with the installation of the application knowing that you really meet the requirements.

Install FaceRecognition app

In general, there is no need to install FaceRecognition from source, please use Nextcloud app store. This is needed only if you want to change source code and to contribute (in which case - big welcome!:smile:). Here is how you can install it on Ubuntu:

sudo apt-get install git-core composer
cd nextcloud/apps/   # or whatever your path to Nextcloud is
git clone https://github.com/matiasdelellis/facerecognition.git
cd facerecognition/
make

After installing the application and enable it, you must install the models. Within the Nextcloud folder, you must execute the following command with your HTTP user:

cd nextcloud/  # or whatever your path to Nextcloud is
sudo -u www-data php occ app:enable facerecognition # or ./occ app:enable facerecognition
sudo -u www-data php occ face:setup # or ./occ face:setup

If you have it manually installed and want to update to latest from master:

cd nextcloud/apps/facerecognition/
git pull
make

Congratulations, you should now have complete FaceRecognition set up!

Again, head over to Usage to see where to start from there.