Face Detection with Deep Learning
Brett's Pick this week isMTCNN Face Detection, byJustin Pinkney, a MathWorks colleague from our Consulting Department.
We have provided the functionality to detect faces using MathWorks' tools since 2012. Our face detectors, which live in theComputer Vision Toolbox, rely on theViola-Jones algorithm, and are very easy to implement:
img = imread('visionteam.jpg'); imshow(img) faceDetector = vision.CascadeObjectDetector(); bboxes = step(faceDetector, img); figure imshow(img) title('Face Detection using the Cascade Object Detector')forii = 1:size(bboxes, 1) drawrectangle('Position', bboxes(ii, :),'facealpha', 0);end
The default model for the (tunable) cascade object detector uses classification and regression tree analysis (CART) of"Haar-like" features. As you can see above, the models often work quite well. Additionally, you can engage a 'FrontalFaceLBP' model to detect faces using"Local Binary Patterns."Both models work well for the image above, to detect faces that are upright and forward facing.
有其他检测模型可以调用with the CascadeObjectDetector, including 'UpperBody', 'EyePair' (big and small), 'LeftEye' and 'RightEye' (two options), 'ProfileFace', 'Mouth', and 'Nose'. (In addition, you can readilytrain your own!)
Which brings me to today's Pick.
Justin's submission implements"Multi-task Cascaded Convolutional Networks" (MTCCN)to solve the face detection problem. Having options is good; the built-in models don'talwayswork well:
Note the large number of false positives, in both instances.
In contrast, the MTCCN model works remarkably well on this image:
[bboxes, scores, landmarks] = mtcnn.detectFaces(img); figure imshow(img) title('MTCNN')forii = 1:size(bboxes, 1) drawrectangle('Position', bboxes(ii, :),'facealpha', 0);end
Another thing I appreciate is that facial landmarks are provided automatically as outputs of the MTCNN Model:
holdonxs = landmarks(:, :, 1); ys = landmarks(:, :, 2);forii = 1:size(xs, 1)forjj = 1:size(xs, 2) plot(xs(ii, jj), ys(ii, jj),'r.')endend
The MTCNN model also appears to be fairly robust; it even works on the 'cameraman' image, despite the fact that the face in the image is clearly not forward facing. (Both vision.CascadeObjectDetector face detectors fail on the image, at least with default parameterizations.)
I should also note that whereas the built-in Toolbox functions can adapt to RGB or grayscale images, the MTCNN detector operates on only on RGB images. But that's an easy problem to address:
ifsize(img, 3) == 1 img = repmat(img, [1 1 3]);end
Thanks, Justin! This is a nice addition to our detection tools!
As always, I welcome yourthoughts and comments.
- 범주:
- Picks
댓글
댓글을 남기려면링크를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.