-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from matlab-deep-learning/bugfix/selectStronge…
…stOrder/17 Fixes issue with ordering of boxes and landmarks
- Loading branch information
Showing
3 changed files
with
38 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
classdef RegressionTest < matlab.unittest.TestCase | ||
% Test cases for known bugs that have been fixed | ||
|
||
% Copyright 2020 The MathWorks, Inc. | ||
|
||
methods (Test) | ||
function testSelectStrongestBug(test) | ||
% GitHub issue #17 | ||
im = imread("visionteam1.jpg"); | ||
|
||
[bboxes, scores, landmarks] = mtcnn.detectFaces(im, "ConfidenceThresholds", repmat(0.01, [3, 1])); | ||
for iBox = 1:size(bboxes, 1) | ||
test.assertInBox(landmarks(iBox, :, :), bboxes(iBox, :)); | ||
end | ||
end | ||
end | ||
|
||
methods | ||
function assertInBox(test, landmarks, box) | ||
% check that all landmarks are within the bounding box | ||
tf = all(inpolygon(landmarks(1, :, 1), ... | ||
landmarks(1, :, 2), ... | ||
[box(1), box(1) + box(3), box(1) + box(3), box(1)], ... | ||
[box(2), box(2), box(2) + box(4), box(2) + box(4)])); | ||
test.assertTrue(tf, "Landmarks should all be inside bounding box"); | ||
end | ||
end | ||
|
||
end |