Go to file
Branko Kokanovic f8cc0e48d3 Adding support for cnn face detector
CNN face detector (deep learning face detection) is modeled as
PHP class. Currently, it only has constructor (which loads a model)
and detect() method. I tried to make it resamble to Python implementation.
Similar to Python, also added support for upsampling. Returned value
is array with numbers as keys where number of keys is equal to number
of found faced. Each element is associative array that has "top", "left",
"right", "bottom" and "detection_confidence" keys.

All errors are propagated using exceptions.

Added two new error tests. I didn't want to rely on presence of model,
so tests are not having great coverage. If we are OK to download models
in tests, it would allow us to have far better coverage.

What is missing:
* Testing with models (should we test that?)
* detect_mult method (similar to what Python have; however, I consider
  that this should not block pushing this change)
2018-07-16 22:34:55 +02:00
src Adding support for cnn face detector 2018-07-16 22:34:55 +02:00
tests Adding support for cnn face detector 2018-07-16 22:34:55 +02:00
.gitignore Adding configure.in to .gitignore 2018-07-14 00:13:18 +02:00
config.m4 Adding support for cnn face detector 2018-07-16 22:34:55 +02:00
config.w32 first commit 2018-05-21 01:23:19 +08:00
CREDITS first commit 2018-05-21 01:23:19 +08:00
EXPERIMENTAL first commit 2018-05-21 01:23:19 +08:00
pdlib.cc Adding support for cnn face detector 2018-07-16 22:34:55 +02:00
pdlib.php first commit 2018-05-21 01:23:19 +08:00
php_pdlib.h first commit 2018-05-21 01:23:19 +08:00
README.md Adding support for cnn face detector 2018-07-16 22:34:55 +02:00

PDlib - A PHP extension for Dlib

A PHP extension

Requirements

  • Dlib 19.13+
  • PHP 7.0+
  • C++ 11

Dependence

Dlib

Install Dlib as share library

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

Installation

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

Configure

vim youpath/php.ini

Write the below content into php.ini

[pdlib]
extension="pdlib.so"

Usage

face detection

<?php

// face detection
$faceCount = dlib_face_detection("~/a.jpg");
// how mary face in the picture.
var_dump($faceCount);

face landmark detection

<?php

// face landmark detection
$landmarks = dlib_face_landmark_detection("~/a.jpg");
var_dump($landmarks);

Features

  • 1.Face Detection
  • 2.Face Landmark Detection
  • 3.Deep Face Recognition
  • 4.Deep Learning Face Detection