Skip to content

Commit b298c2a

Browse files
add depecration warnings for allFaces and mtcnn and remove mtcnn from examples
1 parent feac639 commit b298c2a

20 files changed

+21
-4695
lines changed

README.md

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,7 @@ import * as canvas from 'canvas';
135135
import * as faceapi from 'face-api.js';
136136

137137
// patch nodejs environment, we need to provide an implementation of
138-
// HTMLCanvasElement and HTMLImageElement, additionally an implementation
139-
// of ImageData is required, in case you want to use the MTCNN
138+
// HTMLCanvasElement and HTMLImageElement
140139
const { Canvas, Image, ImageData } = canvas
141140
faceapi.env.monkeyPatch({ Canvas, Image, ImageData })
142141
```
@@ -160,7 +159,6 @@ console.log(faceapi.nets)
160159
// faceRecognitionNet
161160
// ssdMobilenetv1
162161
// tinyFaceDetector
163-
// mtcnn
164162
// tinyYolov2
165163
```
166164

@@ -246,7 +244,6 @@ By default **detectAllFaces** and **detectSingleFace** utilize the SSD Mobilenet
246244
``` javascript
247245
const detections1 = await faceapi.detectAllFaces(input, new faceapi.SsdMobilenetv1Options())
248246
const detections2 = await faceapi.detectAllFaces(input, new faceapi.TinyFaceDetectorOptions())
249-
const detections3 = await faceapi.detectAllFaces(input, new faceapi.MtcnnOptions())
250247
```
251248

