Skip to content

Commit 8bfcbca

Browse files
Merge pull request #4 from matlab-deep-learning/bugfix/detectFacesOptions/3
Adds support for Name Value pairs in detectFaces
2 parents e1d16a1 + cc972fa commit 8bfcbca

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.mltbx

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ detector = mtcnn.Detector();
4747

4848
The detector object accepts the same optional arguments as the `mtcnn.detectFaces` function.
4949

50-
Refer to the MATLAB toolbox documentation or [click here](docs/gettings_started.md) for a complete example.
50+
Refer to the MATLAB toolbox documentation or [click here](docs/getting_started.md) for a complete example.
5151

5252
## About
5353

code/mtcnn/+mtcnn/detectFaces.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function [bboxes, scores, landmarks] = detectFaces(im)
1+
function [bboxes, scores, landmarks] = detectFaces(im, varargin)
22
% detectFaces Use a pretrained model to detect faces in an image.
33
%
44
% Args:
@@ -34,6 +34,6 @@
3434

3535
% Copyright 2019 The MathWorks, Inc.
3636

37-
detector = mtcnn.Detector();
37+
detector = mtcnn.Detector(varargin{:});
3838
[bboxes, scores, landmarks] = detector.detect(im);
3939
end

code/mtcnn/Contents.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
% MTCNN
2-
% Version 1.0 (R2019b) 02-December-2019
2+
% Version 1.0.1 (R2019b) 22-January-2020
33
%
44
% Files
55
% mtcnn.detectFaces - Use a pretrained model to detect faces in an image.

mtcnn.prj

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<param.description>This repository implements deep learning based face detection and facial landmark localisation using Multi-Task Cascaded CNNs.
99
For more details see the GitHub repository: https://github.com/matlab-deep-learning/mtcnn-face-detection</param.description>
1010
<param.screenshot>${PROJECT_ROOT}\doc\logo.png</param.screenshot>
11-
<param.version>1.0</param.version>
11+
<param.version>1.0.1</param.version>
1212
<param.output>${PROJECT_ROOT}\MTCNN Face Detection.mltbx</param.output>
1313
<param.products.name>
1414
<item>Computer Vision Toolbox</item>
@@ -55,7 +55,6 @@ For more details see the GitHub repository: https://github.com/matlab-deep-learn
5555
<param.additional.sw.mac.url />
5656
<param.additional.sw.linux.url />
5757
<unset>
58-
<param.version />
5958
<param.output />
6059
<param.platforms />
6160
<param.exclude.filters />

test/+tests/DetectFacesTest.m

+15
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ function testDefaultDetect(test)
3232
test.assertEqual(scores, test.Reference.scores, "RelTol", 1e-6);
3333
test.assertEqual(landmarks, test.Reference.landmarks, "RelTol", 1e-6);
3434
end
35+
36+
function testDetectWithOptions(test)
37+
% We should be able to pass name value paris to detect faces
38+
opts = {"MinSize", 20, ...
39+
"MaxSize", 100, ...
40+
"PyramidScale", 1.5, ...
41+
"ConfidenceThresholds", [0.6, 0.6, 0.6], ...
42+
"NmsThresholds", [0.6, 0.6, 0.6]};
43+
44+
[bboxes, scores, landmarks] = mtcnn.detectFaces(test.Image, opts{:});
45+
46+
test.assertEqual(size(bboxes), [6, 4]);
47+
test.assertEqual(size(scores), [6, 1]);
48+
test.assertEqual(size(landmarks), [6, 5, 2]);
49+
end
3550
end
3651

3752
end

0 commit comments

Comments
 (0)