|
@@ -21,7 +21,8 @@ type FaceBox = {
|
21
|
21
|
|
22
|
22
|
type InitInput = {
|
23
|
23
|
baseUrl: string,
|
24
|
|
- detectionTypes: string[]
|
|
24
|
+ detectionTypes: string[],
|
|
25
|
+ maxFacesDetected?: number
|
25
|
26
|
}
|
26
|
27
|
|
27
|
28
|
type DetectOutput = {
|
|
@@ -44,6 +45,7 @@ export class HumanHelper implements FaceLandmarksHelper {
|
44
|
45
|
protected human: Human | undefined;
|
45
|
46
|
protected faceDetectionTypes: string[];
|
46
|
47
|
protected baseUrl: string;
|
|
48
|
+ protected maxFacesDetected?: number;
|
47
|
49
|
private detectionInProgress = false;
|
48
|
50
|
private lastValidFaceBox: FaceBox | undefined;
|
49
|
51
|
/**
|
|
@@ -59,11 +61,12 @@ export class HumanHelper implements FaceLandmarksHelper {
|
59
|
61
|
deallocate: true,
|
60
|
62
|
filter: { enabled: false },
|
61
|
63
|
face: {
|
62
|
|
- enabled: true,
|
|
64
|
+ enabled: false,
|
63
|
65
|
detector: {
|
64
|
66
|
enabled: false,
|
65
|
67
|
rotation: false,
|
66
|
|
- modelPath: 'blazeface-front.json'
|
|
68
|
+ modelPath: 'blazeface-front.json',
|
|
69
|
+ maxDetected: 4
|
67
|
70
|
},
|
68
|
71
|
mesh: { enabled: false },
|
69
|
72
|
iris: { enabled: false },
|
|
@@ -79,9 +82,10 @@ export class HumanHelper implements FaceLandmarksHelper {
|
79
|
82
|
segmentation: { enabled: false }
|
80
|
83
|
};
|
81
|
84
|
|
82
|
|
- constructor({ baseUrl, detectionTypes }: InitInput) {
|
|
85
|
+ constructor({ baseUrl, detectionTypes, maxFacesDetected }: InitInput) {
|
83
|
86
|
this.faceDetectionTypes = detectionTypes;
|
84
|
87
|
this.baseUrl = baseUrl;
|
|
88
|
+ this.maxFacesDetected = maxFacesDetected;
|
85
|
89
|
this.init();
|
86
|
90
|
}
|
87
|
91
|
|
|
@@ -97,7 +101,11 @@ export class HumanHelper implements FaceLandmarksHelper {
|
97
|
101
|
|
98
|
102
|
if (this.faceDetectionTypes.length > 0 && this.config.face) {
|
99
|
103
|
this.config.face.enabled = true
|
100
|
|
- }
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ if (this.maxFacesDetected && this.config.face?.detector) {
|
|
107
|
+ this.config.face.detector.maxDetected = this.maxFacesDetected;
|
|
108
|
+ }
|
101
|
109
|
|
102
|
110
|
if (this.faceDetectionTypes.includes(DETECTION_TYPES.FACE_BOX) && this.config.face?.detector) {
|
103
|
111
|
this.config.face.detector.enabled = true;
|