252249
You can tune the options of each face detector as shown [here](#getting-started-face-detection-options).
@@ -592,40 +589,6 @@ export interface ITinyFaceDetectorOptions {
592589
const options = new faceapi.TinyFaceDetectorOptions({ inputSize: 320 })
593590
```
594591

595-
### MtcnnOptions
596-
597-
``` javascript
598-
export interface IMtcnnOptions {
599-
// minimum face size to expect, the higher the faster processing will be,
600-
// but smaller faces won't be detected
601-
// default: 20
602-
minFaceSize?: number
603-
604-
// the score threshold values used to filter the bounding
605-
// boxes of stage 1, 2 and 3
606-
// default: [0.6, 0.7, 0.7]
607-
scoreThresholds?: number[]
608-
609-
// scale factor used to calculate the scale steps of the image
610-
// pyramid used in stage 1
611-
// default: 0.709
612-
scaleFactor?: number
613-
614-
// number of scaled versions of the input image passed through the CNN
615-
// of the first stage, lower numbers will result in lower inference time,
616-
// but will also be less accurate
617-
// default: 10
618-
maxNumScales?: number
619-
620-
// instead of specifying scaleFactor and maxNumScales you can also
621-
// set the scaleSteps manually
622-
scaleSteps?: number[]
623-
}
624-
625-
// example
626-
const options = new faceapi.MtcnnOptions({ minFaceSize: 100, scaleFactor: 0.8 })
627-
```
628-
629592
<a name="getting-started-utility-classes"></a>
630593

631594
## Utility Classes
@@ -726,7 +689,6 @@ Instead of using the high level API, you can directly use the forward methods of
726689
``` javascript
727690
const detections1 = await faceapi.ssdMobilenetv1(input, options)
728691
const detections2 = await faceapi.tinyFaceDetector(input, options)
729-
const detections3 = await faceapi.mtcnn(input, options)
730692
const landmarks1 = await faceapi.detectFaceLandmarks(faceImage)
731693
const landmarks2 = await faceapi.detectFaceLandmarksTiny(faceImage)
732694
const descriptor = await faceapi.computeFaceDescriptor(alignedFaceImage)
@@ -839,14 +801,6 @@ The face detector has been trained on a custom dataset of ~14K images labeled wi
839801

840802
This model is basically an even tinier version of Tiny Yolo V2, replacing the regular convolutions of Yolo with depthwise separable convolutions. Yolo is fully convolutional, thus can easily adapt to different input image sizes to trade off accuracy for performance (inference time).
841803

842-
### MTCNN
843-
844-
**Note, this model is mostly kept in this repo for experimental reasons. In general the other face detectors should perform better, but of course you are free to play around with MTCNN.**
845-
846-
MTCNN (Multi-task Cascaded Convolutional Neural Networks) represents an alternative face detector to SSD Mobilenet v1 and Tiny Yolo v2, which offers much more room for configuration. By tuning the input parameters, MTCNN should be able to detect a wide range of face bounding box sizes. MTCNN is a 3 stage cascaded CNN, which simultaneously returns 5 face landmark points along with the bounding boxes and scores for each face. Additionally the model size is only 2MB.
847-
848-
MTCNN has been presented in the paper [Joint Face Detection and Alignment using Multi-task Cascaded Convolutional Networks](https://kpzhang93.github.io/MTCNN_face_detection_alignment/paper/spl.pdf) by Zhang et al. and the model weights are provided in the official [repo](https://github.com/kpzhang93/MTCNN_face_detection_alignment) of the MTCNN implementation.
849-
850804
<a name="models-face-landmark-detection"></a>
851805

852806
## 68 Point Face Landmark Detection Models

examples/examples-browser/public/js/faceDetectionControls.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const SSD_MOBILENETV1 = 'ssd_mobilenetv1'
22
const TINY_FACE_DETECTOR = 'tiny_face_detector'
3-
const MTCNN = 'mtcnn'
43

54

65
let selectedFaceDetector = SSD_MOBILENETV1
@@ -12,17 +11,10 @@ let minConfidence = 0.5
1211
let inputSize = 512
1312
let scoreThreshold = 0.5
1413

15-
//mtcnn options
16-
let minFaceSize = 20
17-
1814
function getFaceDetectorOptions() {
1915
return selectedFaceDetector === SSD_MOBILENETV1
2016
? new faceapi.SsdMobilenetv1Options({ minConfidence })
21-
: (
22-
selectedFaceDetector === TINY_FACE_DETECTOR
23-
? new faceapi.TinyFaceDetectorOptions({ inputSize, scoreThreshold })
24-
: new faceapi.MtcnnOptions({ minFaceSize })
25-
)
17+
: new faceapi.TinyFaceDetectorOptions({ inputSize, scoreThreshold })
2618
}
2719

2820
function onIncreaseMinConfidence() {
@@ -79,17 +71,14 @@ function getCurrentFaceDetectionNet() {
7971
if (selectedFaceDetector === TINY_FACE_DETECTOR) {
8072
return faceapi.nets.tinyFaceDetector
8173
}
82-
if (selectedFaceDetector === MTCNN) {
83-
return faceapi.nets.mtcnn
84-
}
8574
}
8675

8776
function isFaceDetectionModelLoaded() {
8877
return !!getCurrentFaceDetectionNet().params
8978
}
9079

9180
async function changeFaceDetector(detector) {
92-
['#ssd_mobilenetv1_controls', '#tiny_face_detector_controls', '#mtcnn_controls']
81+
['#ssd_mobilenetv1_controls', '#tiny_face_detector_controls']
9382
.forEach(id => $(id).hide())
9483

9584
selectedFaceDetector = detector

examples/examples-browser/views/ageAndGenderRecognition.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<select id="selectFaceDetector">
4646
<option value="ssd_mobilenetv1">SSD Mobilenet V1</option>
4747
<option value="tiny_face_detector">Tiny Face Detector</option>
48-
<option value="mtcnn">MTCNN</option>
4948
</select>
5049
<label>Select Face Detector</label>
5150
</div>
@@ -111,29 +110,6 @@
111110
</span>
112111
<!-- tiny_face_detector_controls -->
113112

114-
<!-- mtcnn_controls -->
115-
<span id="mtcnn_controls">
116-
<div class="row side-by-side">
117-
<div class="row">
118-
<label for="minFaceSize">Minimum Face Size:</label>
119-
<input disabled value="20" id="minFaceSize" type="text" class="bold">
120-
</div>
121-
<button
122-
class="waves-effect waves-light btn"
123-
onclick="onDecreaseMinFaceSize()"
124-
>
125-
<i class="material-icons left">-</i>
126-
</button>
127-
<button
128-
class="waves-effect waves-light btn"
129-
onclick="onIncreaseMinFaceSize()"
130-
>
131-
<i class="material-icons left">+</i>
132-
</button>
133-
</div>
134-
</span>
135-
<!-- mtcnn_controls -->
136-
137113
</body>
138114

139115
<script>

examples/examples-browser/views/bbtFaceRecognition.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<select id="selectFaceDetector">
3131
<option value="ssd_mobilenetv1">SSD Mobilenet V1</option>
3232
<option value="tiny_face_detector">Tiny Face Detector</option>
33-
<option value="mtcnn">MTCNN</option>
3433
</select>
3534
<label>Select Face Detector</label>
3635
</div>
@@ -112,29 +111,6 @@
112111
</span>
113112
<!-- tiny_face_detector_controls -->
114113

115-
<!-- mtcnn_controls -->
116-
<span id="mtcnn_controls">
117-
<div class="row side-by-side">
118-
<div class="row">
119-
<label for="minFaceSize">Minimum Face Size:</label>
120-
<input disabled value="20" id="minFaceSize" type="text" class="bold">
121-
</div>
122-
<button
123-
class="waves-effect waves-light btn"
124-
onclick="onDecreaseMinFaceSize()"
125-
>
126-
<i class="material-icons left">-</i>
127-
</button>
128-
<button
129-
class="waves-effect waves-light btn"
130-
onclick="onIncreaseMinFaceSize()"
131-
>
132-
<i class="material-icons left">+</i>
133-
</button>
134-
</div>
135-
</span>
136-
<!-- mtcnn_controls -->
137-
138114
</body>
139115

140116
<script>

examples/examples-browser/views/faceDetection.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<select id="selectFaceDetector">
4646
<option value="ssd_mobilenetv1">SSD Mobilenet V1</option>
4747
<option value="tiny_face_detector">Tiny Face Detector</option>
48-
<option value="mtcnn">MTCNN</option>
4948
</select>
5049
<label>Select Face Detector</label>
5150
</div>
@@ -111,29 +110,6 @@
111110
</span>
112111
<!-- tiny_face_detector_controls -->
113112

114-
<!-- mtcnn_controls -->
115-
<span id="mtcnn_controls">
116-
<div class="row side-by-side">
117-
<div class="row">
118-
<label for="minFaceSize">Minimum Face Size:</label>
119-
<input disabled value="20" id="minFaceSize" type="text" class="bold">
120-
</div>
121-
<button
122-
class="waves-effect waves-light btn"
123-
onclick="onDecreaseMinFaceSize()"
124-
>
125-
<i class="material-icons left">-</i>
126-
</button>
127-
<button
128-
class="waves-effect waves-light btn"
129-
onclick="onIncreaseMinFaceSize()"
130-
>
131-
<i class="material-icons left">+</i>
132-
</button>
133-
</div>
134-
</span>
135-
<!-- mtcnn_controls -->
136-
137113
</body>
138114

139115
<script>

examples/examples-browser/views/faceExpressionRecognition.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<select id="selectFaceDetector">
4646
<option value="ssd_mobilenetv1">SSD Mobilenet V1</option>
4747
<option value="tiny_face_detector">Tiny Face Detector</option>
48-
<option value="mtcnn">MTCNN</option>
4948
</select>
5049
<label>Select Face Detector</label>
5150
</div>
@@ -111,29 +110,6 @@
111110
</span>
112111
<!-- tiny_face_detector_controls -->
113112

114-
<!-- mtcnn_controls -->
115-
<span id="mtcnn_controls">
116-
<div class="row side-by-side">
117-
<div class="row">
118-
<label for="minFaceSize">Minimum Face Size:</label>
119-
<input disabled value="20" id="minFaceSize" type="text" class="bold">
120-
</div>
121-
<button
122-
class="waves-effect waves-light btn"
123-
onclick="onDecreaseMinFaceSize()"
124-
>
125-
<i class="material-icons left">-</i>
126-
</button>
127-
<button
128-
class="waves-effect waves-light btn"
129-
onclick="onIncreaseMinFaceSize()"
130-
>
131-
<i class="material-icons left">+</i>
132-
</button>
133-
</div>
134-
</span>
135-
<!-- mtcnn_controls -->
136-
137113
</body>
138114

139115
<script>

examples/examples-browser/views/faceExtraction.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<select id="selectFaceDetector">
2929
<option value="ssd_mobilenetv1">SSD Mobilenet V1</option>
3030
<option value="tiny_face_detector">Tiny Face Detector</option>
31-
<option value="mtcnn">MTCNN</option>
3231
</select>
3332
<label>Select Face Detector</label>
3433
</div>
@@ -107,29 +106,6 @@
107106
</span>
108107
<!-- tiny_face_detector_controls -->
109108

110-
<!-- mtcnn_controls -->
111-
<span id="mtcnn_controls">
112-
<div class="row side-by-side">
113-
<div class="row">
114-
<label for="minFaceSize">Minimum Face Size:</label>
115-
<input disabled value="20" id="minFaceSize" type="text" class="bold">
116-
</div>
117-
<button
118-
class="waves-effect waves-light btn"
119-
onclick="onDecreaseMinFaceSize()"
120-
>
121-
<i class="material-icons left">-</i>
122-
</button>
123-
<button
124-
class="waves-effect waves-light btn"
125-
onclick="onIncreaseMinFaceSize()"
126-
>
127-
<i class="material-icons left">+</i>
128-
</button>
129-
</div>
130-
</span>
131-
<!-- mtcnn_controls -->
132-
133109
</div>
134110

135111
<script>

examples/examples-browser/views/faceLandmarkDetection.html

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
<select id="selectFaceDetector">
4646
<option value="ssd_mobilenetv1">SSD Mobilenet V1</option>
4747
<option value="tiny_face_detector">Tiny Face Detector</option>
48-
<option value="mtcnn">MTCNN</option>
4948
</select>
5049
<label>Select Face Detector</label>
5150
</div>
@@ -118,29 +117,6 @@
118117
</span>
119118
<!-- tiny_face_detector_controls -->
120119

121-
<!-- mtcnn_controls -->
122-
<span id="mtcnn_controls">
123-
<div class="row side-by-side">
124-
<div class="row">
125-
<label for="minFaceSize">Minimum Face Size:</label>
126-
<input disabled value="20" id="minFaceSize" type="text" class="bold">
127-
</div>
128-
<button
129-
class="waves-effect waves-light btn"
130-
onclick="onDecreaseMinFaceSize()"
131-
>
132-
<i class="material-icons left">-</i>
133-
</button>
134-
<button
135-
class="waves-effect waves-light btn"
136-
onclick="onIncreaseMinFaceSize()"
137-
>
138-
<i class="material-icons left">+</i>
139-
</button>
140-
</div>
141-
</span>
142-
<!-- mtcnn_controls -->
143-
144120
</body>
145121

146122
<script>

0 commit comments

Comments
 (0)