add:添加SeetaFace6Open的人脸关键点遮挡模型

This commit is contained in:
divenswu 2023-04-27 17:16:50 +08:00
parent 91bf0b8853
commit 76c3eaa7e0
3 changed files with 21 additions and 4 deletions

View File

@ -22,7 +22,7 @@ public class QualityInfo {
public boolean isMask(){ public boolean isMask(){
return true; return null != this.maskPoints && this.maskPoints.isMask();
} }
@ -45,6 +45,10 @@ public class QualityInfo {
return score; return score;
} }
public boolean isMask(){
return this.score >= 0.5;
}
@Override @Override
public String toString() { public String toString() {
return "Mask{" + "score=" + score + '}'; return "Mask{" + "score=" + score + '}';
@ -108,5 +112,18 @@ public class QualityInfo {
super.addAll(Arrays.asList(point)); super.addAll(Arrays.asList(point));
return this; return this;
} }
/**
* 判定是否存在遮挡
* @return
*/
public boolean isMask(){
for(MaskPoint point : this){
if(point.isMask()){
return true;
}
}
return false;
}
} }
} }

View File

@ -41,10 +41,10 @@ public class SeetaMaskFaceKeyPointTest extends BaseTest {
QualityInfo.MaskPoints maskPoints = keyPointInfer.inference(cropImageMat, null); QualityInfo.MaskPoints maskPoints = keyPointInfer.inference(cropImageMat, null);
System.out.println(maskPoints); System.out.println(maskPoints);
for(QualityInfo.MaskPoint maskPoint : maskPoints){ for(QualityInfo.MaskPoint maskPoint : maskPoints){
if(maskPoint.score >= 0.5){ if(maskPoint.isMask()){
Imgproc.circle(cropFace, new Point(maskPoint.x, maskPoint.y), 3, new Scalar(0,0,255), -1); Imgproc.circle(cropFace, new Point(maskPoint.x, maskPoint.y), 3, new Scalar(0, 0, 255), -1);
}else{ }else{
Imgproc.circle(cropFace, new Point(maskPoint.x, maskPoint.y), 3, new Scalar(255, 0,0), -1); Imgproc.circle(cropFace, new Point(maskPoint.x, maskPoint.y), 3, new Scalar(255, 0, 0), -1);
} }
} }
HighGui.imshow(fileName, cropFace); HighGui.imshow(fileName, cropFace);