|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2020, Matias De lellis <[email protected]> |
|
4
|
|
|
* @copyright Copyright (c) 2018, Branko Kokanovic <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* @author Branko Kokanovic <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU AGPL version 3 or any later version |
|
9
|
|
|
* |
|
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
13
|
|
|
* License, or (at your option) any later version. |
|
14
|
|
|
* |
|
15
|
|
|
* This program is distributed in the hope that it will be useful, |
|
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18
|
|
|
* GNU Affero General Public License for more details. |
|
19
|
|
|
* |
|
20
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
22
|
|
|
* |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
namespace OCA\FaceRecognition\Model; |
|
26
|
|
|
|
|
27
|
|
|
class DlibCnn5Model extends DlibCnnModel implements IModel { |
|
28
|
|
|
|
|
29
|
|
|
/** Defines ID for default face model */ |
|
30
|
|
|
const FACE_MODEL_ID = 1; |
|
31
|
|
|
|
|
32
|
|
|
/** Defines name for default face model */ |
|
33
|
|
|
const FACE_MODEL_NAME = 'Default'; |
|
34
|
|
|
|
|
35
|
|
|
/** Defines description for default face model */ |
|
36
|
|
|
const FACE_MODEL_DESC = 'Main model, using dlib defaults: mmod_human_face_detector.dat, shape_predictor_5_face_landmarks.dat and dlib_face_recognition_resnet_model_v1.dat'; |
|
37
|
|
|
|
|
38
|
|
|
/* |
|
39
|
|
|
* Model files. |
|
40
|
|
|
*/ |
|
41
|
|
|
const FACE_MODEL_BZ2_URLS = [ |
|
42
|
|
|
'https://github.com/davisking/dlib-models/raw/94cdb1e40b1c29c0bfcaf7355614bfe6da19460e/mmod_human_face_detector.dat.bz2', |
|
43
|
|
|
'https://github.com/davisking/dlib-models/raw/4af9b776281dd7d6e2e30d4a2d40458b1e254e40/shape_predictor_5_face_landmarks.dat.bz2', |
|
44
|
|
|
'https://github.com/davisking/dlib-models/raw/2a61575dd45d818271c085ff8cd747613a48f20d/dlib_face_recognition_resnet_model_v1.dat.bz2' |
|
45
|
|
|
]; |
|
46
|
|
|
|
|
47
|
|
|
const FACE_MODEL_FILES = [ |
|
48
|
|
|
'mmod_human_face_detector.dat', |
|
49
|
|
|
'shape_predictor_5_face_landmarks.dat', |
|
50
|
|
|
'dlib_face_recognition_resnet_model_v1.dat' |
|
51
|
|
|
]; |
|
52
|
|
|
|
|
53
|
|
|
} |
|
54
|
|
|
|