Skip to content

Commit

Permalink
Account for new gpuArray support in selectStrongestBboxes (#26)
Browse files Browse the repository at this point in the history
Fixes #20.

selectStrongestBbox got gpuArray support in MATLAB R2020b. Previously the gather was required if bboxes was gpuArray and needed to be on the cpu (strangely the scores didn't matter).

In R2020b they need to be the same either both on the gpu or not, so we
do a version check and adjust behaviour accordingly
  • Loading branch information
justinpinkney committed Mar 2, 2021
1 parent 6823caa commit 503f4ac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/mtcnn/+mtcnn/Detector.m
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,12 @@
bboxes = mtcnn.util.applyCorrection(bboxes, correction);
bboxes(faceProbs < obj.ConfidenceThresholds(netIdx), :) = [];
scores = faceProbs(faceProbs >= obj.ConfidenceThresholds(netIdx));
if ~isempty(scores)
[bboxes, scores, index] = selectStrongestBbox(gather(bboxes), scores, ...
if ~isempty(scores)
if verLessThan("matlab", "9.9")
% < R2020b no gpuArray support for selectStrongestBbox
[bboxes, scores] = gather(bboxes, scores);
end
[bboxes, scores, index] = selectStrongestBbox(bboxes, scores, ...
"RatioType", "Min", ...
"OverlapThreshold", obj.NmsThresholds(netIdx));
if netIdx == 3
Expand Down

0 comments on commit 503f4ac

Please sign in to comment.